Projects‎ > ‎

Project - An XForms Engine Dependency System for Orbeon Forms

STATUS: as of 2010-10, a partial implementation of XPath dependencies in the UI and in the model is in place in the XForms engine. This is not considered fully stable yet but it's getting there.

XML in XForms

XML and XPath play a big role in XForms:
  • The XForms markup (e.g. <xforms:input>, etc.) is defined as a set of XML elements and attributes (although that could be serialized as HTML as well).
  • The data model is expressed as a set of XML documents (instances), onto which bindings (with <xforms:bind>) can be applied to control various properties (read-only, calculations, etc.).
  • Controls (input fields, menus, etc.) are attached (bound) to the data model using XPath.
There are places wIthin an XForms implementation (also known as an XForms engine or XForms processor) where handling dependencies is desired:
  • To update the model, e.g. following the standard XForms recalculation algorithm.
  • To update the controls upon UI refresh with xforms-refresh.
By dependencies, we mean that a set of XPath expressions express relationships between nodes in XML documents and properties or user interface controls.

The XForms recalculation algorithm

XForms defines a recalculation algorithm for the data model, which provides the following benefits:
  • It reduces the number of operations needed when data in the model changes.
  • It provides an evaluation order for the evaluation of properties.
As of 2010-10, Orbeon Forms does not implement this recalculation algorithm, for a couple of reasons:
  • Most applications built with Orbeon Forms have not needed this feature yet.
  • We don't like that the algorithm requires dynamic analysis of the XPath expressions rather than simple static analysis.
In this project, we would like to implement a static analysis version of the XForms dependency algorithm based on document projection:
  • Evaluate whether this new approach makes sense.
  • Reformulate the XForms recalculation algorithm in terms of document projection.
  • Implement the algorithm and all the required support in Orbeon Forms.
  • Produce a clear list of pros and cons of the standard XForms approach vs. the new static approach.
  • Build unit tests and examples showing that the algorithm and implementation work as expected.
  • Make performance measurements.
  • Send a proposal to the Forms Working Group at W3C to consider the updated algorithm.

XForms UI dependencies

In XForms, the view, consisting of UI controls, is dynamically bound to data (in the model) using XPath expressions.

XForms doesn't specify exactly how UI controls reevaluate their bindings to the data model upon UI refresh. Instead, the specification says that "The user interface reflects the state of the model".

However, in practice, refreshing the entire user interface becomes costly for large forms. Here too a dependency system should go a long way towards increasing performance. In this project, we would like to achieve the following:
  • Identify use cases where dependencies are needed.
  • Implement support for the dependencies.
  • Make performance measurements.

Implementation notes

References

  1. Orbeon Forms implements XForms 1.1
  2. Orbeon Forms uses the open source Saxon XSLT and XQuery Processor
  3. Mike Kay, author of Saxon, provides initial references on Document Projection in Saxon
  4. Mike Kay also wrote a related paper called Ten Reasons why Saxon XQuery is Fast