--- a/poetry_print.xsl Mon Sep 14 11:30:58 2015 -0400
+++ b/poetry_print.xsl Mon Sep 14 11:32:00 2015 -0400
@@ -14,7 +14,7 @@
<xsl:attribute-set name="standard-block">
<xsl:attribute name="text-indent">10mm</xsl:attribute>
<xsl:attribute name="space-before">10pt</xsl:attribute>
- <xsl:attribute name="space-before.conditionnaly">discard</xsl:attribute>
+ <xsl:attribute name="space-before.conditionality">discard</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:attribute-set>
@@ -99,13 +99,17 @@
<xsl:call-template name="get-id"/>
</xsl:variable>
<flow flow-name="xsl-region-body">
- <block id="{$id}"/>
- <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
- <xsl:if test="section[poetry]">
- <list-block text-indent="15mm" space-before="15pt">
- <xsl:apply-templates select="section[poetry]" mode="toc"/>
- </list-block>
- </xsl:if>
+ <block>
+ <xsl:if test="name(.) != 'poetry'">
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="*[not(poetry)][name(.)!='poetry']"/>
+ <xsl:if test="section[poetry]">
+ <list-block text-indent="15mm" space-before="15pt">
+ <xsl:apply-templates select="section[poetry]" mode="toc"/>
+ </list-block>
+ </xsl:if>
+ </block>
</flow>
</page-sequence>
<xsl:apply-templates select="poetry|section[poetry]"/>
@@ -115,25 +119,15 @@
<list-item>
<xsl:call-template name="list-label"/>
<list-item-body start-indent="body-start()">
- <xsl:apply-templates select="." mode="xref"/>
- <!-- xsl:if test="poetry|section">
- <list-block
- text-indent="body-start()"
- space-before="15pt">
- <xsl:apply-templates select="poetry|section" mode="toc"/>
- </list-block>
- </xsl:if -->
+ <block>
+ <xsl:apply-templates select="." mode="toc-xref"/>
+ </block>
</list-item-body>
</list-item>
</xsl:template>
<xsl:template match="section">
- <xsl:variable name="id">
- <xsl:call-template name="get-id"/>
- </xsl:variable>
- <block id="{$id}">
- <xsl:apply-templates/>
- </block>
+ <xsl:apply-templates/>
</xsl:template>
<xsl:template match="preambule">
@@ -171,8 +165,8 @@
<xsl:template match="nda">
<block border="solid" padding="5mm"
font-size="90%" font-style="italic"
- space-before="15mm" space-before.conditionnaly="discard"
- space-after="15mm" space-after.conditionnaly="discard"
+ space-before="15mm" space-before.conditionality="discard"
+ space-after="15mm" space-after.conditionality="discard"
margin="5mm">
<xsl:apply-templates/>
</block>
@@ -239,20 +233,37 @@
<xsl:apply-templates/>
</xsl:template>
-<xsl:template match="poetry|section" mode="xref">
+<xsl:template match="poetry|section" mode="toc-xref">
<xsl:variable name="id">
<xsl:call-template name="get-id"/>
</xsl:variable>
- <basic-link internal-destination="{$id}">
- <xsl:value-of select="descendant::title[1]"/>
- <leader leader-pattern="dots" leader-length.maximum="254mm"/>
- (<page-number-citation ref-id="{$id}"/>)
- </basic-link>
+ <basic-link internal-destination="{$id}">
+ <xsl:value-of select="descendant::title[1]"/>
+ <leader leader-pattern="dots" leader-length.maximum="254mm"/>
+ (<page-number-citation ref-id="{$id}"/>)
+ </basic-link>
+</xsl:template>
+
+<xsl:template match="list[@role='toc']/item/xref">
+ <xsl:variable name="linkend" select="@linkend"/>
+ <xsl:apply-templates mode="toc-xref" select="//*[@id=$linkend]"/>
</xsl:template>
<xsl:template match="xref">
<xsl:variable name="linkend" select="@linkend"/>
- <xsl:apply-templates mode="xref" select="//*[@id=$linkend]"/>
+ <xsl:variable name="linkterm">
+ <xsl:choose>
+ <xsl:when test="@linkterm"><xsl:value-of select="@linkterm"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@linkend"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <basic-link internal-destination="{$linkend}">
+ <xsl:apply-templates mode="xref" select="//*[@id=$linkterm]"/>
+ </basic-link>
+</xsl:template>
+
+<xsl:template match="poetry|section" mode="xref">
+ <xsl:value-of select="descendant::title[1]"/>
</xsl:template>
</xsl:stylesheet>