This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: value of parent tag
- To: bonkey at sokrates dot mimuw dot edu dot pl
- Subject: [xsl] Re: value of parent tag
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- Date: Wed, 23 May 2001 02:28:52 -0700 (PDT)
- Cc: xsl-list at lists dot mulberrytech dot com
- Reply-To: xsl-list at lists dot mulberrytech dot com
Daniel Bauke wrote:
> <aaa key="abc">
> <cc/>
> <cc/>
> </aaa>
> <aaa key="cde">
> <cc/>
> <cc/>
> </aaa>
>
> and i need to know 'key' value of a parent tag in each
> particular <cc/>. on the example in 1st and 2nd <cc/> it's
> "abc", in 3rd and 4th - "cde".
Daniel, the xml text above is not well formed, so I used the following:
<top>
<aaa key="abc">
<cc/>
<cc/>
</aaa>
<aaa key="cde">
<cc/>
<cc/>
</aaa>
</top>
The results you want can be obtained using the following XPath expression:
(//cc)[position()=$k]/../@key
where $k will have some value ranging from 1 to count(//cc)
Cheers,
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list