Re: xforms 1.1 xf:insert examples

Aaron Reed wrote:

 >> 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?

Fairly sure, yes.

 > Can you show me in the spec where this rule comes from because I'm
 > missing it when I look.

Here it is:

  "The insert action is terminated with no effect if the insert context
   is the empty node-set or if the context attribute is not given and
   the Node Set Binding node-set is empty."

In other words:

   <xforms:insert context="my-element" nodeset="...">

is not equivalent to:

   <xforms:group ref="my-element">
     <xforms:insert nodeset="..."><!-- no @context attribute -->

One reason for this, I assume, is to keep xforms:insert compatible
with 1.0, where the second example just above would simply no-op.

 > 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.

Let's not go too fast ;-) The behavior as described makes sense to me,
but your feedback is welcome. Could you explain what you don't like
with this behavior?

 > 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?

Correct.

 > 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.

Right, but you missed the conditions for the termination of
xforms:insert, and those have precedence.

-Erik

-- 
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/

Received on Tuesday, 25 July 2006 18:22:49 UTC