Define the 'stable' execution scope for xpath functions

In XPath a number of functions specified in Functions and Operators[1] are defined to be stable, meaning that if they are called twice during the same execution scope, with the same arguments, then they return the same results. By implication, the components of the dynamic context on which these functions depend are also stable. Specifically, the following components defined in the section Dynamic Context must be stable: function implementations, current dateTime, implicit timezone, available documents, available collections, and default collection.

Currently we do not specify how long those components are stable.

To get interoperable XForms implementations we have to define what we consider the  'stable' execution scope. We can't use the complete lifetime of a form (as in XSLT) because otherwise you would never be able to write a clock UI, record the time it took to do something, get an updated version of a document using the doc() function, …

* In UI controls it makes sense to define xforms-refresh event as the boundary for the 'stable' execution scope for xpath functions.
* In actions it makes sense to define the execution of the outermost action handler as the boundary for the 'stable' execution scope for xpath functions.
** what about explicit rebuild, revalidate and recalculate actions?
* In bindings (ref, MIPS, calculate) we probably also want to use the execution of the outermost action handler as the boundary for the 'stable' execution scope for xpath functions.

I've made a sample form to test current behaviour https://gist.github.com/4124498 or [2] for the raw file

I took the liberty to test the form on the Orbeon XForms engine and got the following results:
* UI controls get updated on recalculate and rebuild
* Actions when the action runs (I'm not testing the nesting of action handlers)
* Calculates on recalculate
* required never

Steven tested to for on XSLTForms:
* Actions when the action runs (I'm not testing the nesting of action handlers)
* We couldn't test the rest because the rebuild, revalidate and recalculate actions didn't seem to work

Could other implementers give their current behaviour and the behaviour they think it should be? Comments of form authors is also very welcome, because they probably have a lot of different use-cases where they use these xpath functions.


Kind regards,

Nick Van den Bleeken
R&D Manager

Phone: +32 3 425 41 02
Office fax: +32 3 821 01 71
nick.van.den.bleeken@inventivegroup.com
www.inventivedesigners.com

1: http://www.w3.org/TR/xpath-functions/
2: https://raw.github.com/gist/4124498/4bc3bb9c6f596b9ab34ef816338cd776a7de3153/xpath-stable-scope-test.xhtml


________________________________

Inventive Designers' Email Disclaimer:
http://www.inventivedesigners.com/email-disclaimer

Received on Wednesday, 21 November 2012 12:08:23 UTC