- From: Erik Bruchez <ebruchez@orbeon.com>
- Date: Mon, 24 Jul 2006 16:18:14 +0200
- To: www-forms@w3.org
Aaron Reed wrote:
>
> 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?
Yes, I think this has been clarified a little in the latest internal
drafts. The idea is that @context evaluates as you expect, i.e. in the
context of the action element, and then @context actually _replaces_ the
context for that action element, which means that @nodeset and @origin
evaluate now within the context created by @context.
There is a thought of extending the use of @context to all action
elements, but this probably won't make it into 1.1, so for now @context
is usable only on xforms:insert and xforms:delete.
>
> 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 chardescription>
> </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?
Note that you have two errors in your code above. Replace:
<xf:group ref="instance('instance1')/instanceData">
with:
<xf:group ref="instance('instance1')">
You are also missing an ev:event attribute on your action:
<xforms:insert ev:event="DOMActivate" ...
With these changes, you result will be exactly as you say, and it works
exactly like that in Orbeon PresentationServer.
-Erik
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/
Received on Monday, 24 July 2006 14:18:25 UTC