SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Notices
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
XPath API for Java
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
| Introduction
| Constants
| Variable References
| Function Calls
| Axis steps
| Parentheses and operator precedence
| Filter expressions
| Path expressions
| Cast as, Treat as
| Set difference and intersection
| Union
» | Arithmetic expressions
| Range expressions
| Comparisons
| Instance of and Castable as
| Conditional Expressions
| Quantified Expressions
| For Expressions
| Boolean expressions: AND and OR
| Sequence expressions
Function Library
Standards Conformance

# 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.

Next