|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: position() of the parent
> 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()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
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
|
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
|

Cart








