tags:

views:

179

answers:

1

I need to match elements that contain neither PCDATA nor children 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 ?

+1  A: 

You were close - it is node(), not nodes():

.//myelem[count(node()) = 0]

or, more idiomatically:

.//myelem[not(node())]
Tomalak
Stupid me ! Thanks a lot.
subtenante