W3C home > Mailing lists > Public > public-forms@w3.org > February 2008

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

From: John Boyer <boyerj@ca.ibm.com>
Date: Wed, 13 Feb 2008 11:30:09 -0800
To: Erik Bruchez <ebruchez@orbeon.com>
Cc: "public-forms (new)" <public-forms@w3.org>, public-forms-request@w3.org
Message-ID: <OF3423F3DD.F096BE66-ON882573EE.006A789B-882573EE.006B2118@ca.ibm.com>
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.

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: 

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

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

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


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.


Orbeon Forms - Web Forms for the Enterprise Done the Right Way
Received on Wednesday, 13 February 2008 19:30:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:48:28 UTC