poetry_html.xsl
branchstyles
changeset 3 6e7e05c2ded6
parent 0 08de8d15f932
child 15 27a2a404231e
equal deleted inserted replaced
2:f8261635ebe0 3:6e7e05c2ded6
    12         indent="yes"/>
    12         indent="yes"/>
    13 
    13 
    14 <xsl:param name="stylesheet"><xsl:text>poetry.css</xsl:text></xsl:param>
    14 <xsl:param name="stylesheet"><xsl:text>poetry.css</xsl:text></xsl:param>
    15 <xsl:param name="pdf-filename"><xsl:text>poetry.pdf</xsl:text></xsl:param>
    15 <xsl:param name="pdf-filename"><xsl:text>poetry.pdf</xsl:text></xsl:param>
    16 
    16 
    17 <xsl:template match="poetry" mode="section-toc">
    17 <xsl:template match="poetry" mode="xref">
    18   <xsl:variable name="href">
    18   <xsl:variable name="href">
    19     <xsl:call-template name="get-id"/>
    19     <xsl:call-template name="get-id"/>
    20   </xsl:variable>
    20   </xsl:variable>
    21   <li>
    21   <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
    22     <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
    22   <xsl:if test="nda">
    23       <xsl:if test="nda">
    23     [<a href="{$href}_nda.html">NdA</a>]
    24         [<a href="{$href}_nda.html">NdA</a>]
    24   </xsl:if>
    25       </xsl:if>
       
    26   </li>
       
    27 </xsl:template>
    25 </xsl:template>
    28 
    26 
    29 <xsl:template match="section" mode="book-toc">
    27 <xsl:template match="section[@role='null']" mode="book-toc"/>
    30   <xsl:variable name="href">
    28 <xsl:template match="section[@role='null']">
       
    29   <xsl:apply-templates/>
       
    30 </xsl:template>
       
    31 
       
    32 <xsl:template match="book/section" mode="navbar-section">
       
    33   <xsl:variable name="section-ref">
    31     <xsl:call-template name="get-id"/>
    34     <xsl:call-template name="get-id"/>
    32   </xsl:variable>
    35   </xsl:variable>
    33   <li>
    36   <a href="index.html#{$section-ref}">Retour à la table des matières</a><br/>
    34     <a href="{$href}.html"><xsl:value-of select="title"/></a>
       
    35   </li>
       
    36 </xsl:template>
    37 </xsl:template>
    37 
    38 
    38 <xsl:template match="poetry" mode="navbar-name">
    39 <xsl:template match="poetry" mode="navbar-name">
    39   <xsl:choose>
    40   <xsl:choose>
    40     <xsl:when test="docinfo/title">
    41     <xsl:when test="docinfo/title">
    44       <xsl:value-of select="poem/title/text()"/>
    45       <xsl:value-of select="poem/title/text()"/>
    45     </xsl:otherwise>
    46     </xsl:otherwise>
    46   </xsl:choose>
    47   </xsl:choose>
    47 </xsl:template>
    48 </xsl:template>
    48 
    49 
    49 <xsl:template match="poetry" mode="navbar-prec">
       
    50   <xsl:call-template name="navbar-link">
       
    51     <xsl:with-param name="prefix">
       
    52       <xsl:text>Précédent: </xsl:text>
       
    53     </xsl:with-param>
       
    54   </xsl:call-template>
       
    55 </xsl:template>
       
    56 <xsl:template match="poetry" mode="navbar-next">
       
    57   <xsl:call-template name="navbar-link">
       
    58     <xsl:with-param name="prefix">
       
    59       <xsl:text>Suivant: </xsl:text>
       
    60     </xsl:with-param>
       
    61   </xsl:call-template>
       
    62 </xsl:template>
       
    63 <xsl:template match="poetry" mode="navbar-poetry">
    50 <xsl:template match="poetry" mode="navbar-poetry">
    64   <xsl:choose>
    51   <xsl:variable name="my-id">
    65     <xsl:when test="preceding-sibling::poetry[1]">
    52     <xsl:value-of select="@id"/>
    66       <xsl:apply-templates 
       
    67           select="preceding-sibling::poetry[1]"
       
    68           mode="navbar-prec"/>
       
    69     </xsl:when>
       
    70     <xsl:otherwise>
       
    71       <xsl:apply-templates 
       
    72         select="../preceding-sibling::section[last()]"
       
    73           mode="navbar-prec"/>
       
    74     </xsl:otherwise>
       
    75   </xsl:choose>
       
    76   <xsl:choose>
       
    77     <xsl:when test="following-sibling::poetry[1]">
       
    78       <xsl:apply-templates 
       
    79           select="following-sibling::poetry[1]"
       
    80           mode="navbar-next"/>
       
    81     </xsl:when>
       
    82     <xsl:otherwise>
       
    83       <xsl:apply-templates 
       
    84         select="../following-sibling::*[1]"
       
    85           mode="navbar-next"/>
       
    86     </xsl:otherwise>
       
    87   </xsl:choose>
       
    88   <xsl:variable name="section-ref">
       
    89     <xsl:call-template name="parent-id"/>
       
    90   </xsl:variable>
    53   </xsl:variable>
    91   <a href="{$section-ref}.html">Retour à la section</a><br/>
    54   <ul class="navbar">
       
    55     <xsl:for-each select="//xref[@linkend=$my-id]">
       
    56       <li>
       
    57 	<xsl:variable name="mysection" select="ancestor::section[last()]/@id"/>
       
    58 	<xsl:for-each select="ancestor::section">
       
    59 	  <xsl:apply-templates select="." mode="xref"/>
       
    60 	  <xsl:if test="descendant::section">
       
    61 	    <xsl:text> : </xsl:text>
       
    62 	  </xsl:if>
       
    63 	</xsl:for-each>
       
    64 	<ul>
       
    65 	  <xsl:if test="preceding::xref[1]/ancestor::section[last()]/@id=$mysection">
       
    66 	    <li><xsl:text>Précédent: </xsl:text>
       
    67 	    <xsl:apply-templates select="preceding::xref[1]"/>
       
    68 	    </li>
       
    69 	  </xsl:if>
       
    70 	  <xsl:if test="following::xref[1]/ancestor::section[last()]/@id=$mysection">
       
    71 	    <li><xsl:text>Suivant: </xsl:text>
       
    72 	    <xsl:apply-templates select="following::xref[1]"/>
       
    73 	    </li>
       
    74 	  </xsl:if>
       
    75 	</ul>
       
    76       </li>
       
    77     </xsl:for-each>
       
    78   </ul>
    92 </xsl:template>
    79 </xsl:template>
    93 
    80 
    94 <!-- poetry section -->
    81 <!-- poetry section -->
    95 <xsl:template match="poetry/poem">
    82 <xsl:template match="poetry/poem">
    96   <xsl:variable name="href">
    83   <xsl:variable name="href">