RE: [xsl] Traversing to a parent node...

Subject: RE: [xsl] Traversing to a parent node...
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Thu, 16 Oct 2003 18:21:51 -0400
Hey Karl,

Give this a shot:

   ancestor::*[count(current()/ancestor::*)-1]

This selects all ancestors of the given context, then sub-selects the N-1
node.  

The placement of ancestor nodes within the ancestor axis begins with the
closest ancestor node in the first position and the most distant ancestor
node in the last position.

HTH,
Jeff


-----Original Message-----
From: Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxx]
Sent: Thursday, October 16, 2003 5:26 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Traversing to a parent node...


Hello,
I need help traversing to a specifi parent node.  The result should always
be the same parent node no matter where you are at in the document.  Let me
illustrate:

<AAA>
    <BBB>
            <S/>
            <T/>
            </U>
    </BBB>
            <X/>
            <Y>
                <1/>
                <2/>
                <3/>
            <Z/>
    <CCC>
            <MY>
                <DOG/>
                <AND/>
                <CAT/>
            </MY
    </CCC>
    <DDD>
    </DDD>
</AAA>


These specific parent nodes would always resolve to the node 1 below the
document element, so <BBB> or <CCC> or <DDD>.  How is this possible?

Thanks, Karl


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

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


Current Thread