XPath: select children that have * not * have a specific name

<a> <b/> <c/> <d/> <b/> <e/> </a> 

How to choose those children from "a" who are not "b"?

+48
xpath
Jan 28 '10 at 16:11
source share
3 answers

/a/*[not(self::b)]

+78
Jan 28 '10 at 16:14
source share

With XPath 2.0 you can even do

 /a/(* except b) 
+9
Jan 28
source share

Xpath will look like:

 a/*[name(.) !='b'] 

So select the children of 'a' whose name is not equal to 'b'

+1
Jan 28 '10 at 16:17
source share



All Articles