I'm using XPath1.0
XML:
<A a="2" b="2" c="2" d="2" e="2"/>
Q: How many attributes before attribute d
A: There are 3 attributes(a
,b
,c
) before attribute d
If a
~e
are not attributes but elements, I can do this:
<xsl:template match="/">
<xsl:value-of select="count(../A/*[text()='d']/preceding-sibling::*) + 1"/>
</xsl:template>
But now a
~e
are attributes, how can I do the same between <xsl:template match="/">
and </xsl:template>