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

Re: Return ancestor siblings based on Id

Subject: Re: Return ancestor siblings based on Id
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Fri, 18 Feb 2005 07:34:00 -0800 (PST)
return yahoo id
I think union (|) operator is the answer..

//tree_node[@id=9]/ancestor::tree_node |
//tree_node[@id=9]/preceding-sibling::* |
//tree_node[@id=9] |
//tree_node[@id=9]/following-sibling::*

Probably, this should also work (seems more efficient
also) -
//tree_node[@id=9]/(ancestor::tree_node |
preceding-sibling::* | self::* | following-sibling::*)

Regards,
Mukul

--- Adam J Knight <adam@xxxxxxxxxxxxxxxxx> wrote:

> Hi guys,
> 
> Another chapter in this tragedy.
> 
> Question: 
> 
> The expression
> '//tree_node[@id=9]/ancestor::tree_node' returns a
> nodeset
> containing node with id(7). I have verified this
> with xpath visualizer.
> 
> How do I return the ALL siblings of this node also.
> 
> The result being
> Node(id=7)
> Node(id=8) : sibling of Node(id=7)
> Node(id=9) : sibling of Node(id=7)
> Node(id=14) : sibling of Node(id=7)
> 
> HELP APPRECIATED!!!!
> 
> ALL TO0 FAMILIAR XML STRUCTURE:
> <tree>
>   <tree_node id="7" value="Test Level One A">
>     <tree_node id="8" value="Test Level Two A"/>
>     <tree_node id="9" value="Test Level Two B">
>       <tree_node id="11" value="Test Level Three
> B"/>
>       <tree_node id="10" value="Test Level Three A">
>         <tree_node id="12" value="Test Level Four
> A"/>
>         <tree_node id="13" value="Test Level Four
> B"/>
>       </tree_node>
>     </tree_node>
>     <tree_node id="14" value="Test Level Two C"/>
>   </tree_node>
> </tree>




		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

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.