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

RE: position() of the parent

Subject: RE: position() of the parent
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Wed, 19 Jan 2000 18:10:29 -0700
xsl select number
> Worked great! But just for my curiosity, is there any way to 
> find the position() of the parent?

An interesting challenge. I really should test this before I post it...

<xsl:variable name="parent_position">
  <!-- establish the context: parent and its sibling elements -->
  <xsl:for-each select="../../*">
    <!-- when node being looked at is the parent -->
    <xsl:if test="generate-id() = generate-id(current()/parent::*)">
      <!-- use the context position of that node -->
      <xsl:value-of select="position()"/>

If this works, it will make $parent_position a result tree fragment
containing a text node that has the number you want. If you want it to be an
object of type number, you can later select number($parent_position).

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

Current Thread


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.
First Name
Last Name
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.