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

Re: xforms 1.1 xf:insert examples

From: Aaron Reed <aaronr@us.ibm.com>
Date: Tue, 25 Jul 2006 11:58:57 -0500
To: www-forms@w3.org
Message-ID: <ea5ikm$8nq$1@sea.gmane.org>

Hi Erik,

Thanks for replying.  Please see below.

Erik Bruchez wrote:
> 
> Aaron,
>  > I've got a follow-up question.  Since it seems I have a decent grip on
>  > how things should work, I was wondering what happens not only of the
>  > nodeset is empty, but what if the parent node of the nodeset doesn't 
> exist.
>  >
>  > Assume that I have this in my form:
>  >
>  > <xf:instance id="instance1" xmlns="">
>  >   <instanceData>
>  >     <muppets/>
>  >   </instanceData>
>  > </xf:instance>
>  > <xf:instance id="template">
>  >   <templates>
>  >     <name>beginner muppet</name>
>  >   </templates>
>  > </xf:instance>
>  > ....
>  > <xf:group ref="instance('instance1')">
>  >   <xf:trigger ref="muppets">
>  >     <xf:label>trigger label</xf:label>
>  >     <xf:insert nodeset="muppet/name" 
> origin="instance('template')/name"/>
>  >   </xf:trigger>
>  > </xf:group>
>  >
>  > You can see that there is no muppets/muppet directory, so where does the
>  > clone of instance('template')/name get put?
>  > 1)Does it go underneath the insert context node?  In this case would it
>  > get put under muppets?
> 
> With your code above, neither this...
> 
>  > 2) Or does the processor create a muppet directory and then insert name
>  > underneath it?
> 
> ...nor that ;-) With your code, the operation just doesn't do
> anything, because the insert nodeset is empty and you do not specify
> an insertion context with the @context attribute.
> 

Are you sure?  Can you show me in the spec where this rule comes from 
because I'm missing it when I look.  And if this is what the behavior is 
supposed to be then I suggest a change in the spec because it isn't 
apparent to me.

When I read the spec, I see under the description for @context, "If the 
context attribute is not given, then the default insert context is the 
in-scope evaluation context".  In my example, this would be 
instanceData/muppets, right?  And then where the spec talks about the 
target location it says, "If the Node Set Binding node-set is empty, 
then the target location is before the first child or attribute of the 
insert context node, based on the node type of the cloned node."  This 
makes me think that it'll get inserted into there and become 
instanceData/muppets/name even if I don't specify @context.

Thanks for helping me out,
--Aaron
Received on Tuesday, 25 July 2006 17:03:24 GMT

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