How to negate xpath query?
Asked Answered
E

1

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')]);
Eyre answered 13/9, 2011 at 1:14 Comment(1)
possible duplicate of How to use "not" in xpath?Bilestone
P
12
$xpath->query(//a[not(contains(@class, 'some_class'))]);
Prompter answered 13/9, 2011 at 1:28 Comment(1)
//a[not[contains(@class,'some_class')]]Eyre

© 2022 - 2024 — McMap. All rights reserved.