Re: XForms 1.1 context() function and (xforms:insert|xforms:delete)/@context attribute

Hi Erik,

The context attribute is defined to adjust the in-scope evaluation context 
for an element.  It is a way to explicitly declare the in-scope evaluation 
context node.

I think it will be even easier once the context attribute becomes a 
general attribute rather than a special attribute of insert and delete.

The main use of context() is to override the default context node provided 
to attributes evaluated after a single node binding or nodeset binding, 
but regardless of where it is invoked, it should return the node provided 
by the context attribute if explicitly declared or its default otherwise 
(which is another way of saying that context() returns the in-scope 
evaluation context node).

Your example:

   <xforms:insert context="instance('foo')" nodeset="context()/bar"/>

is perfect as it is clear that context() should return the same node as 
instance('foo') because that is the in-scope evaluation context set by the 
context attribute.

Cheers,
John M. Boyer, Ph.D.
Senior Technical Staff Member
Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw





Erik Bruchez <ebruchez@orbeon.com> 
Sent by: public-forms-request@w3.org
02/13/2008 10:56 AM

To
"public-forms (new)" <public-forms@w3.org>
cc

Subject
XForms 1.1 context() function and (xforms:insert|xforms:delete)/@context 
attribute







All,

Section "7.10.4 The context() Function", says:

   "This function returns the in-scope evaluation context node of the
    nearest ancestor element of the node containing the XPath
    expression that invokes this function."

I am wondering whether this was written with the @context attribute on
xforms:insert and xforms:delete in mind. Say you have:

   <xforms:insert context="instance('foo')" nodeset="context()/bar"/>

I am not sure my example is very useful, but still, what should
context() return in this case?

It seems reasonable to suppose that given its name, context() returns,
well, the context, whether in-scope or overridden. In this case,
context() would return the node pointed to by instance('foo'), not the
in-scope context for the xforms:insert action.

I am not sure that saying that context() always returns the in-scope
context would be very intuitive when you use a @context attribute.

This is important to consider since we might generalize use of the
@context attribute in 1.2.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/

Received on Wednesday, 13 February 2008 19:30:44 UTC