Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XPath Operators

XPath Operators


XPath expressions can return node-sets, strings, booleans and numbers.


XPath Operators

The operators available in XPath expressions are listed below:

operator Description Example Return Value
| Computes two node-sets //book | //cd Returns all node-sets that have both book and cd elements
+ Addition 6 + 4 10
- Subtraction 6 - 4 2
* Multiplication 6 * 4 24
div Division 8 div 4 2
= Equal price=9.80

Returns true if price is 9.80.

Returns false if price is 9.90.

!= Not equal price!=9.80

Returns true if price is 9.90.

Returns false if price is 9.80.

< Less than price<9.80

Returns true if price is 9.00.

Returns false if price is 9.90.

<= Less than or equal to price<=9.80

Returns true if price is 9.00.

Returns false if price is 9.90.

> Greater than price>9.80

Returns true if price is 9.90.

Returns false if price is 9.80.

>= Greater than or equal to price>=9.80

Returns true if price is 9.90.

Returns false if price is 9.70.

or or price=9.80 or price=9.70

Returns true if price is 9.80.

Returns false if price is 9.50.

and The difference between price>9.00 and price<9.90

Returns true if price is 9.80.

Returns false if price is 8.50.

mod Computes the remainder of a division 5 mod 2 1