story_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   extension-element-prefixes="xt" 
       
     6   xmlns="http://www.w3.org/1999/xhtml">
       
     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 <!-- book processing -->
       
    14 <xsl:param name="stylesheet"><xsl:text>contes.css</xsl:text></xsl:param>
       
    15 <xsl:param name="pdf-filename"><xsl:text>contes.pdf</xsl:text></xsl:param>
       
    16 
       
    17 <xsl:template match="story" mode="section-toc">
       
    18   <xsl:variable name="href">
       
    19     <xsl:call-template name="get-id"/>
       
    20   </xsl:variable>
       
    21   <li>
       
    22     <p><a href="{$href}.html"><xsl:value-of select="docinfo/title"/></a></p>
       
    23     <xsl:if test="nda">
       
    24       <xsl:apply-templates select="nda"/>
       
    25     </xsl:if>
       
    26   </li>
       
    27 </xsl:template>
       
    28 
       
    29 <xsl:template match="story" mode="get-story-link">
       
    30   <xsl:call-template name="get-id"/>
       
    31 </xsl:template>
       
    32 <xsl:template match="story" mode="get-story-name">
       
    33   <xsl:choose>
       
    34     <xsl:when test="docinfo/title">
       
    35       <xsl:value-of select="docinfo/title/text()"/>
       
    36     </xsl:when>
       
    37     <xsl:otherwise>
       
    38       <xsl:value-of select="story/title/text()"/>
       
    39     </xsl:otherwise>
       
    40   </xsl:choose>
       
    41 </xsl:template>
       
    42 
       
    43 <!-- navigation-bar of story and nda -->
       
    44 <xsl:template name="links-story-link">
       
    45   <xsl:param name="prefix"></xsl:param>
       
    46   <link>
       
    47     <xsl:attribute name="href">
       
    48       <xsl:apply-templates select="." mode="get-story-link"/>
       
    49       <xsl:text>.html</xsl:text>
       
    50     </xsl:attribute>
       
    51     <xsl:attribute name="rel">
       
    52       <xsl:value-of select="$prefix"/>
       
    53     </xsl:attribute>
       
    54     <xsl:attribute name="title">
       
    55       <xsl:apply-templates select="." mode="get-story-name"/>
       
    56     </xsl:attribute>
       
    57   </link>
       
    58 </xsl:template>
       
    59 <xsl:template match="story" mode="links-prec">
       
    60   <xsl:call-template name="links-story-link">
       
    61     <xsl:with-param name="prefix">
       
    62       <xsl:text>previous</xsl:text>
       
    63     </xsl:with-param>
       
    64   </xsl:call-template>
       
    65 </xsl:template>
       
    66 <xsl:template match="story" mode="links-next">
       
    67   <xsl:call-template name="links-story-link">
       
    68     <xsl:with-param name="prefix">
       
    69       <xsl:text>next</xsl:text>
       
    70     </xsl:with-param>
       
    71   </xsl:call-template>
       
    72 </xsl:template>
       
    73 <xsl:template match="story" mode="links-story">
       
    74   <xsl:choose>
       
    75     <xsl:when test="preceding-sibling::story[1]">
       
    76       <xsl:apply-templates 
       
    77           select="preceding-sibling::story[1]"
       
    78           mode="links-prec"/>
       
    79     </xsl:when>
       
    80     <xsl:otherwise>
       
    81       <xsl:apply-templates 
       
    82         select="../preceding-sibling::*[1]/story[last()]"
       
    83           mode="links-prec"/>
       
    84     </xsl:otherwise>
       
    85   </xsl:choose>
       
    86   <xsl:choose>
       
    87     <xsl:when test="following-sibling::story[1]">
       
    88       <xsl:apply-templates 
       
    89           select="following-sibling::story[1]"
       
    90           mode="links-next"/>
       
    91     </xsl:when>
       
    92     <xsl:otherwise>
       
    93       <xsl:apply-templates 
       
    94         select="../following-sibling::*[1]/story[1]"
       
    95           mode="links-next"/>
       
    96     </xsl:otherwise>
       
    97   </xsl:choose>
       
    98   <xsl:variable name="section-ref">
       
    99     <xsl:call-template name="parent-id"/>
       
   100   </xsl:variable>
       
   101   <link href="index.html#{$section-ref}"
       
   102      rel="up" title="Table des matières"/>
       
   103 </xsl:template>
       
   104 
       
   105 <!-- navigation-bar of story and nda -->
       
   106 <xsl:template name="navbar-story-link">
       
   107   <xsl:param name="prefix"></xsl:param>
       
   108   <a>
       
   109     <xsl:attribute name="href">
       
   110       <xsl:apply-templates select="." mode="get-story-link"/>
       
   111       <xsl:text>.html</xsl:text>
       
   112     </xsl:attribute>
       
   113     <xsl:value-of select="$prefix"/>
       
   114     <xsl:apply-templates select="." mode="get-story-name"/>
       
   115   </a><br/>
       
   116 </xsl:template>
       
   117 <xsl:template match="story" mode="navbar-prec">
       
   118   <xsl:call-template name="navbar-story-link">
       
   119     <xsl:with-param name="prefix">
       
   120       <xsl:text>Précédent: </xsl:text>
       
   121     </xsl:with-param>
       
   122   </xsl:call-template>
       
   123 </xsl:template>
       
   124 <xsl:template match="story" mode="navbar-next">
       
   125   <xsl:call-template name="navbar-story-link">
       
   126     <xsl:with-param name="prefix">
       
   127       <xsl:text>Suivant: </xsl:text>
       
   128     </xsl:with-param>
       
   129   </xsl:call-template>
       
   130 </xsl:template>
       
   131 <xsl:template match="story" mode="navbar-story">
       
   132   <xsl:choose>
       
   133     <xsl:when test="preceding-sibling::story[1]">
       
   134       <xsl:apply-templates 
       
   135           select="preceding-sibling::story[1]"
       
   136           mode="navbar-prec"/>
       
   137     </xsl:when>
       
   138     <xsl:otherwise>
       
   139       <xsl:apply-templates 
       
   140         select="../preceding-sibling::section[last()]"
       
   141           mode="navbar-prec"/>
       
   142     </xsl:otherwise>
       
   143   </xsl:choose>
       
   144   <xsl:choose>
       
   145     <xsl:when test="following-sibling::story[1]">
       
   146       <xsl:apply-templates 
       
   147           select="following-sibling::story[1]"
       
   148           mode="navbar-next"/>
       
   149     </xsl:when>
       
   150     <xsl:otherwise>
       
   151       <xsl:apply-templates 
       
   152         select="../following-sibling::*[1]"
       
   153           mode="navbar-next"/>
       
   154     </xsl:otherwise>
       
   155   </xsl:choose>
       
   156   <xsl:variable name="section-ref">
       
   157     <xsl:call-template name="parent-id"/>
       
   158   </xsl:variable>
       
   159   <a href="{$section-ref}.html">Retour à la section</a><br/>
       
   160 </xsl:template>
       
   161 
       
   162 <!-- story section -->
       
   163 <xsl:template match="story">
       
   164   <xsl:variable name="href">
       
   165     <xsl:call-template name="get-id"/>
       
   166   </xsl:variable>
       
   167   <xt:document href="{$href}.html" method="xml"
       
   168         encoding="UTF-8"
       
   169         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       
   170         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
       
   171         indent="yes">
       
   172     <html>
       
   173       <head>
       
   174         <link href="{$css-base-dir}contes.css" media="screen"
       
   175           rel="stylesheet" type="text/css"/>
       
   176         <xsl:apply-templates select="../docinfo" mode="heading"/>
       
   177         <xsl:apply-templates select="." mode="links-story"/>
       
   178       </head>
       
   179       <body>
       
   180         <xsl:apply-templates/>
       
   181         <xsl:apply-templates select="../docinfo/date"/>
       
   182         <hr/>
       
   183         <address>
       
   184           <xsl:apply-templates select="../docinfo/copyright"/>
       
   185         </address>
       
   186         <xsl:apply-templates mode="navbar-story" select="."/>
       
   187       </body>
       
   188     </html>
       
   189   </xt:document>
       
   190 </xsl:template>
       
   191 
       
   192 <!-- strophe -->
       
   193 <xsl:template match="strophe">
       
   194   <p><xsl:apply-templates/></p>
       
   195 </xsl:template>
       
   196 
       
   197 <!-- verse -->
       
   198 <xsl:template match="verse">
       
   199   <xsl:apply-templates/><br/>
       
   200 </xsl:template>
       
   201 
       
   202 <!-- cue -->
       
   203 <xsl:template match="cue">
       
   204   <p><xsl:apply-templates/></p>
       
   205 </xsl:template>
       
   206 <xsl:template match="caracter">
       
   207   <strong class="caracter">
       
   208     <xsl:apply-templates/>
       
   209   </strong><xsl:text>: </xsl:text>
       
   210 </xsl:template>
       
   211 <xsl:template match="cue/para">
       
   212   <xsl:apply-templates/>
       
   213 </xsl:template>
       
   214 
       
   215 <xsl:template match="dialog">
       
   216   <blockquote class="dialog">
       
   217     <xsl:apply-templates/>
       
   218   </blockquote>
       
   219 </xsl:template
       
   220 >
       
   221 <xsl:template match="dialog/cite">
       
   222   <p><xsl:text>« - </xsl:text>
       
   223    <xsl:apply-templates/>
       
   224   <xsl:text> »</xsl:text></p>
       
   225 </xsl:template>
       
   226 <xsl:template match="cite/desc">
       
   227   <xsl:text> »</xsl:text>
       
   228    <xsl:apply-templates/>
       
   229   <xsl:text>« </xsl:text>
       
   230 </xsl:template>
       
   231 
       
   232 <xsl:template match="story/section/title">
       
   233   <h2><xsl:apply-templates/></h2>
       
   234 </xsl:template>
       
   235 <xsl:template match="story/section/section/title">
       
   236   <h3><xsl:apply-templates/></h3>
       
   237 </xsl:template>
       
   238  
       
   239 <xsl:template match="story/nda">
       
   240   <div class="nda">
       
   241     <xsl:apply-templates/>
       
   242   </div>
       
   243 </xsl:template>
       
   244 
       
   245 </xsl:stylesheet>
       
   246