[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Finding attribute of a 'grand-parent'

Subject: Re: Finding attribute of a 'grand-parent'
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 17 Jul 2001 15:17:20 +0100
po ancestor
> For the element <po id="3"> I'd like to get the id attribute from the
> ancestor that is a po Element (in this case, '2'). 
> What I got with 'ancestor::po' was '1', the attribute from the 'eldest'
> ancestor. 'parent::po' returns nothing, because obviously it isn't the
> parent i am seeking. More like the grand-parent, so to speak. 

If you want the id of the nearest po ancestor that is 
ancestor::po[1]/@id

> In other words: I'm looking for the nearest ancestor relative who is not a
> parent. And I don't want uncles, either... ;-)

but that would be something else, for example on  <someelement/> would
you want to discount  <po id="3">, because it's your parent.

anyway the nearest po answer that isn't your parent is the nearest
ancestor of your parent, which is
../ancestor::po[1]/@id

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.