XPath Operators
- Previous Page XPath Axes
- Next Page XPath Examples
XPath expressions can return a node set, string, logical value, and number.
XPath Operators
The following operators are available in XPath expressions:
Operators | 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