[svn r2097] r2155@freebird: fabien | 2006-07-15 23:26:24 -0400 styles
authorfabien
Mon, 17 Jul 2006 13:43:11 -0400
branchstyles
changeset 3 6e7e05c2ded6
parent 2 f8261635ebe0
child 4 301b54644bfa
[svn r2097] r2155@freebird: fabien | 2006-07-15 23:26:24 -0400 Mise en place de trois index pour les poèmes. Modifications des feuilles de styles pour utiliser des xref seulement.
html.xsl
poetry_html.xsl
poetry_print.xsl
story_html.xsl
--- 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>
 
--- 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 -->
--- a/poetry_print.xsl	Fri Feb 03 16:28:04 2006 -0500
+++ b/poetry_print.xsl	Mon Jul 17 13:43:11 2006 -0400
@@ -145,6 +145,9 @@
 
 <xsl:template match="poem">
   <block xsl:use-attribute-sets="standard-block">
+    <xsl:attribute name="id">
+      <xsl:value-of select="../@id"/>
+    </xsl:attribute>
     <xsl:apply-templates/>
   </block>
 </xsl:template>
@@ -174,23 +177,20 @@
   <xsl:apply-templates/>
 </xsl:template>
 
+<xsl:template match="poetry" mode="xref">
+  <xsl:variable name="href">
+    <xsl:call-template name="get-id"/>
+  </xsl:variable>
+  <basic-link internal-destination="{$href}">
+    <xsl:value-of select="docinfo/title"/>
+    (<page-number-citation ref-id="{$href}"/>)
+  </basic-link>
+</xsl:template>
+
+<xsl:template match="xref">
+  <xsl:variable name="linkend" select="@linkend"/>
+  <xsl:apply-templates mode="xref" select="//*[@id=$linkend]"/>
+</xsl:template>
+
 </xsl:stylesheet>
 
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: xml
-sgml-omittag:nil
-sgml-shorttag:nil
-sgml-namecase-general:nil
-sgml-general-insert-case:lower
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:nil
-sgml-parent-document:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-outline-regexp:"<xsl:"
-End:
--->
--- a/story_html.xsl	Fri Feb 03 16:28:04 2006 -0500
+++ b/story_html.xsl	Mon Jul 17 13:43:11 2006 -0400
@@ -189,6 +189,12 @@
   </xt:document>
 </xsl:template>
 
+<xsl:template match="story//section">
+  <div class="section">
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
 <!-- strophe -->
 <xsl:template match="strophe">
   <p><xsl:apply-templates/></p>
@@ -242,5 +248,12 @@
   </div>
 </xsl:template>
 
+<xsl:template match="story" 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:stylesheet>