Using the xml of a xforms:submission as model

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using the xml of a xforms:submission as model

Thorsten Stumpf
Using the xml of a xforms:submission as model

Hi!

I’m trying to load a page with a certain view and a parametrized xml document as a page data model (which may be reloaded later on).

My initial and naive idea was to load the page with an (optional) parameter that changes the element „/ticket/parameter/foo“ of the default-submission ticket „ticket.xml“.

The modified default submission shall be submitted (it is selected as input instance oft he XPL pipeline „getData.xpl“, is in feature transformed by an XSL and is submitted to an other service which in turn sends the proper response as a XML document).

The returned XML document is inserted in the xforms-form-description view.xsl as the content of an instance (by an xsl:copy-of operation).

So i came up with something like that (all sources below):

Called URL „http://localhost/orbeon/test09/?foo=234567

        <page path-info="/test09/" model="test09/getData.xpl" view="test09/view.xsl" default-submission="test09/ticket.xml">
               
<setvalue ref="/ ticket/parameter/foo" parameter="foo"/>
       
</page>

My idea of the chain is something like:

URL-Request -> Orbeon-Page [

        extract GET-param of request -> alter ticket.xml data by GET-param -> send altered XML instance „input“ by „getData.xpl“ [

        send XML instance „input“ by xforms:submission via post to „<A HREF="http://">http://xmlservice.loc/backend/process-ticket/ in the XPL pipeline „getData.xpl“ -> retrieve XML as „data“ instance

        ]

                -> build XForms form page [

                        execute XSL page view [

            insert data instance as copy

            ]

                        ]

                ]

This does not return the XForms form (but an empty page) and on the log I can see that there is most probably the XPL is processed as input for the submission or the submission return is overwritten by the form source code.

How can I code what I want to do properly?

If you can tell me an other option I’m happy as well. I might send the request as an auto submit after page load. I thaught abaout that (actually it’s the way we did it before) but I was not shure if this ist hat clever especially because the send XML data is very big (but of course it is not transfered to the client actually).

Regards & thanks for your help in advance,

Jens

getData.xpl

=============================================================================================

<p:config
        xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo
="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"
        xmlns:xhtml
="http://www.w3.org/1999/xhtml" xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xforms
="http://www.w3.org/2002/xforms" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" xmlns:atom="http://www.w3.org/2005/Atom">

       
<p:param type="input" name="instance" />

<!—later here starts a XSL processing of the ticket -->

       
<p:processor name="oxf:xforms-submission">
               
<p:input name="submission">

                        <xforms:submission method="post" action="<A HREF="http://">http://xmlservice.loc/backend/process-ticket/" />
               
</p:input>
               
<p:input name="request" href="#instance"/>
               
<p:output name="response" id="response" />
       
</p:processor>

       
<p:processor name="oxf:xml-converter">
               
<p:input name="config">
                       
<config>
                               
<encoding>utf-8</encoding>
                               
<indent>true</indent>
                       
</config>
               
</p:input>
               
<p:input name="data" href="#response" />
               
<p:output name="data" id="converted" />
       
</p:processor>


       
<p:processor name="oxf:http-serializer">
               
<p:input name="config">
                       
<config>
                               
<header>
                                       
<name>Cache-Control</name>
                                       
<value>post-check=0, pre-check=0</value>
                               
</header>
                       
</config>
               
</p:input>
               
<p:input name="data" href="#converted" />
       
</p:processor>

</p:config>

view.xsl

=============================================================================================

<?xml version="1.0" encoding="UTF-8"?>
<xhtml:html xsl:version="2.0"
        xmlns
="http://www.w3.org/1999/xhtml"
        xmlns:xi
="http://www.w3.org/2001/XInclude"
        xmlns:xhtml
="http://www.w3.org/1999/xhtml"
        xmlns:xforms
="http://www.w3.org/2002/xforms"
        xmlns:xxforms
