all groups > dotnet xml > june 2003 >
You're in the

dotnet xml

group:

Xsl position()


Xsl position() Hugo Wetterberg
6/30/2003 2:39:25 PM
dotnet xml:
Hi I hava a xsl question.
How do I get the position of the parent a in the in the template for
b?

Example:

<root>
<a>
<b></b>
</a>
<a>
<b></b>
</a>
</root>

<xsl:template match="/root">
<xsl:apply-templates select="a"/>
</xsl:template>

<xsl:template match="a">
<xsl:apply-templates select="b"/>
</xsl:template>

<xsl:template match="b">
<xsl:value-of select="../position()"/>
Re: Xsl position() Oleg Tkachenko
6/30/2003 6:44:47 PM
[quoted text, click to view]

<xsl:value-of select="count(../preceding-sibling::*)+1"/>

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
AddThis Social Bookmark Button