XPath Operators
- Previous Page XPath Axes
- Next Page XPath Examples
XPath expressions can return node sets, strings, logical values, and numbers.
XPath Operators
The following lists the operators that can be used in XPath expressions:
Operator | Description | Example | Return value |
---|---|---|---|
| | Calculate two node sets | //book | //cd | Return all node sets that have book and cd elements |
+ | addition | 6 + 4 | 10 |
- | subtraction | 6 - 4 | 2 |
* | multiplication | 6 * 4 | 24 |
div | division | 8 div 4 | 2 |
= | equal to | price=9.80 |
If price is 9.80, return true. If price is 9.90, return false. |
!= | not equal to | price!=9.80 |
If price is 9.90, return true. If price is 9.80, return false. |
< | less than | price<9.80 |
If price is 9.00, return true. If price is 9.90, return false. |
<= | less than or equal to | price<=9.80 |
If price is 9.00, return true. If price is 9.90, return false. |
> | greater than | price>9.80 |
If price is 9.90, return true. If price is 9.80, return false. |
>= | greater than or equal to | price>=9.80 |
If price is 9.90, return true. If price is 9.70, return false. |
or | or | price=9.80 or price=9.70 |
If price is 9.80, return true. If price is 9.50, return false. |
And | And | price>9.00 and price<9.90 |
If price is 9.80, return true. If price is 8.50, return false. |
mod | Calculate the remainder of division | 5 mod 2 | 1 |
- Previous Page XPath Axes
- Next Page XPath Examples