Re: Embedded XForms

Steven,

By the statement, 'this node is used to initialise the textually first instance in the embedded form', do you mean the first instance, in document order, in the embedded form?


Regards

Philip



On 05/06/2018, 10:34, "Steven Pemberton" <steven.pemberton@cwi.nl> wrote:

    OK, here is a strawman proposal for embedded XForms, presented as a piece  
    of spec text.
    
    It works by passing values to initialise an instance, and the embedded  
    form returns values using a submission with method="xforms-return".
    
    Steven
    
    =====
    
    The control element
    
    This element embeds an XForm in the current form.
    
    Common Attributes: Control Common
    
    Special attributes:
    
    resource
        Required URL of a resource containing an XForm. This form will be  
    embedded within the current form.
    
    initial
        Optional single node expression. The value of this node is used to  
    initialise the textually first instance in the embedded form, in the same  
    way as a <submit replace="instance"/> would work. If absent, no values are  
    passed to the embedded form.
    
    ref (also bind)
        Optional single node binding that indicates the target node to receive  
    submissions from the embedded form that use the method 'xforms-return'. It  
    may be the same node as that used in the 'initial' attribute. If absent,  
    no values are returned from the embedded form (even if it uses submissions  
    using 'xforms-return' [which may cause an xforms error of some sort]).
    
    
    
    [For the submission element, there is a new method 'xforms-return' that  
    returns the values]
    
    [There is an action <renew control="id"/> that causes the initial values  
    reference to be copied to the embedded instance again]
    
    Examples
    
    <control resource="today.xhtml" label="Today's date:"/>
    
    ---
    today.xhtml:
    
    <output value="now()"/>
    
    ====
    
    <instance id="values">
        <data xmlns="">
           <a>1</a>
           <b>2</b>
           <sum/>
        </data>
    </instance>
    
    ...
    
    <control ref="instance('values')" resource="add.xhtml"  
    initial="instance('values')"/>
    <output ref="sum"/>
    ---
    In the subform
    
    <instance>
        <values xmlns=""/>
    </instance>
    <bind ref="sum" calculate="../a + ../b"/>
    
    <submission method="xforms-return"/>
    
    ====
    
    <instance>
        <data xmlns="">
           <testfile>test.xml</testfile>
        </data>
    </instance
    
    <instance id="results"/>
    ...
    <control ref="instance('results')" resource="{testfile}"/>
    ---
    In test.xml
    
    <instance>
        <data xmlns="">
           <values>...</values>
           <results>
              <percent/>
              <success/>
              <failure/>
        </data>
    </instance
    ...
    <submission ref="results" method="xforms-return"/>
    
    ===
    <instance>
        <testsuite xmlns="">
           <test>
              <filename>boolean-from-string.xml</filename>
              <tests>
                 <test res="" req="true">1</test>
                 <test res="" req="false">0</test>
              </tests>
              <result/>
           </test>
           <test>
              ...
           </test>
        </testsuite>
    </instance>
    
    <repeat ref="testsuite/test">
         <control resource="{filename}" initial="tests" ref="result"/>
    </repeat>
    
    ---
    
    in the subform
    
    <model>
        <instance>
           <tests xmlns=""/>
        </instance>
        <instance id="result">
           <result xmlns="">
              <percent/>
           </result>
        </instance>
        ...
        <submission ref="instance('result')" method="xforms-return"/>
    
    ===
    
    <instance>
        <locations xmlns="">
           <here x="3498234" y="8734503"/>
           <home x="" y=""/>
           <dest x="" y=""/>
        </locations>
    </instance>
    ...
    <control ref="home" resource="map.xf" initial="here" label="Please locate  
    your home location"/>
    <control ref="dest" resource="map.xf" initial="here" label="Please locate  
    your destination"/>
    
    ===
    
    <select1 ref="game" label="select a game to play">
       <item label="minesweeper">minesweeper.xml</item>
       <item label="slider">slider.xml</item>
       <item label="noughts and crosses">xox.xml</item>
    </select1>
    
    <control resource="{game}"/>
    
    ===
    
    

Received on Wednesday, 6 June 2018 10:21:45 UTC