[Xsltforms-support] Integration of XSLTForms and XProc in eXist (temporary approach)
Brought to you by:
alain-couthures
|
From: Claudius T. <cla...@ya...> - 2009-12-15 13:12:07
|
With kind help and patience of Alain Couthures, we have now an elegant manner to send instances from a XForms page generated using xproc to another XForms page generated using xproc. This approach fills a gap and I guess is a temporary one, until XProc in eXist will use request object (see other topics <a href="http://old.nabble.com/XProc%3A-%22No-request-object-found-in-the-current-XQuery-context.%22-when-using-%22request%3Aget-parameter-names%28%29%22-ts25921906.html#a26533936">here</a>). For this, it is enough that one inserts the next JS script into the respective page: <script type="text/javascript"> <![CDATA[ XPathCoreFunctions["http://www.w3.org/2005/xpath-functions serialize"] = new XPathFunction(false, XPathFunction.DEFAULT_NONE, false, function(nodeSet) { return nodeSet.length === 0? "" : Writer.toString(nodeSet[0]); }); ]]> </script> And call the JS function like this: <xf:setvalue ref="instance('standardParametersInstance')/serializedInstanceString" value="serialize(instance('connectionParametersInstance'))"/> My suggestion is to have a dedicated instance for submission, as follows: <xf:instance id="submissionInstance"> <bindings> <binding port="connectionParameters"> <test/> </binding> </bindings> </xf:instance> And to fill and serialize this instance upon xforms-submit event of the respective submission. The serialized instance should be used within the resource element of the respective submission, as follows: <xf:resource value="instance('standardParametersInstance')/serializedInstanceString"/> <xf:action ev:event="xforms-submit"> <xf:setvalue ref="instance('standardParametersInstance')/serializedInstanceString" value="concat('nextXFormsPage.xproc?bindings=', serialize(instance('submissionInstance')))"/> </xf:action> Claudius Teodorescu |