html.xsl
branchstyles
changeset 3 6e7e05c2ded6
parent 0 08de8d15f932
child 5 20b41b986ac6
equal deleted inserted replaced
2:f8261635ebe0 3:6e7e05c2ded6
    57       <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
    57       <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
    58     </head>
    58     </head>
    59     <body class="book">
    59     <body class="book">
    60       <xsl:apply-templates select="docinfo/date"/>
    60       <xsl:apply-templates select="docinfo/date"/>
    61       <xsl:apply-templates/>
    61       <xsl:apply-templates/>
    62       <xsl:apply-templates mode="book-toc"/>
    62       <ul>
       
    63 	<xsl:apply-templates mode="book-toc" select="section|story|poetry"/>
       
    64       </ul>
    63       <hr/>
    65       <hr/>
    64       <address>
    66       <address>
    65         <xsl:apply-templates select="docinfo/copyright"/>
    67         <xsl:apply-templates select="docinfo/copyright"/>
    66 	<p>Aussi disponible au format <a href="{$pdf-filename}">PDF</a>.</p>
    68 	<p>Aussi disponible au format <a href="{$pdf-filename}">PDF</a>.</p>
    67       </address>
    69       </address>
    68     </body>
    70     </body>
    69   </html>
    71   </html>
    70 </xsl:template>
    72 </xsl:template>
    71 
    73 
    72 <xsl:template match="book/section" mode="book-toc">
    74 <xsl:template match="section" mode="book-toc">
    73   <xsl:variable name="href">
    75   <xsl:variable name="href">
    74     <xsl:call-template name="get-id"/>
    76     <xsl:call-template name="get-id"/>
    75   </xsl:variable>
    77   </xsl:variable>
    76   <h2>
    78   <li>
    77     <a id="{$href}" href="{$href}.html">
    79     <a id="{$href}" href="{$href}.html">
    78       <xsl:apply-templates select="title" mode="book-toc"/>
    80       <xsl:apply-templates select="title" mode="book-toc"/>
    79     </a>
    81     </a>
    80   </h2>
    82   </li>
    81 </xsl:template>
    83 </xsl:template>
       
    84 <xsl:template match="title" mode="book-toc">
       
    85   <xsl:apply-templates/>
       
    86 </xsl:template>
       
    87 
    82 
    88 
    83 <!-- title default processing -->
    89 <!-- title default processing -->
    84 <xsl:template match="title">
    90 <xsl:template match="title">
    85   <h1><xsl:apply-templates/></h1>
    91   <h1><xsl:apply-templates/></h1>
    86 </xsl:template>
    92 </xsl:template>
   330     <xsl:call-template name="get-id"/>
   336     <xsl:call-template name="get-id"/>
   331   </xsl:variable>
   337   </xsl:variable>
   332   <a href="index.html#{$section-ref}">Retour à la table des matières</a><br/>
   338   <a href="index.html#{$section-ref}">Retour à la table des matières</a><br/>
   333 </xsl:template>
   339 </xsl:template>
   334 
   340 
   335 <!-- The book-toc section -->
   341 <!-- section files -->
   336 <xsl:template match="book/section">
   342 <xsl:template match="section">
   337   <xsl:variable name="href">
   343   <xsl:variable name="href">
   338     <xsl:call-template name="get-id"/>
   344     <xsl:call-template name="get-id"/>
   339   </xsl:variable>
   345   </xsl:variable>  
   340   <xt:document href="{$href}.html" method="xml" encoding="utf-8"
   346   <xt:document href="{$href}.html" method="xml" encoding="utf-8"
   341         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
   347         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
   342         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
   348         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
   343         indent="yes">
   349         indent="yes">
   344     <html>
   350     <html>
   346         <xsl:apply-templates select="title" mode="heading"/>
   352         <xsl:apply-templates select="title" mode="heading"/>
   347         <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
   353         <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
   348       </head>
   354       </head>
   349       <body>
   355       <body>
   350         <h1><xsl:value-of select="title"/></h1>
   356         <h1><xsl:value-of select="title"/></h1>
   351         <xsl:apply-templates select="child::*[name(.) != 'story' or name(.)!= 'poetry']"/>
   357 
   352         <ul>
   358         <xsl:apply-templates/>
   353           <xsl:apply-templates mode="section-toc"/>
   359 
   354         </ul>
   360 	<xsl:if test="child::*[name(.)='story' or name(.)='poetry' or name(.)='section']">
       
   361 	  <ul>
       
   362 	    <xsl:apply-templates mode="book-toc" select="child::*[name(.)='story' or name(.)='poetry' or name(.)='section']"/>
       
   363 	  </ul>
       
   364 	</xsl:if>
   355         <hr/>
   365         <hr/>
   356         <address>
   366         <address>
   357           <xsl:apply-templates select="../copyright"/>
   367           <xsl:apply-templates select="../copyright"/>
   358         </address>
   368         </address>
   359         <xsl:apply-templates mode="navbar-section" select="."/>
   369         <xsl:apply-templates mode="navbar-section" select="."/>
   360       </body>
   370       </body>
   361     </html>
   371     </html>
   362   </xt:document>
   372   </xt:document>
   363   <xsl:apply-templates select="story|poetry"/>
       
   364 </xsl:template>
       
   365 
       
   366 <xsl:template match="section/title" mode="book-toc">
       
   367   <xsl:apply-templates/>
       
   368 </xsl:template>
   373 </xsl:template>
   369 
   374 
   370 <!-- anything else is clear -->
   375 <!-- anything else is clear -->
   371 <xsl:template match="*" mode="book-toc"/>
   376 <xsl:template match="*" mode="book-toc"/>
   372 <xsl:template match="*" mode="section-toc"/>
   377 <xsl:template match="*" mode="section-toc"/>
   426     </xsl:attribute>
   431     </xsl:attribute>
   427     <xsl:apply-templates/>
   432     <xsl:apply-templates/>
   428   </a>
   433   </a>
   429 </xsl:template>
   434 </xsl:template>
   430 
   435 
       
   436 <xsl:template match="xref">
       
   437   <xsl:variable name="linkend" select="@linkend"/>
       
   438   <xsl:apply-templates select="//*[@id=$linkend]" mode="xref"/>
       
   439 </xsl:template>
       
   440 
       
   441 <xsl:template match="section" mode="xref">
       
   442   <xsl:variable name="href">
       
   443     <xsl:call-template name="get-id"/>
       
   444   </xsl:variable>
       
   445   <a href="{$href}.html"><xsl:value-of select="title"/></a>
       
   446 </xsl:template>
       
   447 
       
   448 <xsl:template match="book" mode="xref">
       
   449   <xsl:variable name="href">
       
   450     <xsl:call-template name="get-id"/>
       
   451   </xsl:variable>
       
   452   <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
       
   453 </xsl:template>
       
   454 
       
   455 <xsl:template match="*" mode="xref"/>
       
   456 
   431 <xsl:template match="section/title"/>
   457 <xsl:template match="section/title"/>
   432 <xsl:template match="section/subtitle"/>
   458 <xsl:template match="section/subtitle"/>
   433 
   459 
   434 
       
   435 </xsl:stylesheet>
   460 </xsl:stylesheet>
   436 
   461