|
Subject: RE: position() of the parent From: Mike Brown <mbrown@xxxxxxxxxxxxx> Date: Wed, 19 Jan 2000 18:10:29 -0700 |
> 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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: position() of the parent, David Carlisle | Thread | RE: position() of the parent, Pawson, David |
| Conformance of IE5?, Judi Thomson | Date | Re: Conformance of IE5?, Chuck White |
| Month |