html.xsl
branchstyles
changeset 3 6e7e05c2ded6
parent 0 08de8d15f932
child 5 20b41b986ac6
--- a/html.xsl	Fri Feb 03 16:28:04 2006 -0500
+++ b/html.xsl	Mon Jul 17 13:43:11 2006 -0400
@@ -59,7 +59,9 @@
     <body class="book">
       <xsl:apply-templates select="docinfo/date"/>
       <xsl:apply-templates/>
-      <xsl:apply-templates mode="book-toc"/>
+      <ul>
+	<xsl:apply-templates mode="book-toc" select="section|story|poetry"/>
+      </ul>
       <hr/>
       <address>
         <xsl:apply-templates select="docinfo/copyright"/>
@@ -69,16 +71,20 @@
   </html>
 </xsl:template>
 
-<xsl:template match="book/section" mode="book-toc">
+<xsl:template match="section" mode="book-toc">
   <xsl:variable name="href">
     <xsl:call-template name="get-id"/>
   </xsl:variable>
-  <h2>
+  <li>
     <a id="{$href}" href="{$href}.html">
       <xsl:apply-templates select="title" mode="book-toc"/>
     </a>
-  </h2>
+  </li>
 </xsl:template>
+<xsl:template match="title" mode="book-toc">
+  <xsl:apply-templates/>
+</xsl:template>
+
 
 <!-- title default processing -->
 <xsl:template match="title">
@@ -332,11 +338,11 @@
   <a href="index.html#{$section-ref}">Retour à la table des matières</a><br/>
 </xsl:template>
 
-<!-- The book-toc section -->
-<xsl:template match="book/section">
+<!-- section files -->
+<xsl:template match="section">
   <xsl:variable name="href">
     <xsl:call-template name="get-id"/>
-  </xsl:variable>
+  </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"
@@ -348,10 +354,14 @@
       </head>
       <body>
         <h1><xsl:value-of select="title"/></h1>
-        <xsl:apply-templates select="child::*[name(.) != 'story' or name(.)!= 'poetry']"/>
-        <ul>
-          <xsl:apply-templates mode="section-toc"/>
-        </ul>
+
+        <xsl:apply-templates/>
+
+	<xsl:if test="child::*[name(.)='story' or name(.)='poetry' or name(.)='section']">
+	  <ul>
+	    <xsl:apply-templates mode="book-toc" select="child::*[name(.)='story' or name(.)='poetry' or name(.)='section']"/>
+	  </ul>
+	</xsl:if>
         <hr/>
         <address>
           <xsl:apply-templates select="../copyright"/>
@@ -360,11 +370,6 @@
       </body>
     </html>
   </xt:document>
-  <xsl:apply-templates select="story|poetry"/>
-</xsl:template>
-
-<xsl:template match="section/title" mode="book-toc">
-  <xsl:apply-templates/>
 </xsl:template>
 
 <!-- anything else is clear -->
@@ -428,9 +433,29 @@
   </a>
 </xsl:template>
 
+<xsl:template match="xref">
+  <xsl:variable name="linkend" select="@linkend"/>
+  <xsl:apply-templates select="//*[@id=$linkend]" mode="xref"/>
+</xsl:template>
+
+<xsl:template match="section" mode="xref">
+  <xsl:variable name="href">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <a href="{$href}.html"><xsl:value-of select="title"/></a>
+</xsl:template>
+
+<xsl:template match="book" mode="xref">
+  <xsl:variable name="href">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
+</xsl:template>
+
+<xsl:template match="*" mode="xref"/>
+
 <xsl:template match="section/title"/>
 <xsl:template match="section/subtitle"/>
 
-
 </xsl:stylesheet>