W3C home > Mailing lists > Public > www-forms@w3.org > July 2006

xforms 1.1 xf:insert examples

From: Aaron Reed <aaronr@us.ibm.com>
Date: Wed, 19 Jul 2006 18:59:37 -0500
To: www-forms@w3.org
Message-ID: <e9mh92$jvc$1@sea.gmane.org>

Hi,

As a suggestion for the XForms 1.1 spec, for the section on the insert 
action, I'd suggest a few more 'after' examples.  We can see the 
'before' instance data, but we don't see the 'after' instance data after 
the action has occurred.

Also, it is not immediately apparent to me after reading this section 
and the examples what the context node is for evaluating @nodeset.  It 
should be the context node of the insert action UNLESS @context is there 
and then it is relevant to that node?  Do I have that right?  And the 
context node for @context, is the context node for the insert action?

so for:

<xf:model id="mymodel">
   <xf:instance id="instance0" xmlns="">
     ...
   </xf:instance>
   <xf:instance id="instance1" xmlns="">
     <instanceData>
       <muppets>
         <muppet>
           <name>Kermit the Frog</name>
           <description>stage manager</description>
           <description>frog</description>
         </muppet>
         <muppet>
           <name>Swedish Chef</name>
           <description>Swedish</description>
           <description>chef</description>
           <description>wears a hat</description>
         </muppet>
         <muppet>
           <name>Animal</name>
         </muppet>
       </muppets>
     </instanceData>
   </xf:instance>
   <xf:instance id="template">
     <templates>
       <description>main character</description>
       <description>secondary character</description>
     </templates>
   </xf:instance>
</xf:model>

....

<xf:group ref="instance('instance1')/instanceData">
   <xf:trigger ref="muppets/muppet">
     <xf:label>trigger label</xf:label>
     <xf:insert context="../muppet[2]" nodeset="description[3]" 
origin="instance('template')/description[2]" position="before"/>
   </xf:trigger>
</xf:group>

Would activating this trigger leave us with this?

   <xf:instance id="instance1" xmlns="">
     <instanceData>
       <muppets>
         <muppet>
           <name>Kermit the Frog</name>
           <description>stage manager</description>
           <description>frog</description>
         </muppet>
         <muppet>
           <name>Swedish Chef</name>
           <description>Swedish</description>
           <description>chef</description>
***       <description>secondary character</description> ***
           <description>wears a hat</description>
         </muppet>
         <muppet>
           <name>Animal</name>
         </muppet>
       </muppets>
     </instanceData>
   </xf:instance>

If I my understanding about evaluation contexts is wrong above, then 
what would happen?

Thanks,
--Aaron
Received on Thursday, 20 July 2006 00:05:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:05 GMT