W3C home > Mailing lists > Public > www-forms@w3.org > December 2002

evaluation context contradiction

From: Paul Butcher <Paul.Butcher@x-port.net>
Date: Tue, 3 Dec 2002 16:00:55 -0000
Message-ID: <E3ED00A7C285EE408679DE2A26D1C781320528@S007.x-port.net>
To: "'www-forms@w3.org'" <www-forms@w3.org>

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 Tuesday, 3 December 2002 11:13:50 GMT

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