Teaser with model and bind

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Teaser with model and bind

Erik Bruchez
All,

Here is a little puzzle:

http://gist.github.com/401939

What should the output sow, "Joe", or "banana"?

First, is it clear that it is allowed to refer by id to a bind that
does not belong to the current model?

If so, since by specifying @model="model1" we are not actually
changing the model in the sense that there is no ancestor @model
attribute changing the model, should @model="model1" ensure that the
nested xforms:output point to a node in model1 rather than model2?

-Erik

Reply | Threaded
Open this post in threaded view
|

Re: Teaser with model and bind

Alain COUTHURES
Erik,

I tested your teaser (I changed bind/@ref to bind/@nodeset):
  • EMC Formula: "banana"
  • Mozilla extension: "Joe"
  • XSLTForms: nothing
According to XForms 1.1 recommendation,
  • Every XPath expression requires an evaluation context consisting of a node, position, size, variable bindings, function set, and namespace context.
  • if the binding element expresses a model attribute that refers to a model other than the one containing the context node, then the context node of the in-scope evaluation context is changed to be the top-level document element node of the default instance of the referenced model, and the context position and size are changed to 1.
  • [the output Element] cannot bind to element nodes that have element children.
  • If element child nodes are present, then an xforms-binding-exception occurs.
So, my point of view is that an exception should occur and I'm still proud of XSLTForms for not being completely wrong ;-)

It might be easier for developer if context could consist of a node for each model... then "Joe" would be displayed, don't you think?

BTW, is there a price to win? ;-)

-Alain
All,

Here is a little puzzle:

http://gist.github.com/401939

What should the output sow, "Joe", or "banana"?

First, is it clear that it is allowed to refer by id to a bind that
does not belong to the current model?

If so, since by specifying @model="model1" we are not actually
changing the model in the sense that there is no ancestor @model
attribute changing the model, should @model="model1" ensure that the
nested xforms:output point to a node in model1 rather than model2?

-Erik


  

Reply | Threaded
Open this post in threaded view
|

Re: Teaser with model and bind

Aaron Reed
Well stated Alain!  I should point out that Mozilla might say 'joe' but
it is actually throwing errors in the console because we don't support
nested binds.  That part of our processor hasn't been updated for the
1.1 spec.

--Aaron


COUTHURES Alain wrote:

> Erik,
>
> I tested your teaser (I changed bind/@ref to bind/@nodeset):
>
>     * EMC Formula: "banana"
>     * Mozilla extension: "Joe"
>     * XSLTForms: nothing
>
> According to XForms 1.1 recommendation,
>
>     * Every XPath expression requires an evaluation context consisting
>       of a node, position, size, variable bindings, function set, and
>       namespace context.
>     * if the binding element expresses a |model| attribute that refers
>       to a |model| other than the one containing the context node, then
>       the context node of the in-scope evaluation context is changed to
>       be the top-level document element node of the default instance of
>       the referenced |model|, and the context position and size are
>       changed to 1.
>     * [the output Element] cannot bind to element nodes that have
>       element children.
>     * If element child nodes are present, then an
>       |xforms-binding-exception| occurs.
>
> So, my point of view is that an exception should occur and I'm still
> proud of XSLTForms for not being completely wrong ;-)
>
> It might be easier for developer if context could consist of a node for
> each model... then "Joe" would be displayed, don't you think?
>
> BTW, is there a price to win? ;-)
>
> -Alain
>> All,
>>
>> Here is a little puzzle:
>>
>> http://gist.github.com/401939
>>
>> What should the output sow, "Joe", or "banana"?
>>
>> First, is it clear that it is allowed to refer by id to a bind that
>> does not belong to the current model?
>>
>> If so, since by specifying @model="model1" we are not actually
>> changing the model in the sense that there is no ancestor @model
>> attribute changing the model, should @model="model1" ensure that the
>> nested xforms:output point to a node in model1 rather than model2?
>>
>> -Erik
>>
>>
>>
>




Reply | Threaded
Open this post in threaded view
|

Re: Teaser with model and bind

Erik Bruchez
In reply to this post by Alain COUTHURES
Alain & all,

> I tested your teaser (I changed bind/@ref to bind/@nodeset):
>
> EMC Formula: "banana"
> Mozilla extension: "Joe"
> XSLTForms: nothing

Orbeon Forms returns "banana".

> According to XForms 1.1 recommendation,
>
> if the binding element expresses a model attribute that refers to a model
> other than the one containing the context node, then the context node of the
> in-scope evaluation context is changed to be the top-level document element
> node of the default instance of the referenced model, and the context
> position and size are changed to 1.

I think this is the key! Good to point this out.

> [the output Element] cannot bind to element nodes that have element
> children.
> If element child nodes are present, then an xforms-binding-exception occurs.
>
> So, my point of view is that an exception should occur and I'm still proud
> of XSLTForms for not being completely wrong ;-)
>
> It might be easier for developer if context could consist of a node for each
> model... then "Joe" would be displayed, don't you think?

You are right. Although it was not intended in my example that
xforms:output would point to an element containing nested elements!
Here is a version that should produce "Joe":

  http://gist.github.com/404511

> BTW, is there a price to win? ;-)

Unfortunately no price except for the pride of pointing to the right answer ;)

-Erik

>
> -Alain
>
> All,
>
> Here is a little puzzle:
>
> http://gist.github.com/401939
>
> What should the output sow, "Joe", or "banana"?
>
> First, is it clear that it is allowed to refer by id to a bind that
> does not belong to the current model?
>
> If so, since by specifying @model="model1" we are not actually
> changing the model in the sense that there is no ancestor @model
> attribute changing the model, should @model="model1" ensure that the
> nested xforms:output point to a node in model1 rather than model2?
>
> -Erik
>
>
>
>