I want to sort my xml data and also number them. Here is for example xml code:
<images>
<image>
<title>cat</title>
<grade>3</grade>
</image>
<image>
<title>dog</title>
<grade>5</grade>
</image>
<image>
<title>snake</title>
<grade>1</grade>
</image>
<image>
<title>fish</title>
<grade>2</grade>
</image>
</images>
and xslt code:
<xsl:template match="images">
<xsl:for-each select="image">
<xsl:sort select="grade"/>
<tr>
<td>
<xsl:number/>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="grade"/>
</td>
</tr>
</xsl:for-each>
</xsl:template>
The result of this is:
3 cat 1
4 fish 2
1 cat 3
2 dog 5
And i would like to have:
1 cat 1
2 fish 2
3 cat 3
4 dog 5
How can I make this in a simple way?