[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: knowing the position of certain node

Subject: RE: knowing the position of certain node
From: "Jaime A Stuardo Bahamondes" <jstuardo@xxxxxxxxxxx>
Date: Tue, 6 Jan 2004 10:35:54 -0400
george bahamondes
Thanks George and David for your answer... it worked :-)

-----Mensaje original-----
De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]En nombre de George
Cristian Bina
Enviado el: Martes, 06 de Enero de 2004 9:21
Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Asunto: Re:  knowing the position of certain node


You can just count the element on the preceding-sibling axis and add 1 to
that, for instance:
<xsl:value-of select="1 + count(row[field2='yes']/preceding-sibling::*)"/>

Best Regards,
 George
-------------------------------------------------------------
George Cristian Bina mailto:george@xxxxxxxxxxxxx
<oXygen/> XML Editor - http://www.oxygenxml.com/

----- Original Message -----
From: "Jaime A Stuardo Bahamondes" <jstuardo@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, January 06, 2004 3:50 PM
Subject:  knowing the position of certain node


> Hi all..
>
> I have this sample XML:
>
> <test>
>   <row>
>     <field1>this</field1>
>   </row>
>   <row>
>     <field1>is</field1>
>   </row>
>   <row>
>     <field1>a</field1>
>     <field2>yes</field2>
>   </row>
>   <row>
>     <field1>test</field1>
>   </row>
> </test>
>
>
> If I use <xsl:value-of select="row[field2 = 'yes']" /> I get all the third
"row" field values. How can I know the position of the found node? for
example, in that case, I want 3 to be printed on screen, something like
"position(row[field2 = 'yes'])"
>
> Thanks
> Jaime
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.