Subform mechanism implementation in XSLTForms


Please find below some explanations about how a subform mechanism is 
currently supported in XSLTForms:

In XSLTForms, a subform is a form which could be eventually loaded in a 
stand-alone way.

It contains a model part and a body part. Only HTML is currently 
supported as host language, so the subform body is defined as the HTML 
body inner content.

When loaded from a main form, the model part of the subform is added to 
the model part of the main form. Conflicting ids in models are merged by 
XSLTForms: instances, submissions and bindings are added into the 
corresponding model of the main form. Conflicting ids in instances, 
submissions and bindings are supported by ignoring the conflicting 
elements in the subform.

For management reasons, models and instances without an associated id 
are assigned generated work ids. Currently, XSLTForms always generates 
the same work id whether defined in the main form or in the subform. In 
the future, this might be considered as an option to generate different 
work ids for them.

When loaded, the subform body replaces the inner content of the target 
element. There is no implicit scoping change so the bindings in the 
subform body now depend on the current context of the target element. 
The author has to explicitly force the subform context with an extra 
group control, for example.

A subform can load subforms itself.

When a subform is unloaded, all the elements added to the main form are 
removed as if it had not been loaded at all.

Currently, the xforms-model-construct and xforms-model-construct-done 
are the only events which are dispatched. More events should be 
considered such as xforms-subform-load, xforms-subform-load-done, 
xforms-subform-unload and xforms-subform-unload-done.

XSLTForms uses a unique XForms engine instance to manage subforms. No 
extra mechanism is required to allow communication between main form and 
subforms. Such a mechanism has been implemented in XSLTForms for 
load/@show="new": the new form can interact with the initial form using 
instance/@src and submissions with the resource starting with 
"opener://" followed by the instance id, the calling form been 
considered as a server for the new form.


Alain Couthures

Received on Wednesday, 27 June 2012 11:52:07 UTC