xsl-list
[Top] [All Lists]

Re: xpath confusion

2003-07-03 02:47:02
Hi Bodrul,

XPath: "Root/Keys/Client[(_at_)id="abc"]/ descendant-or-self::text()"
selects 0 nodes. 

Please can someone explain to me why the last xpath doesn't select 3
nodes.

I guess that whatever XSLT processor you're using (probably MSXML) is
stripping the whitespace-only text nodes (there should be four of
them) between the elements/comments.

I would like to select the 3 nodes <Client>, <a /> and <b />. Any
help is appreciated.

In other words, following the pattern of the other paths that you've
been trying, the three elements in the descendant-or-self axis from
the <Client> element:

  Root/Keys/Client[(_at_)id = "abc"]/descendant-or-self::*

* matches element nodes in this context because the "principal node
type" of the descendant-or-self axis are element nodes.

(In XSLT 2.0, you can also use "element()" as a node test that matches
all elements.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



<Prev in Thread] Current Thread [Next in Thread>