YouTip LogoYouTip

Xpath Operators

# XPath Operators * * * XPath expressions can return node sets, strings, logical values, and numbers. * * * ## XPath Operators The following operators are available in XPath expressions: | Operator | Description | Example | Return Value | | --- | --- | --- | --- | | | | Union of two node sets | //book | //cd | Returns a node set containing all elements with book and cd nodes | | + | Addition | 6 + 4 | 10 | | - | Subtraction | 6 - 4 | 2 | | * | Multiplication | 6 * 4 | 24 | | div | Division | 8 div 4 | 2 | | = | Equal to | price=9.80 | Returns true if price is 9.80; returns false if price is 9.90 | | != | Not equal to | 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 | 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 | Logical OR | price=9.80 or price=9.70 | Returns true if price is 9.80; returns false if price is 9.50 | | and | Logical AND | price>9.00 and price<9.90 | Returns true if price is 9.80; returns false if price is 8.50 | | mod | Modulo (remainder after division) | 5 mod 2 | 1 |
← Xpath ExamplesXpath Axes β†’