Functions, operators, and data types for XPath 2.0

The data types gYear, gYearMonth, gMonth, gMonthDay, and gDay are implemented. {date076-079}

The functions get-current-date/time/dateTime() now return a date/time in the implicit timezone (as determined from the current Java Locale). {date001}

The function implicit-timezone() has been implemented. {date069}

The functions get-timezone-from-date/time/dateTime() now return the timezone as a value of type xdt:dayTimeDuration, not as a string. This means the result is displayed as (for example) PT3H rather than +03:00. {date048-052}

Casting from xs:dateTime to xs:date now retains the timezone, if there is one.

The functions adjust-date-to-timezone(), adjust-dateTime-to-timezone(), and adjust-time-to-timezone() are implemented.

Note that the function get-hours-from-date/dateTime() returns the localized component value. It has always done this in the Saxon implementation, and the latest working draft now makes this the correct behavior.

The function sum() now returns an integer 0 rather than a double 0.0 when the input sequence is empty. (An integer can be used anywhere a double can be used, but the converse is not true). Note: this change was agreed by the Working Groups, but was inadvertently left out of the published drafts.

The function root() now accepts an empty sequence as its argument (and returns an empty sequence).

The function distinct-values() now returns only one NaN if there are multiple NaN values in the sequence. {group026}

The function escape-uri() no longer escapes square brackets when the escape-reserved argument is false.

The function function-available() now recognizes function names that use the fn: namespace. {func32}

The functions contains, ends-with, starts-with, substring-after, and substring-before now use the Unicode codepoint collation if no explicit collation is supplied; they do not use the default collation.

The functions min and max now convert untyped atomic values to double rather than string, and return NaN if the sequence contains a NaN value. {expr57}

The function get-in-scope-namespaces is renamed get-in-scope-prefixes. {nspc45}

The function insert-before now allows the insert position to be beyond the end of the sequence (which causes the new sequence to be appended to the original). {expr71}

The function reverse has been implemented. {expr91}

In a range expression, $x to $y, it is no longer possible to produce a descending sequence of integers. Instead, if the start point is less than the end point, an empty sequence is returned. This change is to allow the construct for $i in 1 to count($seq) ... to work as expected. To get a reverse sequence of integers, use reverse(1 to 5).

The function call remove($seq, 1) is now treated specially, it is optimized in the same way as $seq[position()!=1] due to the common use of this expression in head-tail recursion. {expr92}

The functions context-item, distinct-nodes, input, item-at, node-kind, sequence-node-identical, and string-pad have been dropped.

The function concat must now have at least two arguments. (This reverts to the XPath 1.0 specification.)

In regular expression matching (e.g. in replace() and in the XSLT regex-group() function, group 0 now refers to the entire substring that matched the regex. {regex08}

The isnot operator has been dropped.