Addition and subtraction
The operators +
and -
perform addition and subtraction of
numbers, in the usual way. If the operands are of different types, one of them is
promoted, and the result is the same type as the operands after promotion. For example,
adding two integers produces an integer; adding an integer to a double produces a
double.
Note that the -
operator may need to be preceded by a space to prevent it
being parsed as part of the preceding name.
XPath 2.0 also allows these operators to be used for adding durations to durations or to dates and times.