Reputation: 46586
I need to match elements that contain neither PCDATA
nor child elements.
I tried this:
.//myelem[count(nodes())=0]
but nodes()
is unknown in XPATH 1.0.
What is the most concise way that you know of to do this in XPATH 1.0 ?
Upvotes: 2
Views: 4216
Reputation: 338228
You were close - it is node()
, not nodes()
:
.//myelem[count(node()) = 0]
or, more idiomatically:
.//myelem[not(node())]
Upvotes: 5