poetry_html.xsl
branchstyles
changeset 0 08de8d15f932
child 3 6e7e05c2ded6
equal deleted inserted replaced
-1:000000000000 0:08de8d15f932
       
     1 <?xml version="1.0"?>
       
     2 <xsl:stylesheet version="1.1"
       
     3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
     4   xmlns:xt="http://www.jclark.com/xt"
       
     5   xmlns="http://www.w3.org/1999/xhtml"
       
     6   extension-element-prefixes="xt">
       
     7   <xsl:import href="html.xsl"/>
       
     8   <xsl:output method="xml"
       
     9 	encoding="utf-8"
       
    10         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       
    11         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
       
    12         indent="yes"/>
       
    13 
       
    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>
       
    16 
       
    17 <xsl:template match="poetry" mode="section-toc">
       
    18   <xsl:variable name="href">
       
    19     <xsl:call-template name="get-id"/>
       
    20   </xsl:variable>
       
    21   <li>
       
    22     <a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a>
       
    23       <xsl:if test="nda">
       
    24         [<a href="{$href}_nda.html">NdA</a>]
       
    25       </xsl:if>
       
    26   </li>
       
    27 </xsl:template>
       
    28 
       
    29 <xsl:template match="section" mode="book-toc">
       
    30   <xsl:variable name="href">
       
    31     <xsl:call-template name="get-id"/>
       
    32   </xsl:variable>
       
    33   <li>
       
    34     <a href="{$href}.html"><xsl:value-of select="title"/></a>
       
    35   </li>
       
    36 </xsl:template>
       
    37 
       
    38 <xsl:template match="poetry" mode="navbar-name">
       
    39   <xsl:choose>
       
    40     <xsl:when test="docinfo/title">
       
    41       <xsl:value-of select="docinfo/title/text()"/>
       
    42     </xsl:when>
       
    43     <xsl:otherwise>
       
    44       <xsl:value-of select="poem/title/text()"/>
       
    45     </xsl:otherwise>
       
    46   </xsl:choose>
       
    47 </xsl:template>
       
    48 
       
    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">
       
    64   <xsl:choose>
       
    65     <xsl:when test="preceding-sibling::poetry[1]">
       
    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>
       
    91   <a href="{$section-ref}.html">Retour à la section</a><br/>
       
    92 </xsl:template>
       
    93 
       
    94 <!-- poetry section -->
       
    95 <xsl:template match="poetry/poem">
       
    96   <xsl:variable name="href">
       
    97     <xsl:call-template name="parent-id"/>
       
    98   </xsl:variable>
       
    99   <xt:document href="{$href}.html" method="xml" encoding="utf-8"
       
   100         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       
   101         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
       
   102         indent="yes">
       
   103     <html>
       
   104       <head>
       
   105         <xsl:apply-templates select="../docinfo" mode="heading"/>
       
   106         <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
       
   107       </head>
       
   108       <body>
       
   109         <xsl:apply-templates/>
       
   110         <xsl:apply-templates select="../docinfo/date"/>
       
   111         <hr/>
       
   112         <address>
       
   113           <xsl:apply-templates select="../docinfo/copyright"/>
       
   114         </address>
       
   115         <xsl:if test="../nda">
       
   116           <a href="{$href}_nda.html">Notes de l'auteur.</a><br/>
       
   117         </xsl:if>
       
   118         <xsl:apply-templates mode="navbar-poetry" select=".."/>
       
   119       </body>
       
   120     </html>
       
   121   </xt:document>
       
   122 </xsl:template>
       
   123 
       
   124 <xsl:template match="poetry/nda">
       
   125   <xsl:variable name="href">
       
   126     <xsl:call-template name="parent-id"/>
       
   127   </xsl:variable>
       
   128   <xt:document method="xml" encoding="utf-8" href="{$href}_nda.html"
       
   129         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       
   130         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
       
   131         indent="yes">
       
   132     <html>
       
   133       <head>
       
   134         <xsl:apply-templates select="../docinfo" mode="heading-nda"/>
       
   135       <link href="{$css-base-dir}{$stylesheet}" media="screen" rel="stylesheet" type="text/css"/>
       
   136       </head>
       
   137       <body>
       
   138         <xsl:apply-templates/>
       
   139         <hr/>
       
   140         <address>
       
   141           <xsl:apply-templates select="../docinfo/copyright"/>
       
   142         </address>
       
   143         <a href="{$href}.html">Retour au poème.</a><br/>
       
   144         <xsl:apply-templates mode="navbar-poetry" select=".."/>
       
   145       </body>
       
   146     </html>
       
   147   </xt:document>
       
   148 </xsl:template>
       
   149 
       
   150 <!-- strophe -->
       
   151 <xsl:template match="strophe">
       
   152   <p><xsl:apply-templates/></p>
       
   153 </xsl:template>
       
   154 
       
   155 <!-- verse -->
       
   156 <xsl:template match="verse">
       
   157   <xsl:apply-templates/><br/>
       
   158 </xsl:template>
       
   159 
       
   160 <!-- cue -->
       
   161 <xsl:template match="cue">
       
   162   <p><xsl:apply-templates/></p>
       
   163 </xsl:template>
       
   164 <xsl:template match="caracter">
       
   165   <strong class="caracter">
       
   166     <xsl:apply-templates/>
       
   167   </strong><xsl:text>: </xsl:text>
       
   168 </xsl:template>
       
   169 <xsl:template match="cue/para">
       
   170   <xsl:apply-templates/>
       
   171 </xsl:template>
       
   172 
       
   173 </xsl:stylesheet>
       
   174