Operators
The various operators for composing expressions (in XPath 2.0, 3.0, 3.1 and 4.0) are described, in roughly the order of precedence (as described in the table at below), in the sections that follow.
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 |
XPath version |
More information |
|
unary |
unary lookup operator |
3.1 |
|
|
|
predicate |
2.0 |
|
|
binary |
binary lookup operator |
3.1 |
|
|
|
function call |
2.0 |
|
|
|
path operator |
2.0 |
|
|
|
simple map operator |
3.0 |
|
|
unary |
unary plus and minus |
2.0 |
|
|
|
method call operator |
4.0 |
|
|
|
arrow operator, mapping arrow operator |
3.1, 4.0 |
|
|
|
pipeline operator |
4.0 |
|
|
|
dynamic type conversion |
2.0 |
|
|
|
type test |
2.0 |
|
|
|
static type conversion |
2.0 |
|
|
|
type test |
2.0 |
|
|
|
set difference and intersection |
2.0 |
|
|
|
union operation on sets |
2.0 |
|
|
|
multiply, divide, integer divide, modulo |
2.0 |
|
|
|
plus, minus |
2.0 |
|
|
|
range expression |
2.0 |
|
|
|
string concatenation |
3.0 |
|
|
|
otherwise expression |
4.0 |
|
|
|
comparisons |
2.0 |
|
|
|
node comparisons |
4.0 |
|
|
|
Boolean and |
2.0 |
|
|
|
Boolean or |
2.0 |
|
|
|
conditional expressions |
2.0 |
|
|
|
quantified expressions |
2.0 |
|
|
|
variable declaration |
3.0 |
|
|
|
iteration (mapping) over a sequence |
2.0 |
|
|
|
Sequence concatenation |
2.0 |