diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-04 16:09:22 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:19:33 +0200 |
commit | 914fa8774c8165c4072cafcc1f1ca1a033c9e9bc (patch) | |
tree | f3a2e07022c4cebcdc029d1eede147084bdf186c | |
parent | dc0e58525775ada3effb24020cdea0dfc7b57838 (diff) |
Improve the poem to html transformation
-rw-r--r-- | contrib/xslt/poem.xsl | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/contrib/xslt/poem.xsl b/contrib/xslt/poem.xsl index 197ec4a..a3bd3b0 100644 --- a/contrib/xslt/poem.xsl +++ b/contrib/xslt/poem.xsl @@ -3,23 +3,27 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:poem="poem"> + xmlns:poem="poem" + exclude-result-prefixes="poem"> <xsl:output method="html" encoding="utf-8" indent="yes" /> <xsl:template match="/"> + <xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text> <html> <head> - <title>Poem</title> + <title><xsl:value-of select="/document/poem:poem/author"/> – <xsl:value-of select="/document/poem:poem/title"/></title> <style type="text/css"> body { - font-size: 14pt; - line-height: 1.75; - font-family: Palatino, serif; + font-size: 12pt; + line-height: 1.5; + font-family: "Gentium Book Basic", Palatino, serif; color: black; } h1, h2, h3 { font-size: 100%; +} +h1, h2 { font-weight: bold; } h1 span.title { @@ -28,21 +32,35 @@ h1 span.title { h1 span.subtitle { display: block; } +h2 { + text-transform: uppercase; +} +h3 { + font-weight: normal; + font-style: italic; +} .poem { position: relative; - padding-left: 4em; + padding-left: 3em; } -.poem h2 { - font-size: 100%; +.poem p { + margin: 0; + padding: 0; } .linenumber { position: absolute; left: 0; - width: 2em; + width: 3em; text-align: right; -moz-user-select: none; -webkizt-user-select: none; user-select: none; + font-size: 60%; + cursor: default; +} +.linenumber:before { + content: "\200B"; + font-size: 166.666%; } .indentation { display: block; @@ -57,13 +75,13 @@ h1 span.subtitle { </xsl:template> <xsl:template match="/document/poem:poem"> - <section class="poem"> + <article class="poem"> <h1> <span class="title"> <xsl:value-of select="title"/> </span> <span class="subtitle"> - <xsl:text>by </xsl:text> + <xsl:text> by </xsl:text> <a rel="author"><xsl:value-of select="author"/></a> <xsl:text> (</xsl:text> <span class="year"> @@ -73,11 +91,18 @@ h1 span.subtitle { </span> </h1> <xsl:apply-templates select="poem:*"/> + </article> + </xsl:template> + + <xsl:template match="poem:part"> + <section class="part"> + <h2>Part <xsl:number level="any" from="poem:poem" format="I"/></h2> + <xsl:apply-templates select="poem:*"/> </section> </xsl:template> <xsl:template match="poem:stanza"> - <h2><xsl:number level="any" from="poem:poem" format="I."/></h2> + <h3><xsl:number level="any" from="poem:part|poem:poem" format="I"/></h3> <p class="stanza"> <xsl:apply-templates select="poem:*"/> </p> |