Multiple xforms:instance elements vs. relevant="false()"

Hello,

I have a scenario where there is a source document (model) and a
rendering (view). I generate an XForm that allows me to both edit the
values of attributes in the source document and see values of attributes
generated in the view. For example, I may define an object in the source
but it has properties that are computed by the viewer.

Notes: 

a) Source and view properties are mutually exclusive.
b) View properties are regarded as read-only.


In these types of situation I see two possible options:



1) Multiple instances.
----------------------

Create a 'model' xforms:instance and a 'view' xforms:instance in the
same xforms:model. The xforms:bind elements reference the two instances
using the instance(xs:IDREF) function. I believe I'm right in assuming
that I would use the instance() function on the xforms:submission
element's ref attribute to indicate which instance to use (unless the
'model' instance is the first within the xforms:model and therefore the
default instance for submission).



2) relevant = "false()"
-----------------------

Merge the view properties with those of the source element (see note 'a'
above) in a single xforms:instance and then upon their respective
bindings set the 'view' properties to relevant="false()". In this case,
when the form is submitted, I believe the irrelevant nodes will be
removed from the instance that is submitted. All bindings will point to
the same xforms:instance.


Please could I have some 'best practice' guidance as to which option
would be considered more practical/preferable?


Regards

Philip Fennell

Received on Wednesday, 7 February 2007 22:39:20 UTC