Precedence of Query Operators

The precedence of query operators varies for XPath 1.0 and XPath 2.0, as shown in the following tables. In these tables, operators are listed in order of precedence, with highest precedence being first; operators in a given row have the same precedence.

Operation Type
XPath Operators
Grouping
( )
               

            
Filter
[ ]
               

            
Unary minus

              - 
               

            
Multiplication
*, div, mod
               

            
Addition
+, -
               

            
Relational (Comparison)
= != < <= > >=
               

            
Union
|
               

            
Negation
not
               

            
Conjunction
and
               

            
Disjunction
or
               

            
Table 64. Query Operator Precedence - XPath 1.0

Operation Type
XPath Operators
Sequence separator
,
               

            
Conjunction
and
               

            
Type matching

              instance of
               

            
Assertion
treat
               

            
Conversion test
castable
               

            
Conversion
cast
               

            
Relational (Comparison)
eg, ne, lt, le, gt, ge, =, !=, <, <=, >, >=, 
is, <<, >>
               

            
Range
to
               

            
Addition
+, -
               

            
Multiplication
*, div, idiv, mod
               

            
Unary
unary -, unary +
               

            
Union
union, |
               

            
Select set
intersect, except
               

            
Navigation
/, //
               

            
Filter
[ ]
               

            
Table 65. Query Operator Precedence - XPath 2.0

W3C XML Specifications

Learn about the official W3C XML specifications for XML, XSLT, XQuery, XPath, DOM, XML Namespaces, XInclude, XML Base, XPointer, WSDL and more.

XPath Editor

Stylus Studio's intelligent code-sensing, auto-completion technology, Sense:X, is XPath-aware. You'll find Sense:X for XPath in all of Stylus Studio's editors, including the XML Editor, XSLT Editor, and XQuery Editor.

XSD Editor

XSD Editor provides a synchronized split-pane interface that simultaneously shows both a visual XSD Diagram and the underlying code, with changes in one pane immediately reflected in the other

DTD Validator

This page talks about Stylus Studio's DTD Validator it has the ability to specify any third-party XML parsers and validators, real-time syntax checking and DTD validation error reporting, backmapping, integrating third-party DTD validators and more!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member