Does anybody know which version of the XPath specification has been implemented in XML::LibMXL?
Or more to the point, where can I find a description of the XPath functions that I can use in LibXML?
For example, I tried something like
$dcDOM->findvalue('//dc:identifier[contains(@xsi:type,"URI")]');
which seems to work fine, but
$dcDOM->findvalue('//dc:identifier[matches(@xsi:type,"URI")]');
does not.
From that one has to assume that it supports at most XPath 1.0 or some subset of 1.0/2.0 .
Is there a neat page where everything is listed and described?
As you surmised from your probe, XML::LibXML supports XPath 1.0 (not 2.0).
Generally speaking, there is no way in XPath itself to ascertain the version other than through such probes. XSLT, on the other hand, provides system-property('xsl:version')
for identifying version information.
Going the source heritage route: XML::LibXML is based on libxml2, which implements XPath 1.0, as stated right on the Libxml2 homepage:
Libxml2 implements a number of existing standards related to markup languages:
XML Path Language (XPath) 1.0: http://www.w3.org/TR/xpath
You might ask Why doesn't libxml2 support XPath 2.0? or read an old post from maintainer Daniel Veillard that says that XPath 2.0 spec is "far too big and intrusive," but the bottom line remains: XML::LibXML supports XPath 1.0, not 2.0.
XML::LibXML is an interface to libxml, so you would need to find out what version of that you have installed. How you do that depends on your OS, but you could check the version of xsltproc
or xmllint
, e.g.:
$ xsltproc --version
Using libxml 20900, libxslt 10128 and libexslt 817
xsltproc was compiled against libxml 20900, libxslt 10128 and libexslt 817
libxslt 10128 was compiled against libxml 20900
libexslt 817 was compiled against libxml 20900
So I've got libxml v2.2.9.
According to the source of all wisdom, Wikipedia, libxml2 only implements XPath 1.0.
Ok, this is not the 100% answer, but according to https://stackoverflow.com/a/10655581/2740187 (from 2012) libxml only supports XPath 1.0, and the supported string functions are described here: http://www.w3.org/TR/xpath/#section-String-Functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With