DeclarativeInsert

Declarative Insert

Create a way of declaratively ensuring that an element or attribute exists (rather than having a UI control behave as if non-relevant if referenced node is absent)

Also need to handle the more complex situation of having a choice content, from schema perspective, where one of a selection of elements is valid. Switching a data value that implies a choice of which structural element is appropriate should handle deletion of old element (saving content in case it needs to be put back during runtime) and inserting new element (obtaining from saved copy if available). This would be a much improved alternative to using relevance, which prunes choices but then makes the result instance unusable in a future execution of the same XForm.

Strawman example:

<bind ref="foo/@bar" initial=""/>

Note: this still needs to be worked out in detail. In particular probably @ref is not the right attribute, since it works differently from other @refs, since it doesn't just select a nodeset, but first creates one before selecting it. Another strawman: