position()
last()
- position
- The position of the current node in the set of nodes being processed. For
xsl:for-each or xsl:apply-templates, the order of the set of nodes after any xsl:sort elements
have been applied
- last
- Returns a number that defines the number of nodes being processed.
For xsl:for-each or xsl:apply-templates,
it is the number of nodes in the node-set being processed
<items><item>8</item><item>3</item><item>7</item><item>12</item></items>
<xsl:template match="items/item">
<position><xsl:value-of select="position()"/></position>
<result><xsl:value-of select="."/></result>
<last><xsl:value-of select="last()"/></last>
</xsl:template>
<position>1</position><result>8</result><last>4</last>
<position>2</position><result>3</result><last>4</last>
<position>3</position><result>7</result><last>4</last>
<position>4</position><result>12</result><last>4</last>