poetry_print.xsl
branchstyles
changeset 20 78ac9176f4ef
parent 15 27a2a404231e
child 21 ce4faf661fca
equal deleted inserted replaced
19:42559b9800a7 20:78ac9176f4ef
    12 <xsl:output method="xml" indent="yes"/>
    12 <xsl:output method="xml" indent="yes"/>
    13 
    13 
    14 <xsl:attribute-set name="standard-block">
    14 <xsl:attribute-set name="standard-block">
    15   <xsl:attribute name="text-indent">10mm</xsl:attribute>
    15   <xsl:attribute name="text-indent">10mm</xsl:attribute>
    16   <xsl:attribute name="space-before">10pt</xsl:attribute>
    16   <xsl:attribute name="space-before">10pt</xsl:attribute>
    17   <xsl:attribute name="space-before.conditionnaly">discard</xsl:attribute>
    17   <xsl:attribute name="space-before.conditionality">discard</xsl:attribute>
    18   <xsl:attribute name="text-align">justify</xsl:attribute>
    18   <xsl:attribute name="text-align">justify</xsl:attribute>
    19 </xsl:attribute-set>
    19 </xsl:attribute-set>
    20 
    20 
    21 <xsl:template name="static-content">
    21 <xsl:template name="static-content">
    22   <xsl:param name="title"/>
    22   <xsl:param name="title"/>
    97     </xsl:call-template>
    97     </xsl:call-template>
    98     <xsl:variable name="id">
    98     <xsl:variable name="id">
    99       <xsl:call-template name="get-id"/>
    99       <xsl:call-template name="get-id"/>
   100     </xsl:variable>
   100     </xsl:variable>
   101     <flow flow-name="xsl-region-body">
   101     <flow flow-name="xsl-region-body">
   102       <block id="{$id}"/>
   102       <block>
   103       <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
   103 	    <xsl:if test="name(.) != 'poetry'">
   104       <xsl:if test="section[poetry]">
   104 	      <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
   105 	<list-block text-indent="15mm" space-before="15pt">
   105 	    </xsl:if>
   106 	  <xsl:apply-templates select="section[poetry]" mode="toc"/>
   106 	    <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
   107 	</list-block>
   107 	    <xsl:if test="section[poetry]">
   108       </xsl:if>
   108 	      <list-block text-indent="15mm" space-before="15pt">
       
   109 	        <xsl:apply-templates select="section[poetry]" mode="toc"/>
       
   110 	      </list-block>
       
   111         </xsl:if>
       
   112       </block>
   109     </flow>    
   113     </flow>    
   110   </page-sequence>
   114   </page-sequence>
   111   <xsl:apply-templates select="poetry|section[poetry]"/> 
   115   <xsl:apply-templates select="poetry|section[poetry]"/> 
   112 </xsl:template>
   116 </xsl:template>
   113 
   117 
   114 <xsl:template match="section|poetry" mode="toc">
   118 <xsl:template match="section|poetry" mode="toc">
   115   <list-item>
   119   <list-item>
   116     <xsl:call-template name="list-label"/>
   120     <xsl:call-template name="list-label"/>
   117     <list-item-body start-indent="body-start()">
   121     <list-item-body start-indent="body-start()">
   118       <xsl:apply-templates select="." mode="xref"/>
   122       <block>
   119       <!-- xsl:if test="poetry|section">
   123 	    <xsl:apply-templates select="." mode="toc-xref"/>
   120 	<list-block 
   124       </block>
   121 	    text-indent="body-start()"
       
   122 	    space-before="15pt">
       
   123 	  <xsl:apply-templates select="poetry|section" mode="toc"/>
       
   124 	</list-block>
       
   125       </xsl:if -->
       
   126     </list-item-body>
   125     </list-item-body>
   127   </list-item>
   126   </list-item>
   128 </xsl:template>
   127 </xsl:template>
   129 
   128 
   130 <xsl:template match="section">
   129 <xsl:template match="section">
   131   <xsl:variable name="id">
   130   <xsl:apply-templates/>
   132     <xsl:call-template name="get-id"/>
       
   133   </xsl:variable>
       
   134   <block id="{$id}">
       
   135     <xsl:apply-templates/>
       
   136   </block>
       
   137 </xsl:template>
   131 </xsl:template>
   138 
   132 
   139 <xsl:template match="preambule">
   133 <xsl:template match="preambule">
   140   <xsl:variable name="id">
   134   <xsl:variable name="id">
   141     <xsl:call-template name="get-id"/>
   135     <xsl:call-template name="get-id"/>
   169 </xsl:template>
   163 </xsl:template>
   170 
   164 
   171 <xsl:template match="nda">
   165 <xsl:template match="nda">
   172   <block border="solid" padding="5mm"
   166   <block border="solid" padding="5mm"
   173     font-size="90%" font-style="italic"
   167     font-size="90%" font-style="italic"
   174     space-before="15mm" space-before.conditionnaly="discard"
   168     space-before="15mm" space-before.conditionality="discard"
   175     space-after="15mm" space-after.conditionnaly="discard"
   169     space-after="15mm" space-after.conditionality="discard"
   176     margin="5mm">
   170     margin="5mm">
   177     <xsl:apply-templates/>
   171     <xsl:apply-templates/>
   178   </block>
   172   </block>
   179 </xsl:template>
   173 </xsl:template>
   180 
   174 
   237 </xsl:template>
   231 </xsl:template>
   238 <xsl:template match="cue/para">
   232 <xsl:template match="cue/para">
   239   <xsl:apply-templates/>
   233   <xsl:apply-templates/>
   240 </xsl:template>
   234 </xsl:template>
   241 
   235 
   242 <xsl:template match="poetry|section" mode="xref">
   236 <xsl:template match="poetry|section" mode="toc-xref">
   243   <xsl:variable name="id">
   237   <xsl:variable name="id">
   244     <xsl:call-template name="get-id"/>
   238     <xsl:call-template name="get-id"/>
   245   </xsl:variable>
   239   </xsl:variable>
   246   <basic-link internal-destination="{$id}">
   240     <basic-link internal-destination="{$id}">
   247     <xsl:value-of select="descendant::title[1]"/>
   241       <xsl:value-of select="descendant::title[1]"/>
   248     <leader leader-pattern="dots" leader-length.maximum="254mm"/>
   242       <leader leader-pattern="dots" leader-length.maximum="254mm"/>
   249     (<page-number-citation ref-id="{$id}"/>)
   243       (<page-number-citation ref-id="{$id}"/>)
   250   </basic-link>
   244     </basic-link>
       
   245 </xsl:template>
       
   246 
       
   247 <xsl:template match="list[@role='toc']/item/xref">
       
   248   <xsl:variable name="linkend" select="@linkend"/>
       
   249   <xsl:apply-templates mode="toc-xref" select="//*[@id=$linkend]"/>
   251 </xsl:template>
   250 </xsl:template>
   252 
   251 
   253 <xsl:template match="xref">
   252 <xsl:template match="xref">
   254   <xsl:variable name="linkend" select="@linkend"/>
   253   <xsl:variable name="linkend" select="@linkend"/>
   255   <xsl:apply-templates mode="xref" select="//*[@id=$linkend]"/>
   254   <xsl:variable name="linkterm">
       
   255     <xsl:choose>
       
   256       <xsl:when test="@linkterm"><xsl:value-of select="@linkterm"/></xsl:when>
       
   257       <xsl:otherwise><xsl:value-of select="@linkend"/></xsl:otherwise>
       
   258     </xsl:choose>
       
   259   </xsl:variable>
       
   260     <basic-link internal-destination="{$linkend}">
       
   261       <xsl:apply-templates mode="xref" select="//*[@id=$linkterm]"/>
       
   262     </basic-link>
       
   263 </xsl:template>
       
   264     
       
   265 <xsl:template match="poetry|section" mode="xref">
       
   266   <xsl:value-of select="descendant::title[1]"/>
   256 </xsl:template>
   267 </xsl:template>
   257 
   268 
   258 </xsl:stylesheet>
   269 </xsl:stylesheet>
   259 
   270