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

Re: Actions changing the XPath context

From: David Landwehr <david.landwehr@solidapp.com>
Date: Fri, 26 May 2006 08:39:42 +0200
Message-ID: <4476A2AE.4050609@solidapp.com>
To: Erik Bruchez <ebruchez@orbeon.com>
Cc: 'www-forms' <www-forms@w3.org>

Hi Erik

John Boyer asked this question a while back:
http://lists.w3.org/Archives/Public/www-forms/2006Apr/0000.html

Best regards,
David

Erik Bruchez wrote:
>
> All,
>
> Consider the following simple example:
>
> <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
>             xmlns:xforms="http://www.w3.org/2002/xforms"
>             xmlns:ev="http://www.w3.org/2001/xml-events">
>     <xhtml:head>
>         <xforms:model>
>             <xforms:instance>
>                 <instance>
>                     <sort-by>name</sort-by>
>                     <sort-order>ascending</sort-order>
>                 </instance>
>             </xforms:instance>
>         </xforms:model>
>     </xhtml:head>
>     <xhtml:body>
>         <xforms:group ref=".[sort-by != 'capital']">
>             <xforms:trigger>
>                 <xforms:label>Change</xforms:label>
>                 <xforms:action ev:event="DOMActivate">
>                     <xforms:setvalue 
> ref="sort-by">capital</xforms:setvalue>
>                     <xforms:setvalue 
> ref="sort-order">ascending</xforms:setvalue>
>                 </xforms:action>
>             </xforms:trigger>
>         </xforms:group>
>     </xhtml:body>
> </xhtml:html>
>
> 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"/>
>
> -Erik
>


-- 
--------------------------------------------
David Landwehr (david.landwehr@solidapp.com)
Chief Executive Officer, SolidApp
Web: http://www.solidapp.com
Office: +45 48268212
Mobile: +45 24275518
--------------------------------------------
Received on Friday, 26 May 2006 06:39:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:04 GMT