in-scope evaluation context

One last issue before I send out the agenda.

I spent all of yesterday struggling with the in-scope evaluation context.
https://www.w3.org/community/xformsusers/wiki/XForms_2.0#Maintaining_Position:_the_Focus

A quick summary.

First you find an initial context, that gets used to find the actual  
in-scope evaluation context.

If a binding doesn't have an ancestor binding, then the initial context is  
the
top-level document element node of the default instance of the model that
contains the binding, if any, and otherwise of the default model.

     <model>
          <instance><data><i/></data></instance>
     </model>
     ...
     <input ref="i"/>

If there is an ancestor single-item binding then the initial context size  
and
position are 1 and the context item is the one resulting from the Single
Item Binding.

     <select ref="order" label="Flavors">
       <itemset ref="../flavors/flavor" label"{description}"  
copy="description"/>
     </select>

If there is an ancestor Sequence Binding then the context position is 1,  
and the context size is the size of the sequence and the context item is  
the sequence's first item.

Furthermore an occurrence of the original binding element is generated for  
each of the items in the sequence, with a dynamic in-scope evaluation  
context which has a context size equal to the size of the sequence, the  
context item is the item of the sequence for which the occurrence was  
generated and the position is equal to the position of the generated item  
in the sequence.

     <repeat ref="flavors/flavor"><output ref="description"/></repeat>

Now here comes the funny bit:

Once the initial context has been found, if the binding element has a  
model attribute that refers to a model other than the one containing the  
context item, then the context item 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.

     <select ref="order" label="Flavors">
       <itemset model="flavors" ref="flavor" label"{description}"  
copy="description"/>
     </select>

(and after that @context gets evaluated)

What I don't understand is why the @model treatment happens so late. It  
seems to me that it ought to happen before any of the other stuff. Can  
anyone enlighten me?

Steven

Received on Wednesday, 2 November 2016 09:13:25 UTC