SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
The XPath API
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

# Parentheses and operator precedence

In general an expression may be enclosed in parentheses without changing its meaning.

If parentheses are not used, operator precedence follows the sequence below, starting with the operators that bind most tightly. Within each group the operators are evaluated left-to-right

Operator | Meaning
[] | predicate
/, // | path operator
unary -, unary + | unary plus and minus
cast as | dynamic type conversion
castable as | type test
treat as | static type conversion
instance of | type test
except, intersect | set difference and intersection
|, union | union operation on sets
*, div, idiv, mod | multiply, divide, integer divide, modulo
+, - | plus, minus
to | range expression
=, !=, is, isnot, <, <=;, >, >=, eq, ne, lt, le, gt, ge | comparisons
and | Boolean and
or | Boolean or
if | conditional expressions
some, every | quantified expressions
for | iteration (mapping) over a sequence
, (comma) | Sequence concatenation

The various operators are described, in roughly the above order, in the sections that follow.

Next