Attached to that posting is a correctly formatted multipart/signed sample message (with CRLFs) and the stylesheet.
This sytelsheet is a nice demonstration of these features: * accessing Non-XML input
* UTF-8 validate input (needed for safety, OK for scenario since ASCII is a subset of UTF-8) * having a func:function doing some preparation work (eliminate soft line breaks, split at '=3D') * having a recursive func:function doing the rest.
Important for the recursive function is doing only what needs to be done in the stylesheet and rely on efficient extension functions (regexp:replace) where possible.
Last, but not least, it demonstartes how you can map a unicode code point to a parsed charecter entity inside a stylesheet by mapping (for ISO-8859-1 sample).
the EXSLT support of several XSLT 1.0 processors is compared.
In the attached archive stylesheet exslt.xsl is used to display tabular, interlinked output detailing the support.
With DataPower firmware 3.8.2 a bunch of new EXSLT functionality has become available.
Eg. the Math package is completely implemented since then.
If you just want to lookup DataPower EXSLT support for firmware 3.8.2 and higher take this link: attachment_14686524_382.html
These three functions ARE supported in DataPower firmware (even in pre 3.8.2 firmware) and are just incorrectly reported as unsupported:
func:function, func:result, dyn:evaluate
The response returned from backend contains a 12 byte Non-XML prefix before XML. This stylesheet strips the Non-XML data, verifies the binary prefix correctness, and does XML validation for the rest. 004SA.xsl
This is an export containing both stylesheet for request/response policies, and a simulation of AS/400 backend by netcat (nc) tool is described and used for a full roundtrip verification.
Accessing the Non-XML data is possible by a binary transform action. WTX provides QUOTEDTOTEXT() function, but what I want to show here is a simpler way to do it.
The solution is by simply replacing the "multipart/signed" Content-Type by "multipart/related" with the correct "boundary" setting. because "multipart/related" messages can be processed by DataPower. This Content-Type rewrite technique was also used in swaform tool allowing to process HTTP form data with binary file uploads (multipart/form-data):
a binary transform action with stylesheet Signed2Related.xsl, with input INPUT and output NULL
a results action with input INPUT
a backend URL of http://127.0.0.1:port2
And you will have a
loopback XML service listening on 127.0.0.1:port2
attachment processing set to "Skip"
store:///identity.xsl transform action
XML Manager with Minimum Output Escaping rule in Compile Options policy (for showing German Umlaute unescaped below)
That's all. I tested with MPGW 1st service and 2nd service as MPGW, XML FW or XSL Accelerator successfully (on 3.7.3, 3.8.0 and 4.0.1 firmware).
Here is the output generated by the service:
$ curl --data-binary @Qp.mime http://dp2-l3:8121; echo <?xml version="1.0" encoding="UTF-8"?> <sample>If you believe that truth=beauty, then surely mathematics is the most beautiful branch of philosophy. <umlaute>äöüÄÖÜß</umlaute></sample> $
<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?> <sample>If you believe that truth=3Dbeauty, then surely=20= mathematics is the most beautiful branch of philosophy.=0A= <umlaute>=E4=F6=FC=C4=D6=DC=DF</umlaute>= </sample> ------=_Part_2_12345 Content-Type: application/pkcs7-signature; name=smime.p7s; smime-type=signed-data Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature
This should be base64 sign part data. Missing intentionally for qouted-printable demo. ------=_Part_2_12345--
<!-- Allow accessing the decoded (quotable-printable) body-part in chained service with "Skip" attachment processing by "multipart/related" --> <dp:set-http-request-header name="'Content-Type'" value="concat('multipart/related; type="text/xml"; ', 'boundary="',$boundary,'"')" />