Filters

Filter expressions are meant for applying to collections. You can add filter expressions at any part of the XPath expression. Filters are applied relative to their context. They also have its own set of operators.

and Logical-and

The logical and operator evaluates both sides of operands and returns true if and only if all of its operands are true.

//tr[@class="odd" and @style]

or Logical-or

The logical or operator evaluates both sides of operands and returns true if one of its operand is true.

//tr[@class="odd" or @class="even"] 

not Negation

The not operator negates the expression.

//tr[not(@class="odd")]

= Equality

The equality operator checks that both operands are equal in value.

//tr[td="Foxtrot"]

!= Inequality

The inequality operator checks that both operands are not equal in value.

//tr[@class!="even"]

Less/Greater than

The less than and greater than operators checks that the values of both operands are less than or greater than one another.

//tr[string-length(@class)>3]

| Union

The union operator returns the union of two sets of nodes. It is usually used for combining results from multiple expressions.

//td[.="Bravo"] | //td[.="Charlie"]