W3C home > Mailing lists > Public > public-forms@w3.org > December 2007

Re: Wrong XPath expression in Iterate example of XForms 1.1 CR

From: John Boyer <boyerj@ca.ibm.com>
Date: Fri, 14 Dec 2007 10:25:30 -0800
To: Nick_Van_den_Bleeken@inventivegroup.com
Cc: public-xforms@w3.org, www-forms-editor@w3.org
Message-ID: <OF5E09D831.C907CB03-ON882573B1.00647735-882573B1.006535D7@ca.ibm.com>
Hi Nick,

The 'if' and 'while' attributes use the in-scope evaluation context before 
the action is executed, so they are not subject to the result of a ref or 
nodeset on the action.

This is the same context used to evaluate the context attribute on 

For this reason, the 'if' expression in the example you cited is actually 
correct.  In fact, the example is written this way exactly to highlight 
the difference.

The context coming into the setvalue is the 'default' instance.  The bulk 
of the action script does work in a 'temp' instance.  In the setvalue you 
cited, the one which adds to the accumulator, the 'value' attribute must 
directly reference the default instance because its evaluation context 
comes from the ref attribute, which refers to a node in the temp instance. 
 But the 'if' attribute is evaluated before the 'ref' so it uses the 
in-scope evaluation context, which is the default instance in this 

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: 

Sent by: www-forms-editor-request@w3.org
12/14/2007 07:02 AM

public-xforms@w3.org, www-forms-editor@w3.org

Wrong XPath expression in Iterate example of XForms 1.1 CR


Can it be that the 'if' XPath expression of the 3th setvalue in the '
Summing Selected Results'  sample [1] is missing an explicit reference to 
the default instance? 

  <label>Get Sum</label>
  <action ev:event="DOMActivate">
     <setvalue ref="instance('temps')/counter" value="1"/>
     <setvalue ref="instance('temps')/accumulator" value="0"/>
     <action while="instance('temps')/counter <= count(/some/nodes)">
        <setvalue ref="instance('temps')/accumulator" 
                  value=". + 
        <setvalue ref="instance('temps')/counter" value=". + 1"/>

The ref of the 3th setvalue changes the instance of the in-scope 
evaluation context to instance 'temps'. 
But the '/some/nodes' are in the 'default' instance (see value of the 
-> we should change 'boolean-from-string(/some/nodes' to 


Nick Van den Bleeken  -  Research & Development Manager
Inventive Designers
Phone: +32 - 3 - 8210170
Fax: +32 - 3 - 8210171
Email: Nick_Van_den_Bleeken@inventivegroup.com 

1: http://www.w3.org/TR/xforms11/#action-iterated
Inventive Designers' Email Disclaimer:
Received on Friday, 14 December 2007 18:25:49 UTC

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