Re: evaluation context contradiction

Greetings Paul, your are correct in your observation that there is a 
contradiction regarding evaluation context. You are also correct to assume 
that (a) is the correct definition. We'll change the spec to correct this. 


Regards, Roland




Paul Butcher <Paul.Butcher@x-port.net>
Sent by: www-forms-request@w3.org
03/12/2002 16:00

 
        To:     "'www-forms@w3.org'" <www-forms@w3.org>
        cc: 
        Subject:        evaluation context contradiction

 



There seems to be a contradiction in the current XForms spec regarding the
evaluation context for XPath expressions in model item properties. 
Consider
the following two excerpts:

(a) http://www.w3.org/TR/2002/CR-xforms-20021112/slice4.html#evt-recalculate

states:
When it is time to recalculate a compute, the XPath expression is 
evaluated
in the context of the instance node whose value or model item property is
associated with the compute.

(b) http://www.w3.org/TR/2002/CR-xforms-20021112/slice7.html#expr-eval
Point 4 states:
The context node for computed expressions (occurring on element bind) is
the first node of the node-set returned from the binding expression in the
nodeset attribute on the same element.

Both of the rules define different context nodes for the evaluation of 
XPath
in model item property attributes.

The problem:

Given the following model definition:
<xf:model id="m1">
<xf:instance>
<x>
<y>a very, very long string indeed</y>
<y>short string</y>
</x>
</xf:instance>
<xf:bind nodeset="y" constraint="string-length(.) &lt; 15" />
</xf:model>

And the following two elements:

<xf:output model="m1" ref="y[1]" id="o1" />
<xf:output model="m1" ref="y[2]" id="o2" />

If the rule at (a) above is applied, both outputs would be marked as 
invalid
at the start, until the content of the first <y> element is sufficiently
shortened.

If the rule at (b) above is applied, then output "o1" would be marked as
invalid, and the output "o2" valid.

If they are both correct, then both outputs would be marked as invalid 
until
a recalculate is forced, at which point the output "o2" would become 
valid.
However, since "xforms-recalculate" occurs during 
"xforms-model-initialize"
processing, the rule at (b) is redundant, because there is no situation in
which a computed expression is evaluated outside the processing of
"xforms-recalculate"

For the next version of Formsplayer, we have assumed that (a) is the 
correct
behaviour, that the context node for model item properties is the node 
with
which the property is associated.


Paul Butcher
FormsPlayer Lead Programmer
x-port.net Ltd.
4 Pear Tree Court
London
EC1R 0DS

Try our XForms plug-in for IE
at http://www.FormsPlayer.com/

Received on Wednesday, 11 December 2002 10:20:18 UTC