XPath operators
XPath expressions can return node sets, strings, logical values, and numbers.
XPath Operators
The operators that can be used in XPath expressions are listed below:
Operator | Description | Instance | 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 | |
Division | 8 div 4 | 2 | |
is equal to | price=9.80 | If price is 9.80, return true. | If price is 9.90, return false. |
is not equal to | price!=9.80 | If price is 9.90, then Return true. | If price is 9.80, return false. | ##<
price<9.80 | Returns true if price is 9.00 . | If price is 9.90, return false. ##<= | |
price<=9.80 | if price is 9.00 , then returns true. | If price is 9.90, return false. | ##> | is greater than
Returns true if price is 9.90 . | If price is 9.80, return false. | ##>= is greater than or equal to | |
if price is 9.90 , then returns true. | If price is 9.70, return false. | ##or or | price=9.80 or price=9.70|
If price is 9.80, then returns true. | If price is 9.50, return false. | ##andwithprice>9.00 and price<9.90 | |
If price is 8.50, return false. | modCalculate the remainder of division5 mod 2 | ||