xsl-list
[Top] [All Lists]

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

2010-11-21 01:48:31
On Sun, Nov 21, 2010 at 1:32 AM, Rashi Bhardwaj
<rashi(_dot_)bhardwaj(_at_)gmail(_dot_)com> 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[(_at_)name='3'], b[(_at_)name='4'] and b[(_at_)name='2'], now the 
position
of these above selected b elements relative to first 'b' element
(b[(_at_)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 :)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>