Is there any XForms object which I could use to override default evaluation context inside an action object? We have xforms:group in body part but do we have any in xforms:action? It would simplify code where I often use the same Nodeset as a base element I’m operating on
I would like to receive such code:
<xf:action ev:event="DOMActivate">
<?xf:context? ref="instance('main')/d:Content/d:Attachment[index('repeat-id')]"> <!-- ?? -->
<xf:setvalue ref="d:FileName" value="..." />
<xf:setvalue ref="d:Description" value="..." />
<xf:setvalue ref="d:MimeType" value="..." />
<xf:setvalue ref="d:Size" value="..." />
<xf:setvalue ref="d:Location" value="..." />
</?xf:context?>
</xf:action>
so I wouldn’t have to repeat the whole path all over again.
The attribute you are looking for is
context. As of XForms 1.1, thecontextattribute is only available officially on theinsertanddeleteactions, but some implementations already support it on all actions, and it is scheduled for inclusion in XForms 2.Note that
refis, as far as I know, not officially allowed onaction.There is a difference between
refandcontextas planned for the upcoming XForms 2:contextonly changes the XPath evaluation contextrefusually has other effects, such as binding a control, or specifying the destination of a value (setvalue), etc.In XForms 1.1,
contextoninsertunfortunately also can indicate the insertion point, but XForms 2 plans to improve on that and deprecate that use ofcontext.