In response to: Sum of Pascal's triangle reciprocalsApproved additions to these Online Encyclopedia of Integer Sequences (OEIS):
HermannSW 2700006U54 1,153 Views
Some of these toogle allow you fine grain control on what should be validated (header, fault, ...).
action used in MPGW or XML FW allows for "Validate Document via WSDL URL".
HermannSW 2700006U54 1,897 Views
This posting is on a really tricky Transform Binary stylesheet.
DataPower JSON processing with pre 220.127.116.11 firmwares is according to rfc4627.
Customer had the problem that his input "JSON" was iso-8859-1 encoded and not spec compliant.
DataPower JSON to JSONx conversion correctly complained on that:
The workaround solution was using tricky iso-8859-1.2.utf-8.binary.xsl Transform Binary stylesheet.
There is a nice online demo on that blog, too.
While it currently is not able to parse the HTML pages I am interested in, it might parse those interesting for you.
Like in previous GatewayScript postings I wanted to use htmlparser.js as module.
Not sure whether my approach is the best approach to do just that, but its simple definitely:
This is all the needs to be changed, before I did store the modified file in local: folder of appliance with coproc2 service installed:
Here you can see that demo script does correctly output 5 times true for the testcases from blog page:
And this is htmlparser.demo.js:
Last month quite some time before 18.104.22.168 firmware shipped I did coproc2gatewayscript posting here.
I made use of the fact that writing to "temporary:" folder was a possible location of a GatewayScript file.
First I was a bit frustrated, but then I realized another problem of my solution:
Also, if you look into above referenced posting, I had to make use of
in order to wait for some time (1 sec) to make sure that "temporary:///js" was written before GatewayScript action can be executed and finds the current GatewayScript file there, not a nice "hack".
The solution on how to do that was easy, just made use of Accessing XML Management interface from within a stylesheet posting.
You will have to
and that's it.
HermannSW 2700006U54 Tags:  dp:xquery-transform datapower 1.0 gatewayscript xquery firmware 2.0 xpath 22.214.171.124 xslt 2,164 Views
DataPower has a XSLT 1.0 processor since day 1 long ago (1999), and that provides XPath 1.0.
With 126.96.36.199 firmware DataPower shipped XQuery 1.0 processor as well, and that provides XPath 2.0.
With 188.8.131.52 firmware released last Friday we got much new exciting stuff (I blogged on GatewayScript before).
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:
As promised this shows that XPath 1.0 and XPath 2.0 happen within a single concat statement!
Here is stylesheet isXPath1.xsl:
HermannSW 2700006U54 Tags:  draft-04 draft-03 jsv schema json validation datapower 2 Comments 3,589 Views
DataPower firmware 6.0.0.x and 6.0.1.y implement draft-03.
Find a working draft-04 sample in this developerWorks DataPower forum posting (with 184.108.40.206 firmware):
Side-effect of request type JSON is creation of context __JSONASJSONX and conversion of input as JSONX.
220.127.116.11 service export attached to this posting has request type Non-XML and JSON parsing is done by JSONiq xfrom action doing store:///identity-json.xq.
In developerWorks DataPower forum thread Date Conversion from Gregorain to Hijri Asif asked on how to convert Date to Hijri. Wikipedia told me that Hijri is the islamic calendar. External links section showed Calendar Converter link (http://www.fourmilab.ch/documents/calendar/) and that site is pretty cool. It converts date entered in one format to many others (Gregorian, Julian day, Julian, Hebrew, Islamic, Persian, Mayan, Bahá'í, Indian Civil, French Republican, ISO-8601, Unix time(), Excel Serial Day Number).
First lets see both in action, against XSLT and GatewayScript coproc2 endpoints:
The 2nd shows a small difference of GatewayScript to previous JSON processing on DataPower. GatewayScript implements RFC7159 which allows any JSON element at top level, while previous RFC4627 required top level element to be either JSON array or JSON object:
OK, here is stylesheet gregorian_to_islamic.xsl more or less straight translated to XSLT (the needed parts only).
Since the complete work is done in the modules, gregorian_to_islamic.js is minimal:
With the first release (18.104.22.168) GatewayScript will be available there will be no crypto library support.
Anyway, since 22.214.171.124 GatewayScript does not ship any crypto funcitons, using self written or found libraries is your only current option.
Doing "View Page Source" I saw that these 4 code parts were included into the page:
You get them unmodified if you do "Save Page as" as "complete webpage".
So I decided to make 4 modules out of them, store under "local:" on DataPower and just require("aes-ctr") in order to use it. To make functionality available from the module the last line "module.exports = ...;" had to be appended to each file. And in order to use functionality eg. from module "utf8" var Utf8 = require("utf8"); had to be added at the top of the modules.
Here you can see demonstration GatewayScript aes.demo.js in action:
Now we have seen that aes.demo.js works fine, here is it completely:
The little helper function "_()" at the bottom of aes.demo.js was only intended to be a nice oneline implementation of "byte array to hex string" conversion.
(at least it produces the needed hexadecimal output for the NIST test vectors above)
As stated in other postings DataPower JSONiq (extensions to XQuery) implements version 0.4.42 of the spec:
In case you want to play with other 1.0 JSONiq implementation like http://try.zorba.io/ you find the differences post 0.4.42 here:
A "process JSON input sample" was posted here:
And this is JSONiq script groups.xq: