New features in XPath 4.0

Some of the new features in XPath 4.0 are as follows. For full details, see the W3C specifications (in particular XML Path Language (XPath) 4.0 and XQuery and XPath Data Model 4.0).

  1. GNodes, JNodes and XNodes

  2. Ordered maps

  3. String templates

  4. New operators: otherwise, pipeline operator, mapping arrow operator

  5. New item types: choice types, enumeration types, record types, named item types

  6. New syntax relating to functions:

  7. New axes: preceding-or-self, preceding-sibling-or-self, following-or-self, and following-sibling-or-self

  8. From 4.0, XPath expressions can be include namespace declarations, allowing namespace prefixes to be bound within the XPath expression, rather than relying entirely on the host language to declare namespace prefixes.

Many new functions are available, for details see the Functions library.