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.
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]
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"]
The not operator negates the expression.
//tr[not(@class="odd")]
The equality operator checks that both operands are equal in value.
//tr[td="Foxtrot"]
The inequality operator checks that both operands are not equal in value.
//tr[@class!="even"]
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]
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"]