="http://orbeon.org/oxf/xml/xforms"
        xmlns:xsl
="http://www.w3.org/1999/XSL/Transform"
        xmlns:widget
="http://orbeon.org/oxf/xml/widget"
        xmlns:ev
="http://www.w3.org/2001/xml-events">
       
<xhtml:head>
               
<xhtml:title>Testpages Orbeon</xhtml:title>
               
<xforms:model id="main">

                       
<xforms:instance id="data">
                               
<xsl:copy-of select="/"/>
                       
</xforms:instance>

                       
<xforms:submission id="test-submission" action="/test09/getData" method="post" serialization="application/xml" replace="instance" instance="data" />
               
</xforms:model>
       
</xhtml:head>
       
<xhtml:body>
               
<xhtml:h1>Testpage 9</xhtml:h1>

               
<xforms:submit submission="test-submission">
                       
<xforms:label>Send</xforms:label>
               
</xforms:submit>

               
<widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" />
       
</xhtml:body>
</xhtml:html>

ticket.xml

=============================================================================================

<?xml version="1.0" encoding="UTF-8"?>
<ticket xmlns="">
           
<parameter>
               
    <foo>123456</foo>
           
</parameter>
</ticket>



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Using the xml of a xforms:submission as model

Erik Bruchez-3
JT,

The view XSLT's default input (accessed when you write <xsl:copy-of
select="/"/>) is the view's "data" input.

