Re: [xsl] Re: Finding the position of an element wrt to other element

Subject: Re: [xsl] Re: Finding the position of an element wrt to other element
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 21 Nov 2010 02:48:17 -0500
On Sun, Nov 21, 2010 at 1:32 AM, Rashi Bhardwaj
<rashi.bhardwaj@xxxxxxxxx> wrote:
> with 342, it means the position of that b element which have child c
> and relative to first b element (whether it has child c or not); as
> specified my xpath
>
> ="//b[c][not(@name=preceding::b[child::c]/@name)]/@name
>
> With the above xpath in my sample xml three b element will be select,
> namely, b[@name='3'], b[@name='4'] and b[@name='2'], now the position
> of these above selected b elements relative to first 'b' element
> (b[@name='1']) will be 3 and 4 for the b's which are child of first
> <a> and 2 for the b in second <a>.

Instead of:

    <xsl:value-of select="position()"/>

try something like:

    <xsl:number level="single" format="1"/>

-Brandon :)

Current Thread