DataPower has a XSLT 1.0 processor since day 1 long ago (1999), and that provides XPath 1.0.
(There is a wealth of EXSLT as well as DataPower proprietary extension functions/elements)
With 188.8.131.52 firmware DataPower shipped XQuery 1.0 processor as well, and that provides XPath 2.0.
Any valid XPath 2.0 statement is a valid XQuery script by definition.
And there is a HUGE amount of functions and operators in XPath 2.0 (more than 250):
With 184.108.40.206 firmware released last Friday we got much new exciting stuff (I blogged on GatewayScript before).
- JSON Schema Validation (JSV) support for draft-04 of spec (6.0.0/6.0.1 support draft-03)
- hybrid output method for XQuery/JSONiq is now available (in addition to "xml" and "json" from 6.0.0/6.0.1)
- dp:xquery-transform(script, nodeset)
Today I want to talk on 3. which allows DataPower XSLT processor to "call out" to XQuery -- nice!
Last August Eric van der Vlist twittered on an XPath expression that allows to tell whether XPath processor is 1.0 or 2.0.
In this tweet I simplified (minimalized?) his expression to (4=5)=/..
This expression just compares false() with an empty nodeset and that is true for XPath 1.0 and false for XPath 2.0.
This XPath expresion is stored here (in order to be accessible by my and your DataPower boxes):
Now below stylesheet isXPath1.xsl does evaluate above XPath expression in a singe concat statement:
$ coproc2 isXPath1.xsl dummy.xml http://dp1-l3:2223 ; echo
As promised this shows that XPath 1.0 and XPath 2.0 happen within a single concat statement!
Here is stylesheet isXPath1.xsl: