tags:

views:

18

answers:

1

How do I use something similar to the example below, but with the opposite result, i.e items that do not contain (default) in the text.

<test>
     <item>Some text (default)</item>
     <item>Some more text</item>
     <item>Even more text</item>
</test>

Given this

//test/item[contains(text(), '(default)')]

would return the first item. Is there a not operator that I can use with contains?

+3  A: 

Yes there is:

//test/item[not(contains(text(), '(default)'))]

Hint: not() is a function in XPath, instead of an operator.

Tomalak