2

Is it possible to create an XPath expression that matches all child nodes that are not of a certain name? E.g.

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

How would I select all children of the 'a' node that are not a 'b' node?

izb
  • 50,101
  • 39
  • 117
  • 168

2 Answers2

7
/a/*[not(self::b)]
Dewfy
  • 23,277
  • 13
  • 73
  • 121
5

Or with XPath 2.0

/a/(* except b)
Martin Honnen
  • 160,499
  • 6
  • 90
  • 110