Subject: Re: value of parent tag
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 23 May 2001 02:28:52 -0700 (PDT)
|
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
|