We are planning to expand this model to include groups. This will allow creating or updating multiple Entities with a single submission without necessarily using repeats. See also the updated XLSForm proposal.
Glossary
Container: the form definition root, a group, or a repeat.
Entity declaration: a meta/entity block in a container that declares how Entities are affected when the form is finalized.
XForms spec
Any container in a form definition MAY directly include at most one Entity declaration. Nested containers MAY also each directly include at most one Entity declaration.
An entities:saveto binding MUST be associated with the nearest ancestor container that has an Entity declaration. If no ancestor container has an Entity declaration, the form is invalid.
If an entities:saveto binding is declared within a repeat, the nearest ancestor container that has an Entity declaration MUST be that repeat or a descendant group of that repeat. If the nearest ancestor container with an Entity declaration is outside the repeat, the form is invalid.
Examples
- If a
savetois declared within the group/data/treeand/data/treehas an Entity declaration, thesavetois associated with the Entity declared in/data/tree. - If a
savetois declared within the group/data/tree,/data/treehas no Entity declaration, and the root container has an Entity declaration, thesavetois associated with the root Entity declaration. - If a
savetois declared within the repeat/data/trees,/data/treeshas no Entity declaration, and the root container has an Entity declaration, the form is invalid. - If a
savetois declared within the repeat/data/trees/seedlings,/data/trees/seedlingshas an Entity declaration, then thesavetois associated with the Entity declared in/data/trees/seedlings, regardless of whethertreesis a repeat or group and whether or not it has an Entity declaration. - If a
savetois declared within the repeat/data/trees/seedlings,/data/trees/seedlingsdoes not have an Entity declaration, and/data/treesis a group or repeat with an Entity declaration, the form is invalid. - If a
savetois declared within the repeat/data/trees/seedlings,/data/trees/seedlingshas an Entity declaration, then thesavetois associated with the Entity declaration in/data/trees/seedlings. If anothersavetois declared within/data/treesand outside of/data/trees/seedlingsand/data/treeshas an Entity declaration, then thatsavetois associated with the Entity declaration in/data/trees, regardless of whethertreesis a repeat or group.