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, function call |
|
path operator |
|
simple mapping operator (XPath 3.0) |
unary |
unary plus and minus |
|
dynamic type conversion |
|
type test |
|
static type conversion |
|
type test |
|
set difference and intersection |
|
union operation on sets |
|
multiply, divide, integer divide, modulo |
|
plus, minus |
|
range expression |
|
string concatenation (XPath 3.0) |
|
comparisons |
|
Boolean and |
|
Boolean or |
|
conditional expressions |
|
quantified expressions |
|
iteration (mapping) over a sequence |
|
Sequence concatenation |
The various operators are described, in roughly the above order, in the sections that follow.