<!ENTITY tertiary 'normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))'>
<!ENTITY sep '" "'>
-<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
+<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())
+ and ($role = @role or string-length($role) = 0)'>
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
<xsl:template name="generate-index">
<xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+ <xsl:variable name="role">
+ <xsl:if test="$index.on.role != 0">
+ <xsl:value-of select="@role"/>
+ </xsl:if>
+ </xsl:variable>
+
<xsl:variable name="terms"
select="//indexterm[count(.|key('group-code',
i:group-index(&primary;))[&scope;][1]) = 1
<xsl:apply-templates select="$terms" mode="index-div">
<xsl:with-param name="scope" select="$scope"/>
+ <xsl:with-param name="role" select="$role"/>
<xsl:sort select="i:group-index(&primary;)" data-type="number"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="indexterm" mode="index-div">
<xsl:param name="scope" select="."/>
+ <xsl:param name="role" select="''"/>
<xsl:variable name="key"
select="i:group-index(&primary;)"/>
mode="index-primary">
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
<xsl:with-param name="scope" select="$scope"/>
+ <xsl:with-param name="role" select="$role"/>
</xsl:apply-templates>
</fo:block>
</fo:block>
<!ENTITY tertiary 'normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))'>
<!ENTITY sep '" "'>
-<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
+<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())
+ and ($role = @role or string-length($role) = 0)'>
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
<xsl:template name="generate-index">
<xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+ <xsl:variable name="role">
+ <xsl:if test="$index.on.role != 0">
+ <xsl:value-of select="@role"/>
+ </xsl:if>
+ </xsl:variable>
+
<xsl:variable name="terms"
select="//indexterm[count(.|key('group-code',
i:group-index(&primary;))[&scope;][1]) = 1
<div class="index">
<xsl:apply-templates select="$terms" mode="index-div">
<xsl:with-param name="scope" select="$scope"/>
+ <xsl:with-param name="role" select="$role"/>
<xsl:sort select="i:group-index(&primary;)" data-type="number"/>
</xsl:apply-templates>
</div>
<xsl:template match="indexterm" mode="index-div">
<xsl:param name="scope" select="."/>
+ <xsl:param name="role" select="''"/>
<xsl:variable name="key"
select="i:group-index(&primary;)"/>
mode="index-primary">
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
<xsl:with-param name="scope" select="$scope"/>
+ <xsl:with-param name="role" select="$role"/>
</xsl:apply-templates>
</dl>
</div>