poetry_print.xsl
branchstyles
changeset 15 27a2a404231e
parent 11 e2d28bf2a3bb
child 21 ce4faf661fca
equal deleted inserted replaced
11:e2d28bf2a3bb 15:27a2a404231e
    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>
   102       <block>
   103 	<xsl:if test="name(.) != 'poetry'">
   103 	    <xsl:if test="name(.) != 'poetry'">
   104 	  <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
   104 	      <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
   105 	</xsl:if>
   105 	    </xsl:if>
   106 	<xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
   106 	    <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
   107 	<xsl:if test="section[poetry]">
   107 	    <xsl:if test="section[poetry]">
   108 	<list-block text-indent="15mm" space-before="15pt">
   108 	      <list-block text-indent="15mm" space-before="15pt">
   109 	  <xsl:apply-templates select="section[poetry]" mode="toc"/>
   109 	        <xsl:apply-templates select="section[poetry]" mode="toc"/>
   110 	</list-block>
   110 	      </list-block>
   111       </xsl:if>
   111         </xsl:if>
   112       </block>
   112       </block>
   113     </flow>    
   113     </flow>    
   114   </page-sequence>
   114   </page-sequence>
   115   <xsl:apply-templates select="poetry|section[poetry]"/> 
   115   <xsl:apply-templates select="poetry|section[poetry]"/> 
   116 </xsl:template>
   116 </xsl:template>
   118 <xsl:template match="section|poetry" mode="toc">
   118 <xsl:template match="section|poetry" mode="toc">
   119   <list-item>
   119   <list-item>
   120     <xsl:call-template name="list-label"/>
   120     <xsl:call-template name="list-label"/>
   121     <list-item-body start-indent="body-start()">
   121     <list-item-body start-indent="body-start()">
   122       <block>
   122       <block>
   123 	<xsl:apply-templates select="." mode="xref"/>
   123 	    <xsl:apply-templates select="." mode="toc-xref"/>
   124       </block>
   124       </block>
   125     </list-item-body>
   125     </list-item-body>
   126   </list-item>
   126   </list-item>
   127 </xsl:template>
   127 </xsl:template>
   128 
   128 
   231 </xsl:template>
   231 </xsl:template>
   232 <xsl:template match="cue/para">
   232 <xsl:template match="cue/para">
   233   <xsl:apply-templates/>
   233   <xsl:apply-templates/>
   234 </xsl:template>
   234 </xsl:template>
   235 
   235 
   236 <xsl:template match="poetry|section" mode="xref">
   236 <xsl:template match="poetry|section" mode="toc-xref">
   237   <xsl:variable name="id">
   237   <xsl:variable name="id">
   238     <xsl:call-template name="get-id"/>
   238     <xsl:call-template name="get-id"/>
   239   </xsl:variable>
   239   </xsl:variable>
   240     <basic-link internal-destination="{$id}">
   240     <basic-link internal-destination="{$id}">
   241       <xsl:value-of select="descendant::title[1]"/>
   241       <xsl:value-of select="descendant::title[1]"/>
   242       <leader leader-pattern="dots" leader-length.maximum="254mm"/>
   242       <leader leader-pattern="dots" leader-length.maximum="254mm"/>
   243       (<page-number-citation ref-id="{$id}"/>)
   243       (<page-number-citation ref-id="{$id}"/>)
   244     </basic-link>
   244     </basic-link>
   245 </xsl:template>
   245 </xsl:template>
   246 
   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]"/>
       
   250 </xsl:template>
       
   251 
   247 <xsl:template match="xref">
   252 <xsl:template match="xref">
   248   <xsl:variable name="linkend" select="@linkend"/>
   253   <xsl:variable name="linkend" select="@linkend"/>
   249   <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]"/>
   250 </xsl:template>
   267 </xsl:template>
   251 
   268 
   252 </xsl:stylesheet>
   269 </xsl:stylesheet>
   253 
   270