W3C home > Mailing lists > Public > www-forms-editor@w3.org > February 2003

Rules for evaluation context

From: Michael N. Lipp <mnl@mnl.de>
Date: Sun, 09 Feb 2003 22:10:38 +0100
Message-ID: <3E46C3CE.90202@mnl.de>
To: www-forms-editor@w3.org


Trying to implement the calculation of the evaluation context
(7.3 from the spec). I have run into the following problem: let's assume
I have a model with id="M1" (and the sample instance from 7.3 of the
spec) and another model with id="M2" (with instance data <root
xyz="5"/>). Now how do I resolve this:

<group ref="level2/level3" model="M1">
    <select1 ref="/root/@xyz" model="M2"/>

I would expect the reference for select1 to be resolved to "5". But if I
apply the rules from 7.3, I find the following:

(1) <select1 ref="/root/@xyz" model="M2"/> is not an outermost binding

(2) So rule 2. from 7.3 applies: "The context node for non-outermost
binding elements is the first node of the binding expression of the
immediately enclosing element."

(3) So, my context node is "level3" from model "M1".

(4) Applying the xpath expression "/root/@xyz" to this results (at best)
in something empty.

(5) Have I forgotten to apply rule 3. from 7.3? Maybe. "The context node
[even of my non-outermost binding element] resides within the context
model, which is determined choosing the first item that applies from
this list: a. if a model attribute is present on the binding element,
the attribute determines the context model...". OK but how does it help?
It is obviously not true for the result returned in (3). Is the above
example illegal?

(6) Does rule 3. from 7.3 have a kind of precedence? I.e. should I
evaluate "level2/level3" using model "M2"? This contradicts rule 2. from
7.3 because is states that "The context node for non-outermost binding
elements is the first node of the binding expression of the immediately
enclosing element.". The "binding expression" of the group element,
however, is obviously "level3" from model "M1".

(7) Should I assume that a rule is missing: "A non-relative path in
"ref" binds the context node to the first node returned from applying
the path to the instance data of the context model". I wouldn't like
this. First, it is not easy to be sure that a path is non-relative:
"node1/node2/instance('I2')/root" is (though silly) absolute but it does
not look like it. Second, I would expect "<select1 ref="@xyz"
model="M2"/> to return "5" in the example above as well (though I'd also
accept this to be defined as an illegal selection -- note, however, that
it is not illegal based on the current rules).

(8) Should I assume that the "immediately enclosing element" should be
defined like this: "An element is 'immediately enclosing' when it is the
first binding element node THAT HAS THE SAME CONTEXT MODEL AS THE
NON-OUTERMOST BINDING ELEMENT in the node-set returned by the XPath
expression ancestor::*.". I'd prefer this, because it is easy to
implement ;-) and I think matches intuitive expectations.

(9) Have I totally misunderstood something?

   - Michael
Received on Sunday, 9 February 2003 16:06:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:38:07 UTC