Wiki

Clone wiki

javarosa / XFormDeviations

Deviations from the XForms spec

This page contains discrete deviations from the specifications of XForms and the XPath language. It also provides an impression of whether the deviation is intentional or incidental, and what the long-term plan for the deviation is.

Since re-engineering forms around spec changes is a difficult process, changes will be pushed as-many-at-once as possible.

XPathPath to a single nodeset evaluates to false

In Spec: boolean(/path/to/node) which refers to an existing, single node which is empty, should evaluate to true

In JavaRosa: boolean(/path/to/node) which refers to an existing, single node which is empty, evaluates to false

This is unintentional, and related to the initial weak handling of nodesets (the existing behavior is that boolean() is simply being evaluated against the value ''. This will hopefully be fixed in an upcoming release, but will be rolled out slowly to allow people to change any relevant expressions in their xforms.

In Spec: XPath functions such as now() should return the date/time in UTC, with the ISO appropriate "Z" at the end to reflect the timezone.

In JavaRosa: XPath functions are all evaluated and returned in the local time.

This behavior was an early limitation of the system, and will require a lot of support code to fix, since users generally expect to be able to use now() for computations such as determining whether an input is valid based on a set date, in which case this behavior may be confusing. This will be fixed as soon as helper functions (like local-time()) can be made available.

Model Item Property XPaths are always Evaluated In the Context of the nodeset

In Spec: In model item properties (calculate, relevant, etc), XPaths should be evaluated relative to the nodeset provided, but absolute paths (/data/path/to/node) should be evaluated without the position as the context

In JavaRosa: Absolute paths /data/path/to/node are always evaluated as if any components which are shared with the nodeset /data/path/to/other were being evaluated relative to the current nodeset. In this example, if to was the target of a <repeat> the absolute path would refer to ../node rather than the full nodeset of all nodes referenced by /data/path/to/node.

This is a limitation that was present in early versions of the code and breaks backwards compatibility for many forms with repeats. It will be fixed in an upcoming version.

position() function is implemented incorrectly

In Spec: position() is 1-indexed

In JavaRosa: position() is 0-indexed

This was an implementation oversight and will be addressed ASAP.

Updated