match="indexterm"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+<xsl:key name="endofrange"
+ match="indexterm[@class='endofrange']"
+ use="@startref"/>
+
<xsl:key name="see-also"
match="indexterm[seealso]"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso)"/>
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see)"/>
<xsl:template name="generate-index">
- <!-- FIXME: Ignore class='endofrange' terms because they come out wrong -->
<xsl:variable name="terms"
select="//indexterm[count(.|key('letter',
translate(substring(&primary;, 1, 1),
</xsl:template>
<xsl:template match="indexterm" mode="reference">
+ <xsl:param name="separator" select="', '"/>
+
<xsl:if test="$passivetex.extensions = '0'">
- <xsl:text>, </xsl:text>
+ <xsl:value-of select="$separator"/>
</xsl:if>
+
<xsl:choose>
<xsl:when test="@zone and string(@zone)">
<xsl:call-template name="reference">
<xsl:call-template name="object.id"/>
</xsl:variable>
- <xsl:choose>
- <xsl:when test="@startref and @class='endofrange'">
- <fo:basic-link internal-destination="{@startref}">
- <fo:page-number-citation ref-id="{@startref}"/>
- <xsl:text>-</xsl:text>
- <fo:page-number-citation ref-id="{$id}"/>
- </fo:basic-link>
- </xsl:when>
- <xsl:otherwise>
- <fo:basic-link internal-destination="{$id}">
- <fo:page-number-citation ref-id="{$id}"/>
- </fo:basic-link>
- </xsl:otherwise>
- </xsl:choose>
+ <fo:basic-link internal-destination="{$id}">
+ <fo:page-number-citation ref-id="{$id}"/>
+ </fo:basic-link>
+
+ <xsl:if test="key('endofrange', @id)">
+ <xsl:apply-templates select="key('endofrange', @id)[last()]"
+ mode="reference">
+ <xsl:with-param name="separator" select="'-'"/>
+ </xsl:apply-templates>
+ </xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
match="indexterm"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+<xsl:key name="endofrange"
+ match="indexterm[@class='endofrange']"
+ use="@startref"/>
+
<xsl:key name="primary-section"
match="indexterm[not(secondary) and not(see)]"
use="concat(&primary;, &sep;, §ion.id;)"/>
<xsl:key name="sections" match="*[@id]" use="@id"/>
<xsl:template name="generate-index">
- <!-- FIXME: Ignore class='endofrange' terms because they come out wrong -->
<xsl:variable name="terms"
select="//indexterm[count(.|key('letter',
translate(substring(&primary;, 1, 1),
</xsl:template>
<xsl:template match="indexterm" mode="reference">
- <xsl:text>, </xsl:text>
+ <xsl:param name="separator" select="', '"/>
+
+ <xsl:value-of select="$separator"/>
<xsl:choose>
<xsl:when test="@zone and string(@zone)">
<xsl:call-template name="reference">
<xsl:value-of select="$title"/> <!-- text only -->
</a>
+
+ <xsl:if test="key('endofrange', @id)">
+ <xsl:apply-templates select="key('endofrange', @id)[last()]"
+ mode="reference">
+ <xsl:with-param name="separator" select="'-'"/>
+ </xsl:apply-templates>
+ </xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>