tags:

views:

80

answers:

3

I would like to select all elements that have certain attribute or don't have it at all:

//job[@salary<"100" or !@salary]

This code is not valid. Which one is? Thanks!

+1  A: 
//job[count(@salary) = 0]

I think :)

remi bourgarel
+3  A: 
//job[@salary<"100" or not(@salary)] 

There isn't a not operator in xpath. See http://www.w3schools.com/xpath/xpath_operators.asp

Krab
works perfectly, many thanks!
Vincenzo
+1  A: 
//job[@salary<"100" or count(@salary)=0]

Tested it here and works fine.

AdmSteck