XPath 2.0 implementation

Comments of the form (: ... :) are now allowed in XPath expressions. Comments may be nested, and may appear anywhere that whitespace separators are allowed.

An expression of the form 1,2,3 can now be used as a top-level XPath expression, it does not need to be enclosed in parentheses.

The "keyword" expressions (those starting with for, some, every, or if) now have the lowest precedence; they cannot be nested within other expressions except by using parentheses. The only exception is the "," operator, which has lower precedence than these keywords.

The syntax for cast as and treat as has changed. These are now infix operators, for example ($x treat as xs:integer) or ('2003-02-20' cast as xs:date). Note also that there are changes in precedence for these operators and for instance of and castable as.

The union operator ('|') once again has higher precedence than unary minus, as it had at XPath 1.0. So (- $a | $b) parses as ( - ($a|$b) ).

The new SequenceType syntax element(*, T) replaces element of type T. Since only built-in atomic types are recognized, the first component must be "*" at present. This syntax is not yet available in path expressions or patterns. The syntax document-node(element(X,Y)) is not yet recognized.

The types node and item must now be written as node() and item().

The built-in types dayTimeDuration, yearMonthDuration, untypedAtomic and anyAtomicType are now in the namespace http://www.w3.org/2003/05/xpath-datatypes whose conventional prefix is xdt. They were previously placed in the xs namespace. Casting string to untypedAtomic is now permitted {type038}.