New features in XPath 3.1

Some of the new features in XPath 3.1 are as follows. For full details, see the W3C specifications, and for further Saxon implementation details see the Conformance section.

  1. The arrow operator => is available to allow function chaining.

  2. Maps are available (for more details see Maps in XPath). They provide a similar capability to "objects" in Javascript, or "associative arrays" in some other languages. But as befits a function language like XPath, they are immutable. A collection of functions is available to operate on maps (see the Function Library), and in addition there is new syntax for a map constructor (of the form map{ key : value, key : value }) where both the keys and values are arbitrary expressions. There is a sequence type for maps map(K, V), defining the types of the key and value parts. Maps are functions, so given a map $M, the entry for a key $K can be obtained as the result of the function call $M($K).

  3. Another new function item type: Arrays.

A number of new functions are available, including random-number-generator(), sort(), parse-ietf-date(), and functions to read and write data in JSON format. For details see the Functions Library.