Eval function

From W3C XForms Group Wiki (Public)

Eval() function

Need an XPath function eval().

One simple use case is to allow a form author to define an expression to be used in comparison. For example, an action sequence that performs a sort operation could use an eval function on an expression provided by the caller of the sort, allowing the caller to indicate the key(s) for the elements being sorted.

Another use case is to allow a repeat to be used to drill into deeply nested structures one layer at a time. The location path of a current node is managed, and the repeat presents the children and attributes nodes of that node. An input is presented for each leaf node, and an "Expand" trigger is presented for each internal node. Activating the Expand trigger results in concatenation of the node's name to the location path, which causes the repeat to update to present the node's children. Separately, a "Parent" trigger is presented outside the repeat, and activating it removes one level from the location path.

Erik's note: Saxon has a saxon:evaluate() function: http://www.saxonica.com/documentation9.1/extensions/functions/evaluate.html

John's note: Rather than extra params for variables, we should inherit variables from context and instead give a context expression as an optional second param. For details, see http://lists.w3.org/Archives/Public/public-forms/2011Oct/0008.html

Leigh's note: Keep both as different functions.