Name
insert
Synopsis
This action works within a node-set, by constructing new nodes based
on a template. The immediate problem with this approach is that if
there are no nodes present in the repeating set (as can happen after
invoking the delete
action), what template can be
used to copy from? The answer depends on the way instance data is
constructed in XForms: as a separate in-memory representation. The
initial instance data, as it appears inside the
instance
element in the containing document (or in
an external linked file) doesn’t change as the
instance data changes through all the various interactions defined by
XForms. Thus, the initial instance data is defined as the source of
the template to be copied, even though it makes for some awkward
terminology to explain how it works.
The main attributes that control the operation of this element are:
- single-node binding attributes
These attribute or attributes select a node-set, which matches the node-set selected by a repeat set.
-
at
This attribute selects the location within the node-set where the inserted element node will appear. Generally, it is one of three possibilities:
To insert a new repeat item at the beginning,
at="1
“.To insert a new repeat item at the end,
at="last( )
“.To insert a new repeat item at the current index,
at="index('id_of_repeat')
" (whereid_of_repeat
represents the IDREF of the<repeat>
element).
-
position
This attribute is required, and must be either "
before
" or "after
“—where to insert the new node relative ...
Get XForms Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.