So your model pipeline must output a "data" output. You could simply
write (I haven't actually run it):

<p:config>

        <p:param type="input" name="instance" />
        <p:param type="output" name="data" />

        <p:processor name="oxf:xforms-submission">
                <p:input name="submission">

                        <xforms:submission method="post"
action="http://xmlservice.loc/backend/process-ticket/" />
                </p:input>
                <p:input name="request" href="#instance"/>
                <p:output name="response" id="response" ref="data"/>
        </p:processor>

</p:config>

If that's all you have, you could also do this directly from XForms:

<xforms:instance src="input:data"/>

Finally, you could also get request parameters with XForms, e.g.:

<xforms:setvalue ev:event="xforms-model-construct-done"
ref="/ticket/parameter/foo"
value="xxforms:get-request-parameter('foo')"/>

-Erik

On Mon, Feb 15, 2010 at 3:38 AM, Stumpf, Jens Thorsten
<[hidden email]> wrote:

> Hi!
>
> I’m trying to load a page with a certain view and a parametrized xml
> document as a page data model (which may be reloaded later on).
>
> My initial and naive idea was to load the page with an (optional) parameter
> that changes the element „/ticket/parameter/foo“ of the default-submission
> ticket „ticket.xml“.
>
> The modified default submission shall be submitted (it is selected as input
> instance oft he XPL pipeline „getData.xpl“, is in feature transformed by an
> XSL and is submitted to an other service which in turn sends the proper
> response as a XML document).
>
> The returned XML document is inserted in the xforms-form-description
> „view.xsl“ as the content of an instance (by an xsl:copy-of operation).
>
> So i came up with something like that (all sources below):
>
> Called URL „http://localhost/orbeon/test09/?foo=234567“
>
>         <page path-info="/test09/" model="test09/getData.xpl"
> view="test09/view.xsl" default-submission="test09/ticket.xml">
>                 <setvalue ref="/ ticket/parameter/foo" parameter="foo"/>
>         </page>
>
> My idea of the chain is something like:
>
> URL-Request -> Orbeon-Page [
>
> extract GET-param of request -> alter „ticket.xml“ data by GET-param -> send
> altered XML instance „input“ by „getData.xpl“ [
>
> send XML instance „input“ by xforms:submission via post to
> „http://xmlservice.loc/backend/process-ticket/“ in the XPL pipeline
> „getData.xpl“ -> retrieve XML as „data“ instance
>
> ]
>
>                 -> build XForms form page [
>
>                         execute XSL page view [
>
> insert „data“ instance as copy
>
> ]
>
>                         ]
>
>                 ]
>
> This does not return the XForms form (but an empty page) and on the log I
> can see that there is most probably the XPL is processed as input for the
> submission or the submission return is overwritten by the form source code.
>
> How can I code what I want to do properly?
>
> If you can tell me an other option I’m happy as well. I might send the
> request as an auto submit after page load. I thaught abaout that (actually
> it’s the way we did it before) but I was not shure if this ist hat clever
> especially because the send XML data is very big (but of course it is not
> transfered to the client actually).
>
> Regards & thanks for your help in advance,
>
> Jens
>
> getData.xpl
>
> =============================================================================================
>
> <p:config
>         xmlns:p="http://www.orbeon.com/oxf/pipeline"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:svg="http://www.w3.org/2000/svg"
>         xmlns:xhtml="http://www.w3.org/1999/xhtml"
> xmlns:oxf="http://www.orbeon.com/oxf/processors"
>         xmlns:xforms="http://www.w3.org/2002/xforms"
> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:atom="http://www.w3.org/2005/Atom">
>
>         <p:param type="input" name="instance" />
>
> <!—later here starts a XSL processing of the ticket -->
>
>         <p:processor name="oxf:xforms-submission">
>                 <p:input name="submission">
>
>                         <xforms:submission method="post"
> action="http://xmlservice.loc/backend/process-ticket/" />
>                 </p:input>
>                 <p:input name="request" href="#instance"/>
>                 <p:output name="response" id="response" />
>         </p:processor>
>
>         <p:processor name="oxf:xml-converter">
>                 <p:input name="config">
>                         <config>
>                                 <encoding>utf-8</encoding>
>                                 <indent>true</indent>
>                         </config>
>                 </p:input>
>                 <p:input name="data" href="#response" />
>                 <p:output name="data" id="converted" />
>         </p:processor>
>
>
>         <p:processor name="oxf:http-serializer">
>                 <p:input name="config">
>                         <config>
>                                 <header>
>                                         <name>Cache-Control</name>
>                                         <value>post-check=0,
> pre-check=0</value>
>                                 </header>
>                         </config>
>                 </p:input>
>                 <p:input name="data" href="#converted" />
>         </p:processor>
>
> </p:config>
>
> view.xsl
>
> =============================================================================================
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xhtml:html xsl:version="2.0"
>         xmlns="http://www.w3.org/1999/xhtml"
>         xmlns:xi="http://www.w3.org/2001/XInclude"
>         xmlns:xhtml="http://www.w3.org/1999/xhtml"
>         xmlns:xforms="http://www.w3.org/2002/xforms"
>         xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         xmlns:widget="http://orbeon.org/oxf/xml/widget"
>         xmlns:ev="http://www.w3.org/2001/xml-events">
>         <xhtml:head>
>                 <xhtml:title>Testpages Orbeon</xhtml:title>
>                 <xforms:model id="main">
>
>                         <xforms:instance id="data">
>                                 <xsl:copy-of select="/"/>
>                         </xforms:instance>
>
>                         <xforms:submission id="test-submission"
> action="/test09/getData" method="post" serialization="application/xml"
> replace="instance" instance="data" />
>                 </xforms:model>
>         </xhtml:head>
>         <xhtml:body>
>                 <xhtml:h1>Testpage 9</xhtml:h1>
>
>                 <xforms:submit submission="test-submission">
>                         <xforms:label>Send</xforms:label>
>                 </xforms:submit>
>
>                 <widget:xforms-instance-inspector
> xmlns:widget="http://orbeon.org/oxf/xml/widget" />
>         </xhtml:body>
> </xhtml:html>
>
> ticket.xml
>
> =============================================================================================
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ticket xmlns="">
>             <parameter>
>                     <foo>123456</foo>
>             </parameter>
> </ticket>
>
>
> --
> 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
>
>


--
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