xsl-list
[Top] [All Lists]

RE: xpath confusion

2003-07-03 02:59:30
Hi,

With the following xml:

<Root>
    <Keys>
         <Client id="abc">
              <a />
              <!-- a /--> 
              <b />
         </Client>
    </Keys>
</Root>

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

XPath: "Root/Keys/Client[(_at_)id="abc"]/ descendant-or-self::comment()"
selects 1 node

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.

Because you have whitespace stipping turned on. It the whitespace was 
preserved, the first expression should return 8 and the third one 4.

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

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

Cheers,

Jarno - Various Artists: Leather Strip - Lies to Tell (Mix by Lights of 
Euphoria)

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



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