Re: [xsl] xpath confusion

Subject: Re: [xsl] xpath confusion
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 3 Jul 2003 10:47:02 +0100
Hi Bodrul,

> XPath: "Root/Keys/Client[@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[@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


Current Thread