xsl-list
[Top] [All Lists]

RE: Correction: Return Ancestor Nodes Children!

2005-02-18 09:18:07
I think Adam wanted ancestor nodes of 
//tree_node[(_at_)id=9] , and all children of the
ancestors. I am not sure whether he wanted only the
root ancestor(node -> tree_node id="7") , or all the
ancestors.

I also need to correct the XPath expression I wrote(he
wanted the ancestor node as well)..

It should be - 
(//tree_node[(_at_)id=9]/ancestor::tree_node)/(child::* |
self::*)

(not tested!)

Regards,
Mukul

--- "Ross, Douglas" <DRoss(_at_)Kronos(_dot_)com> wrote:

Mukul,

If you just want children wouldn't you just use?

//tree_node[(_at_)id=9]/child::*

It seems to me that

//tree_node[(_at_)id=9]/ancestor::tree_node)/child::*

would find all the siblings of tree_node[(_at_)id=9] not
its children.

Note: I have not tested my suggestion either.

Douglas Ross
Developer, HTML UI Framework
Kronos
E-mail: dross(_at_)kronos(_dot_)com
www.kronos.com

-----Original Message-----
From: Mukul Gandhi [mailto:mukul_gandhi(_at_)yahoo(_dot_)com] 
Sent: Friday, February 18, 2005 10:55 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Correction: Return Ancestor Nodes
Children!

Please try -
(//tree_node[(_at_)id=9]/ancestor::tree_node)/child::*

(not tested!)

Regards,
Mukul

--- Adam J Knight <adam(_at_)brightidea(_dot_)com(_dot_)au> wrote:

Correction to previous post.

Hi guys,

Another chapter in this tragedy.

Question: 

The expression
'//tree_node[(_at_)id=9]/ancestor::tree_node' returns a
nodeset
containing node with id(7) (its ancestor). I have
verified this with xpath
visualizer.

How do I return the ALL children of this node
also.

The result being
Node(id=7)(ancestor)
Node(id=8) : child of Node(id=7)
Node(id=9) : child of Node(id=7)
Node(id) : child 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>

Cheers, 
Adam 
 
NB: "Pray as if everything depended upon God and
work as if everything
depended upon man."



              
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





                
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--