, ( ) ( node).
. , :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="list">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:value-of select="concat(position(),' + ',
count(preceding-sibling::*),' = ',
position() +
count(preceding-sibling::*))"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<list>
<a/>
<b/>
<a/>
<b/>
</list>
:
<list>
<a>1 + 0 = 1</a>
<b>2 + 1 = 3</b>
<a>3 + 2 = 5</a>
<b>4 + 3 = 7</b>
</list>
, match="a":
<list>
<a>1 + 0 = 1</a>
<a>3 + 2 = 5</a>
</list>
, node
, position() ? match="a[position()=2]":
<list>
<a>3 + 2 = 5</a>
</list>
? . XPath position() node . : child::a[position()=2] a .
, position() , position() .
, node ? , apply-templates for-each .
apply-templates select, select="a":
<list>
<a>2 + 2 = 4</a>
</list>
user357812