Posted by
Mahender Didwania on
Dec 21, 2010; 3:43pm
URL: https://discuss.orbeon.com/How-to-wrap-a-text-plain-response-to-xforms-submission-so-it-becomes-XML-tp3093245p3155454.html
Hi,
>In xforms-submission.xpl (the implementation of
oxf:xforms-submission), the default instance should be the same as the
response instance.
Okay, maybe it did not work because of the '/' being used as context (judging from orbeon log). The following works so far as context resolution is concerned, however, as in the code below, I am trying to put the result of submission failure (it is not a failure, merely a text/plain response, but submissions processor treats it as a failure) in a different input (I connect that to the pipeline output). But I get the error: org.orbeon.saxon.trans.XPathException: Failed to load document input:results2.
<p:processor name="oxf:xforms-submission">
<p:input name="submission" transform="oxf:xslt" href="#TargetURL">
<xforms:submission xsl:version="2.0" method="post" action="{/TargetURL/text()}" xxforms:username="admin" xxforms:password="admin" mediatype="text/xml;">
<xforms:message ev:event="xforms-submit-error" level="xxforms:log-error">A submission error occurred:
<xforms:output value="event('error-type')"/>
</xforms:message>
<xforms:action ev:event="xforms-submit-error">
<!-- this works but modifies the default-instance
<xforms:insert context="fn:context()" origin="xxforms:element('Result')"/>
<xforms:setvalue ref="fn:context()/Result"
-->
<!-- this does not work -->
<xforms:insert context="fn:doc('input:results2')/Results" origin="xxforms:element('Result')"/>
<xforms:setvalue ref="fn:doc('input:results2')/Results/Result"
value="fn:choose(fn:string-length('response-reason-phrase')>0,fn:string-join((event('response-status-code') cast as xs:string,event('resource-uri'),event('response-body')),':'),'Dont know')"/>
</xforms:action>
</xforms:submission>
</p:input>
<p:input name="request" href="#xml"/>
<p:input name="results2" href="#results"/>
<p:output name="response" ref="output2"/>
</p:processor>
Where it works, replacing <xforms:setvalue ref="fn:context()/Result" with <xforms:setvalue ref="fn:context()/*" leads to no change in the outcome. The result is the creation of an additional <Result> element in the default-instance.
#results at the time of invoking the above processor is:
<p:processor name="oxf:identity">
<p:input name="data">
<Results />
</p:input>
<p:output name="data" id="results"/>
</p:processor>
Regards,
Mahender
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws