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 220.127.116.11 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): http://www.w3.org/TR/xpath-functions/
With 18.104.22.168 firmware released last Friday we got much new exciting stuff (I blogged on GatewayScript before).
In my January posting on TOhtml tool for creating the nicely syntax-highlighted source code listings I use in my blog (based on vi's (my favorite editor) TOhtml command), I showed the "answer" to Shakespeare's question from a C- or Java-programmer's perspective:
$ echo "<foobar/>" | coproc2 Shakespeare.xsl - http://dp2-l3:2223 When Shakespeare asked, "To be, or not to be?", he did not provide the answer. But programming can. Well the answer is FF. (2B |~ 2B = FF, bitwise hexadecimal) $
Today I thought again on Shakespeare's question, and think the answer is more likely to be "true" because the question term is a (logic) tautology.
allowed for switching on node-type -- with the help of Michael I got this right. It is a little tricky to check whether a given node is a namespace node or attribute, have a look. This node-type switcher is also part of xpath++ tool
This function just returns the node-type as string, and below stylesheet node-kind.xsl does implement this for DataPower use. See this sample execution with a testcase for each return value, taken from the stylesheet itself (see "document('')" ):
$ echo "<foobar/>" | coproc2 node-kind.xsl - http://dp3-l3:2223 document element attribute text namespace processing-instruction comment $
... the total precision is therefore 53 bits (approximately 16 decimal digits). ... ... For the next range, from 253 (=9,007,199,254,740,992) to 254, everything is multiplied by 2, ...
Below you can see the output of DataPower, xsltproc, xalan and saxon XSLT processors for numbers with 15 to 18 digits. Reported is the length, the conversion of the input string to number (by XSLT core function number()) as well as the original input string. The last 16 digit number is the lowest (positive) integer with precision loss: