8

I would like to do a negative xpath query like this:

$xpath->query(//a[DoesNotContain(@class,'some_class')]);

I know about this

$xpath->query(//a[contains(@class,'some_class')]);
kenorb
  • 155,785
  • 88
  • 678
  • 743
sam
  • 193
  • 2
  • 12
  • 1
    possible duplicate of [How to use "not" in xpath?](http://stackoverflow.com/questions/1550981/how-to-use-not-in-xpath) – kenorb Mar 17 '15 at 00:40

1 Answers1

12
$xpath->query(//a[not(contains(@class, 'some_class'))]);
gview
  • 14,876
  • 3
  • 46
  • 51