How to use "not" in XPath?

Viewed 172010

I want to write something of the sort:

//a[not contains(@id, 'xx')]

(meaning all the links that there 'id' attribute doesn't contain the string 'xx')

I can't find the right syntax.

4 Answers

Use boolean function like below:

//a[(contains(@id, 'xx'))=false]
Related