How to use “not” in XPath? not() is a function in XPath (as opposed to an operator), so //a[not(contains(@id, ‘xx’))]