Using level="any" for Numbering
This topic uses the level
attribute with the value "any"
. The following template rule is based on the initial cardgame example, in Inserting Automatic Numbering Using position().
<xsl:template match="tell">
<tr>
<td colspan="3" align="center" class="tell">
(Reaction #<xsl:number level="any"
count="tell"/>:
<xsl:value-of select="../@name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="."/>)
</td>
</tr>
</xsl:template>
The value "any"
instructs the XSLT processor to number the indicated element sequentially, no matter what level it is at in the document hierarchy. Jack's reactions during the first hand are still numbered 1 and 2, while Jill's first reaction is now #3 in the game as a whole. The results are shown in Example of Automatic Numbering with <xsl:number>.