Operators and Keywords
Here is the complete list of operators and keywords in XPath:
!=(not equal)Compares its two operands and returns
trueif the first operand is not equal to the second. (Complete details on how comparisons work are in the section Boolean Operators” in Chapter 3.)()Contains a parenthesized expression. In addition to using parentheses in mathematical expressions, parentheses are required around test conditions in the
ifoperator.*(occurrence indicator)Represents zero or more of an item.
*(multiplication)Multiplies its two operands together. In XPath 1.0, the two operands must be numbers or values that can be converted to numbers.
[2.0] In XPath 2.0, we can multiply
xs:yearMonthDurations andxs:dayTimeDurationsby numeric values. Valid combinations are:xs:yearMonthDuration * xs:doublexs:dayTimeDuration * xs:double
+(occurrence indicator)Represents zero or one of an item.
+(addition)Adds its two operands. In XPath 1.0, the two operands must be numbers or values that can be converted to numbers.
[2.0] In XPath 2.0, we can add dates, times, and durations in addition to numeric values. Valid combinations are:
xs:yearMonthDuration + xs:yearMonthDurationxs:dayTimeDuration + xs:dayTimeDurationxs:dateTime + xs:yearMonthDurationxs:dateTime + xs:dayTimeDurationxs:date + xs:yearMonthDurationxs:date + xs:dayTimeDurationxs:time + xs:dayTimeDuration
+(unary plus)Returns its operand with the sign unchanged. This operator doesn’t change its operand at all.
- [2.0]
,(sequence operator) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access