You often use For-each to iterate through a node set in XML, but often you need to add a sequence number
To do this:
<xsl:template match="Book">
<xsl:for-each select="Authors/Author">
<xsl:number value="position()" />
<xsl:value-of select="Name" />
</xsl:for-each>
</xsl:template>
Of course, if you're not satisfied, you want to add "." to the numbers. You can do this:
<xsl:number value= "position ()" format= "1."/>
Even, you can use the picture to express 1\2\3 and so on:
<xsl:element name="img">
<xsl:attribute name="src">images/n<xsl:number value="position()" format="1" />.gif</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
</xsl:element>
Note: You have a file like this in the Images folder: N1.gif,n2.gif,n3.gif ...
Let's say we have XML as follows:
<Book>
<ID>125353-8993-3737</ID>
<ISBN>22222</ISBN>
<Title>共产主义一定能胜利</Title>
<Authors>
<Author>
<Name><![CDATA[Bill&Hoele]]></Name>
<ID>12</ID>
</Author>
<Author>
<Name><![CDATA[Eylor]]></Name>
<ID>1</ID>
</Author>
</Authors>
</Book>