poetry_html.xsl
branchstyles
changeset 0 08de8d15f932
child 3 6e7e05c2ded6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/poetry_html.xsl	Tue Dec 27 13:55:27 2005 -0500
@@ -0,0 +1,174 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.1"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xt="http://www.jclark.com/xt"
+  xmlns="http://www.w3.org/1999/xhtml"
+  extension-element-prefixes="xt">
+  <xsl:import href="html.xsl"/>
+  <xsl:output method="xml"
+	encoding="utf-8"
+        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+        indent="yes"/>
+
+<xsl:param name="stylesheet"><xsl:text>poetry.css</xsl:text></xsl:param>
+<xsl:param name="pdf-filename"><xsl:text>poetry.pdf</xsl:text></xsl:param>
+
+<xsl:template match="poetry" mode="section-toc">
+  <xsl:variable name="href">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <li>
+    <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
+      <xsl:if test="nda">
+        [<a href="{$href}_nda.html">NdA</a>]
+      </xsl:if>
+  </li>
+</xsl:template>
+
+<xsl:template match="section" mode="book-toc">
+  <xsl:variable name="href">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <li>
+    <a href="{$href}.html"><xsl:value-of select="title"/></a>
+  </li>
+</xsl:template>
+
+<xsl:template match="poetry" mode="navbar-name">
+  <xsl:choose>
+    <xsl:when test="docinfo/title">
+      <xsl:value-of select="docinfo/title/text()"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="poem/title/text()"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="poetry" mode="navbar-prec">
+  <xsl:call-template name="navbar-link">
+    <xsl:with-param name="prefix">
+      <xsl:text>Précédent: </xsl:text>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+<xsl:template match="poetry" mode="navbar-next">
+  <xsl:call-template name="navbar-link">
+    <xsl:with-param name="prefix">
+      <xsl:text>Suivant: </xsl:text>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+<xsl:template match="poetry" mode="navbar-poetry">
+  <xsl:choose>
+    <xsl:when test="preceding-sibling::poetry[1]">
+      <xsl:apply-templates 
+          select="preceding-sibling::poetry[1]"
+          mode="navbar-prec"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates 
+        select="../preceding-sibling::section[last()]"
+          mode="navbar-prec"/>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:choose>
+    <xsl:when test="following-sibling::poetry[1]">
+      <xsl:apply-templates 
+          select="following-sibling::poetry[1]"
+          mode="navbar-next"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates 
+        select="../following-sibling::*[1]"
+          mode="navbar-next"/>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:variable name="section-ref">
+    <xsl:call-template name="parent-id"/>
+  </xsl:variable>
+  <a href="{$section-ref}.html">Retour à la section</a><br/>
+</xsl:template>
+
+<!-- poetry section -->
+<xsl:template match="poetry/poem">
+  <xsl:variable name="href">
+    <xsl:call-template name="parent-id"/>
+  </xsl:variable>
+  <xt:document href="{$href}.html" method="xml" encoding="utf-8"
+        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+        indent="yes">
+    <html>
+      <head>
+        <xsl:apply-templates select="../docinfo" mode="heading"/>
+        <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
+      </head>
+      <body>
+        <xsl:apply-templates/>
+        <xsl:apply-templates select="../docinfo/date"/>
+        <hr/>
+        <address>
+          <xsl:apply-templates select="../docinfo/copyright"/>
+        </address>
+        <xsl:if test="../nda">
+          <a href="{$href}_nda.html">Notes de l'auteur.</a><br/>
+        </xsl:if>
+        <xsl:apply-templates mode="navbar-poetry" select=".."/>
+      </body>
+    </html>
+  </xt:document>
+</xsl:template>
+
+<xsl:template match="poetry/nda">
+  <xsl:variable name="href">
+    <xsl:call-template name="parent-id"/>
+  </xsl:variable>
+  <xt:document method="xml" encoding="utf-8" href="{$href}_nda.html"
+        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+        indent="yes">
+    <html>
+      <head>
+        <xsl:apply-templates select="../docinfo" mode="heading-nda"/>
+      <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
+      </head>
+      <body>
+        <xsl:apply-templates/>
+        <hr/>
+        <address>
+          <xsl:apply-templates select="../docinfo/copyright"/>
+        </address>
+        <a href="{$href}.html">Retour au poème.</a><br/>
+        <xsl:apply-templates mode="navbar-poetry" select=".."/>
+      </body>
+    </html>
+  </xt:document>
+</xsl:template>
+
+<!-- strophe -->
+<xsl:template match="strophe">
+  <p><xsl:apply-templates/></p>
+</xsl:template>
+
+<!-- verse -->
+<xsl:template match="verse">
+  <xsl:apply-templates/><br/>
+</xsl:template>
+
+<!-- cue -->
+<xsl:template match="cue">
+  <p><xsl:apply-templates/></p>
+</xsl:template>
+<xsl:template match="caracter">
+  <strong class="caracter">
+    <xsl:apply-templates/>
+  </strong><xsl:text>: </xsl:text>
+</xsl:template>
+<xsl:template match="cue/para">
+  <xsl:apply-templates/>
+</xsl:template>
+
+</xsl:stylesheet>
+