[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|