XPath 3.1 is the current version of XPath, finalized in March of 2017. It adds maps and arrays to XPath 3.0, as well as the arrow operator. Maps and arrays allow for JSON processing support. Use this tag for questions specific to XPath 3.1.
XPath 3.1 is the current version of XPath, it was finalized in March 2017, consisting of three specifications:
- XQuery and XPath 3.1 Data Model
- XQuery and XPath 3.1 Functions and Operators
- XPath 3.1 language (XML Path Language 3.1)
It builds on XPath 3.0, finalized in 2014.
The main new features in XPath 3.1 are the addition of maps and arrays to facilitate JSON processing and the arrow operator =>
which allows writing nested function calls like
tokenize((normalize-unicode(upper-case($string))),"\s+")
as
$string => upper-case() => normalize-unicode() => tokenize("\s+")
instead.
XPath 3.1 is supported on various platforms and with various host languages by implementations like
- Saxon 9.8 and later for .NET as well as for Java (see https://sourceforge.net/projects/saxon/files/Saxon-HE/ for the open-source Home Edition and http://saxonica.com/download/download_page.xml for the commercial editions PE and EE)
- Saxon-C for C/C++ with bindings for PHP and Python, since SaxonC 12 directly available as a PIP installable wheel https://pypi.org/project/saxonche/
- XmlPrime 4 for .NET
- Saxon-JS 2 for JavaScript in the browser or for Node.js
- ElementPath 4 for Python also supports XPath 3.1
As XPath 3.1 is basically a subset of XQuery 3.1, any XQuery 3.1 implementation like BaseX also supports XPath 3.1.
Resources