poetry_print.xsl
branchstyles
changeset 24 acf70691eb31
parent 21 ce4faf661fca
equal deleted inserted replaced
23:8445a48b1679 24:acf70691eb31
    64 	<xsl:with-param name="title">
    64 	<xsl:with-param name="title">
    65 	  <xsl:apply-templates select="descendant::title[1]"/>
    65 	  <xsl:apply-templates select="descendant::title[1]"/>
    66 	</xsl:with-param>
    66 	</xsl:with-param>
    67       </xsl:call-template>
    67       </xsl:call-template>
    68       <xsl:variable name="id">
    68       <xsl:variable name="id">
    69 	<xsl:call-template name="get-id"/>
    69 	    <xsl:call-template name="get-id"/>
    70       </xsl:variable>
    70       </xsl:variable>
    71       <flow flow-name="xsl-region-body">
    71       <flow flow-name="xsl-region-body">
    72 	<block id="{$id}"/>
    72 	    <block id="{$id}"/>
    73 	<xsl:apply-templates select="*[name(.)!='section']"/>
    73 	    <xsl:apply-templates select="*[name(.)!='section']"/>
       
    74         <block space-before="4pt">
       
    75           <inline font-weight="bold">Table des matières</inline>
       
    76           <list-block provisional-distance-between-starts="5mm">
       
    77             <xsl:apply-templates select="section|story|poetry" mode="toc"/>
       
    78           </list-block>
       
    79         </block>
    74       </flow>
    80       </flow>
    75     </page-sequence>
    81     </page-sequence>
    76     <xsl:apply-templates select="section"/> 
    82     <xsl:apply-templates select="section"/> 
    77   </root>
    83   </root>
    78 </xsl:template>
    84 </xsl:template>
    98     <xsl:variable name="id">
   104     <xsl:variable name="id">
    99       <xsl:call-template name="get-id"/>
   105       <xsl:call-template name="get-id"/>
   100     </xsl:variable>
   106     </xsl:variable>
   101     <flow flow-name="xsl-region-body">
   107     <flow flow-name="xsl-region-body">
   102       <block>
   108       <block>
   103 	<xsl:if test="name(.) != 'poetry'">
   109 	    <xsl:if test="name(.) != 'poetry'">
   104 	  <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
   110 	      <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
   105 	</xsl:if>
   111 	    </xsl:if>
   106 	<xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
   112 	    <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
   107 	<xsl:if test="section[poetry]">
   113 	    <xsl:if test="section[poetry]">
   108 	<list-block text-indent="15mm" space-before="15pt">
   114 	      <list-block text-indent="15mm" space-before="15pt">
   109 	  <xsl:apply-templates select="section[poetry]" mode="toc"/>
   115 	        <xsl:apply-templates select="section[poetry]" mode="toc"/>
   110 	</list-block>
   116 	      </list-block>
   111       </xsl:if>
   117         </xsl:if>
   112       </block>
   118       </block>
   113     </flow>    
   119     </flow>    
   114   </page-sequence>
   120   </page-sequence>
   115   <xsl:apply-templates select="poetry|section[poetry]"/> 
   121   <xsl:apply-templates select="poetry|section[poetry]"/> 
   116 </xsl:template>
   122 </xsl:template>
   118 <xsl:template match="section|poetry" mode="toc">
   124 <xsl:template match="section|poetry" mode="toc">
   119   <list-item>
   125   <list-item>
   120     <xsl:call-template name="list-label"/>
   126     <xsl:call-template name="list-label"/>
   121     <list-item-body start-indent="body-start()">
   127     <list-item-body start-indent="body-start()">
   122       <block>
   128       <block>
   123 	<xsl:apply-templates select="." mode="xref"/>
   129 	    <xsl:apply-templates select="." mode="toc-xref"/>
   124       </block>
   130       </block>
   125     </list-item-body>
   131     </list-item-body>
   126   </list-item>
   132   </list-item>
   127 </xsl:template>
   133 </xsl:template>
   128 
   134 
   231 </xsl:template>
   237 </xsl:template>
   232 <xsl:template match="cue/para">
   238 <xsl:template match="cue/para">
   233   <xsl:apply-templates/>
   239   <xsl:apply-templates/>
   234 </xsl:template>
   240 </xsl:template>
   235 
   241 
   236 <xsl:template match="poetry|section" mode="xref">
   242 <xsl:template match="poetry|section" mode="toc-xref">
   237   <xsl:variable name="id">
   243   <xsl:variable name="id">
   238     <xsl:call-template name="get-id"/>
   244     <xsl:call-template name="get-id"/>
   239   </xsl:variable>
   245   </xsl:variable>
   240     <basic-link internal-destination="{$id}">
   246     <basic-link internal-destination="{$id}">
   241       <xsl:value-of select="descendant::title[1]"/>
   247       <xsl:value-of select="descendant::title[1]"/>
   242       <leader leader-pattern="dots" leader-length.maximum="254mm"/>
   248       <leader leader-pattern="dots" leader-length.maximum="254mm"/>
   243       (<page-number-citation ref-id="{$id}"/>)
   249       (<page-number-citation ref-id="{$id}"/>)
   244     </basic-link>
   250     </basic-link>
   245 </xsl:template>
   251 </xsl:template>
   246 
   252 
       
   253 <xsl:template match="list[@role='toc']/item/xref">
       
   254   <xsl:variable name="linkend" select="@linkend"/>
       
   255   <xsl:apply-templates mode="toc-xref" select="//*[@id=$linkend]"/>
       
   256 </xsl:template>
       
   257 
   247 <xsl:template match="xref">
   258 <xsl:template match="xref">
   248   <xsl:variable name="linkend" select="@linkend"/>
   259   <xsl:variable name="linkend" select="@linkend"/>
   249   <xsl:apply-templates mode="xref" select="//*[@id=$linkend]"/>
   260   <xsl:variable name="linkterm">
       
   261     <xsl:choose>
       
   262       <xsl:when test="@linkterm"><xsl:value-of select="@linkterm"/></xsl:when>
       
   263       <xsl:otherwise><xsl:value-of select="@linkend"/></xsl:otherwise>
       
   264     </xsl:choose>
       
   265   </xsl:variable>
       
   266     <basic-link internal-destination="{$linkend}">
       
   267       <xsl:apply-templates mode="xref" select="//*[@id=$linkterm]"/>
       
   268     </basic-link>
       
   269 </xsl:template>
       
   270     
       
   271 <xsl:template match="poetry|section" mode="xref">
       
   272   <xsl:value-of select="descendant::title[1]"/>
   250 </xsl:template>
   273 </xsl:template>
   251 
   274 
   252 </xsl:stylesheet>
   275 </xsl:stylesheet>
   253 
   276