XPath: select child elements that do *not* have a specific name

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

How do I select those children of "a" that are not "b"?

3 Answers

With XPath 2.0 you can even do

/a/(* except b)

Xpath will look:

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

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

Related