我用的是XPath1.0
XML:
<A a="2" b="2" c="2" d="2" e="2"/>
Q: 属性前有多少个属性
d
A: 有3个属性(
a
,
b
c
)before属性
d
如果
一
~
e
<xsl:template match="/">
<xsl:value-of select="count(../A/*[text()='d']/preceding-sibling::*) + 1"/>
</xsl:template>
但是现在
一
~
e
<xsl:template match="/">
和
</xsl:template>