Latest web development tutorials

XPath operators

XPath expressions can return a node set, string, Boolean values, and numbers.


XPath operators

The following lists are available in the XPath expression operators:

Operators description Examples return value
| Two sets compute nodes // Book | // cd Returns all elements has a book and cd node set
+ addition 6 + 4 10
- Subtraction 6--4 2
* multiplication 6 * 4 twenty four
div division 8 div 4 2
= equal price = 9.80

If the price is 9.80, it returns true.

If the price is 9.90, it returns false.

! = not equal to price! = 9.80

If the price is 9.90, it returns true.

If the price is 9.80, it returns false.

< Less than price <9.80

If the price is 9.00, it returns true.

If the price is 9.90, it returns false.

<= less than or equal to price <= 9.80

If the price is 9.00, it returns true.

If the price is 9.90, it returns false.

> more than the price> 9.80

If the price is 9.90, it returns true.

If the price is 9.80, it returns false.

> = greater than or equal to price> = 9.80

If the price is 9.90, it returns true.

If the price is 9.70, it returns false.

or or price = 9.80 or price = 9.70

If the price is 9.80, it returns true.

If the price is 9.50, it returns false.

and versus price> 9.00 and price <9.90

If the price is 9.80, it returns true.

If the price is 8.50, it returns false.

mod Calculated remainder of the division 5 mod 2 1