O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Operators and Keywords

Here is the complete list of operators and keywords in XPath:

!= (not equal)

Compares its two operands and returns true if 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 if operator.

* (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 and xs:dayTimeDurations by numeric values. Valid combinations are:

  • xs:yearMonthDuration * xs:double

  • xs: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:yearMonthDuration

  • xs:dayTimeDuration + xs:dayTimeDuration

  • xs:dateTime + xs:yearMonthDuration

  • xs:dateTime + xs:dayTimeDuration

  • xs:date + xs:yearMonthDuration

  • xs:date + xs:dayTimeDuration

  • xs: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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required