<xslTutorial creator="nicmila@idoox.com">
<index keywords='xsl:number @level'/>

<description><stylesheet id='id2'/> demonstrates the default behaviour of xsl:number element. Numbering of individual chapter elements depends on position of the chapter element. Each level of chapters is numbered independently.
Setting the attribute level into multiple in <stylesheet id='id3'/> enables more natural numbering.  
</description>

<xmlSource id="id1">
<chapter>First Chapter</chapter>

<chapter>Second Chapter
<chapter>Subchapter 1</chapter>
<chapter>Subchapter 2</chapter>
</chapter>

<chapter>Third Chapter
<chapter>Subchapter A</chapter>

<chapter>Subchapter B
<chapter>sub a</chapter>
<chapter>sub b</chapter>
</chapter>

<chapter>Subchapter C</chapter>
</chapter>
</xmlSource>

<attValues>
<value match="">
</value>
</attValues>


<xslStylesheet id="id2">
<xsl:template match="/">
<TABLE BORDER="1">
<TR><TH>Number</TH><TH>text</TH></TR>
<xsl:for-each select="//chapter">
<TR><TD>
<xsl:number/>
</TD><TD>
<xsl:value-of select="./text()"/>
</TD></TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xslStylesheet>

<xslStylesheet id="id3">
<xsl:template match="/">
<TABLE BORDER="1">
<TR><TH>Number</TH><TH>text</TH></TR>
<xsl:for-each select="//chapter">
<TR><TD>
<xsl:number level="multiple"/>
</TD><TD>
<xsl:value-of select="./text()"/>
</TD></TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xslStylesheet>

</xslTutorial>