W3C home > Mailing lists > Public > www-forms@w3.org > May 2006

Re: Actions changing the XPath context

From: John Boyer <boyerj@ca.ibm.com>
Date: Thu, 25 May 2006 22:56:55 -0700
To: Erik Bruchez <ebruchez@orbeon.com>
Cc: "'www-forms'" <www-forms@w3.org>, www-forms-request@w3.org
Message-ID: <OFFC5E260E.E6987624-ON8825717A.001F23F3-8825717A.0020ACF6@ca.ibm.com>
Hi Eric,

In the specific case you provided of a pair of setvalue actions, I believe 
convincing case exists in favor of your expected behavior.

It is true that the first setvalue makes a change that *would* affect the 
node binding of the group, except it is clear based on the deferred update
behavior of XForms actions that the single node bindings are not updated
immediately after the first setvalue.

The group's single node binding is updated during the xforms-refresh, 
occurs in deferred update after the second setvalue.

On the one hand, you could just modify your question by putting an 
refresh action between the two setvalue actions.  But the more important 
use case that you actually articulated should work.

Moreover, the above variation is akin to your question at the end about 
happens if the context node were actually destroyed by a delete. Moreover, 

this is equivalent to the "Context consuming actions" question I posted to 
working group:


This was before we switched to the public list.  Anyway, it's winding its 
up the discussion agenda and will likely have an answer in the next four 

For what it's worth, I believe that the spec does not define an exception 
for the
inability to evaluate a binding expression due to lack of context node, so 
it is
reasonable to assume that no exception should occur.  It also seems 
to conclude that the result is, degenerately, an empty nodeset.  This in 
turn would 
mean that such actions should simply no-op silently.

Best regards,
John M. Boyer, Ph.D.
Senior Product Architect/Research Scientist
Co-Chair, W3C XForms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com  http://www.ibm.com/software/

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer

Erik Bruchez <ebruchez@orbeon.com> 
Sent by: www-forms-request@w3.org
05/25/2006 01:37 PM

"'www-forms'" <www-forms@w3.org>

Actions changing the XPath context


Consider the following simple example:

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
         <xforms:group ref=".[sort-by != 'capital']">
                 <xforms:action ev:event="DOMActivate">

When loading up this example, the button should appear. When you
activate it, the two xforms:setvalue actions will be run in order.

However, right after the first action has been executed, if you were
to evaluate the xforms:group single-node binding, it would now return
an empty node-set. This means that the context for the evaluation of
the second xfomrs:setvalue is now empty, and you will either get an
error or the action will do nothing. This may or may not achieve what
the form author initially intended (in this case, it didn't).

Note that the single-node binding expression ".[sort-by != 'capital']"
may be be considered unususal, but it is a very convenient way of of
hiding and showing controls and groups.

My questions are:

1. Is this meant to work? I not, I believe it should ;-)

2. Does XForms 1.0, explicitly or implicitly specify when the
    xforms:group's single-node binding is evaluated, i.e. is it allowed
    to re-evaluate it after the first xforms:setvalue?

3. What would happen if instead of using xforms:setvalue, I was to use
    xforms:delete in the action to delete the node to which an
    enclosing xforms:group is bound?

    <xforms:delete nodeset="sort-by" at="1"/>


Orbeon - XForms Everywhere:
Received on Friday, 26 May 2006 05:57:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:17 UTC