Hi,

Just to make sure I get the right picture...

Let's say I want to use XForms to edit a XML document stored on disk.

First, I need to read this document into my form instance.

The XForms spec would let me use a src attribute to specify
<xforms:instance src="/path/to/my/document.xml"/> but that's not
supporter by OIS right now.

A solution is to use xinclude to include the document into the
xforms:instance element but, "Files that are included with XInclude must
be static: their content cannot change while the application is running.
If they do, there is a risk that an older version could be used due to
aggressive caching." I gave it a try and can confirm that if a user
updates the instance document, the modification is ignored by
xinclude...

The only solution I have found is to define the form in a pipeline such
as:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline";
          xmlns:oxf="http://www.orbeon.com/oxf/processors";>

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

    <p:processor name="oxf:xslt">
     <p:input name="data" href="file:///tmp/instance.xml"/>
     <p:input name="config" >
        <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms";
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xsl:version="2.0">
        <xforms:instance>
         <xsl:copy-of select="/*"/>
        </xforms:instance>
        </xforms:model>
     </p:input>
     <p:output name="data" ref="data"/>
   </p:processor>

</p:config>

With this pipeline, the cache seems to be correctly handled and if I
update the document, the result is immediately visible. 

Second, I need to write the instance back into the document and for
that, I need to write a pipeline that will use a file serializer to
serialize the instance into the document, such as:


<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline";
          xmlns:oxf="http://www.orbeon.com/oxf/processors";>

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

    <p:processor name="oxf:file-serializer">
        <p:input name="config">
                <config>
                        <file>instance.xml</file>
                        <directory>/tmp/</directory>
                        <content-type>text/xml</content-type>
                        <encoding>utf-8</encoding>
                        <indent-amount>4</indent-amount>
                </config>
        </p:input>
        <p:input name="data" href="#instance"/>
    </p:processor>

</p:config>

I can use this pipeline either as a page model or as a page view (both
of them have access to the instance document returned by the user) but I
can't add this serialization in the pipeline used to build the form
since, AFAIK, the instance isn't exposed there.

Do I get it right? Is there an easier way to do that?

Thanks,

Eric
-- 
Tired of typing XML tags?
                                                       http://wikiml.org
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
orbeon-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/orbeon-user

Reply via email to