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

Re: POSITION()

Subject: Re: POSITION()
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 5 Mar 2002 12:22:44 +0000
Re:  POSITION()
Hi Kim,

> i have two for-each loops.. as following
>
> <xsl:for-each select = "//root/parent">
>   <xsl:variable name = "parentvar1" select = "/parent1"/>
>   <xsl:variable name = "parentvar2" select = "/parent2"/>
>   <xsl:variable name = "parentvar3" select = "/parent3"/>
>   <xsl:variable name = "parentvar4" select = "/parent4"/>
>   <xsl:for-each select = "./children">
>     <xsl:variable name = "childvar1" select = "/parent1"/>
>     <xsl:variable name = "childvar2" select = "/parent2"/>
>     <xsl:variable name = "childvar3" select = "/parent3"/>
>     <xsl:variable name = "childvar4" select = "/parent4"/>
>   </xsl:for-each>
> </xsl:for-each>
>
> the problem is that when i use position() in the second for-each
> loop, it allways gives the position of the first for-each.. is there
> a way that i get to the position of the second for-each loop??

The position() function always gives you the position of the context
node within the list of nodes that you're processing. So the
position() function within the outer xsl:for-each should give you the
position of the parent elements amongst the other parent elements that
you're selecting, while the position() function within the inner
xsl:for-each should give you the position of the child elements
amongst the other child elements (that are children of the same parent
element).

I don't know whether that explanation is sufficient for you to work
out what's going wrong with what you're doing; unfortunately I can't
tell what you're trying to do from your description. If you sent more
details, including the actual code you're using, a sample source and
the result that you're trying to get out of it, that would help us
help you a great deal.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread
  • POSITION()
    • Kim Durand - Tue, 5 Mar 2002 05:21:25 -0500 (EST)
      • Matt Gushee - Tue, 5 Mar 2002 06:21:00 -0500 (EST)
      • Jeni Tennison - Tue, 5 Mar 2002 07:19:05 -0500 (EST) <=

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.