Want context on action element to set the context used for all actions within.
Want context on group element to set context for contained UI controls without inheriting MIPS.
Want context on bind to override context for MIP formulae without overriding node to which the MIP attaches.
Seems reasonable, then, to add context to the Single Node Binding and Node Set Binding attribute bundles, as well as action, bind, etc. Pretty much any xforms element except instance and model.
Need to amend sections that define single node and nodeset bindings, the evaluation context section, the insert and delete actions (because context will no longer be a special attribute), and other elements that receive only context.
The context attribute should override the in-scope evaluation context, including reset of position and size to 1. First node rule applies.
The initial inscope evaluation context is the context node inherited from the containing element before evaluating the context attribute, if it appears. The inscope evaluation context is equal to the initial inscope evaluation context if the context attribute is omitted. Otherwise, the context attribute is evaluated using the initial inscope evaluation context, and the first node of the result provides the inscope evaluation context for the element, and the position and size of the context become equal to 1.
If a bind element has no nodeset attribute, then MIPs attach to the initial inscope evaluation context node, regardless of whether or not the context attribute is specifed. This allows the context attribute to override the evaluation context of the MIP attribute without affecting the node to which the MIP attaches. The following:
<bind nodeset="C" calculate="../A * ../B"/>
is equivalent to
<bind nodeset="C"> <bind context=".." calculate="A * B"/> </bind>
See also MIP_Names,_Types,_Etc. for a proposed improvement to the naming of the above inner bind element.
Need for alternative context function with setvalue
The following example is not the correct use of @context:
<!-- this does not work --> <setvalue ev:event="DOMActivate" context="." ref="instance('home')/hang/your/hat" value="name" />
The context attribute allows override of the in-scope evaluation context of the element containing the context attribute, and so it sets the context for the ref of the setvalue, and that context node is then in scope for the evaluation of @value.
In this case, the the XForms 1.1 function context() should be used.
<!-- this does work and does not need XForms 1.2 features --> <setvalue ev:event="DOMActivate" ref="instance('home')/hang/your/hat" value="context()/name" />