poetry_html.xsl
branchstyles
changeset 3 6e7e05c2ded6
parent 0 08de8d15f932
child 15 27a2a404231e
--- a/poetry_html.xsl	Fri Feb 03 16:28:04 2006 -0500
+++ b/poetry_html.xsl	Mon Jul 17 13:43:11 2006 -0400
@@ -14,25 +14,26 @@
 <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:template match="poetry" mode="xref">
   <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>
+  <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
+  <xsl:if test="nda">
+    [<a href="{$href}_nda.html">NdA</a>]
+  </xsl:if>
 </xsl:template>
 
-<xsl:template match="section" mode="book-toc">
-  <xsl:variable name="href">
+<xsl:template match="section[@role='null']" mode="book-toc"/>
+<xsl:template match="section[@role='null']">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="book/section" mode="navbar-section">
+  <xsl:variable name="section-ref">
     <xsl:call-template name="get-id"/>
   </xsl:variable>
-  <li>
-    <a href="{$href}.html"><xsl:value-of select="title"/></a>
-  </li>
+  <a href="index.html#{$section-ref}">Retour à la table des matières</a><br/>
 </xsl:template>
 
 <xsl:template match="poetry" mode="navbar-name">
@@ -46,49 +47,35 @@
   </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 name="my-id">
+    <xsl:value-of select="@id"/>
   </xsl:variable>
-  <a href="{$section-ref}.html">Retour à la section</a><br/>
+  <ul class="navbar">
+    <xsl:for-each select="//xref[@linkend=$my-id]">
+      <li>
+	<xsl:variable name="mysection" select="ancestor::section[last()]/@id"/>
+	<xsl:for-each select="ancestor::section">
+	  <xsl:apply-templates select="." mode="xref"/>
+	  <xsl:if test="descendant::section">
+	    <xsl:text> : </xsl:text>
+	  </xsl:if>
+	</xsl:for-each>
+	<ul>
+	  <xsl:if test="preceding::xref[1]/ancestor::section[last()]/@id=$mysection">
+	    <li><xsl:text>Précédent: </xsl:text>
+	    <xsl:apply-templates select="preceding::xref[1]"/>
+	    </li>
+	  </xsl:if>
+	  <xsl:if test="following::xref[1]/ancestor::section[last()]/@id=$mysection">
+	    <li><xsl:text>Suivant: </xsl:text>
+	    <xsl:apply-templates select="following::xref[1]"/>
+	    </li>
+	  </xsl:if>
+	</ul>
+      </li>
+    </xsl:for-each>
+  </ul>
 </xsl:template>
 
 <!-- poetry section -->