The insert element

Release 2.0 - ...

The insert action is used to create one or more nodes of instance data by cloning one or more existing instance nodes.

Attributes of the insert action specify the node or nodes to be cloned and the location within instance data where the clones will appear. The clones are deep copies of the original nodes except the contents of nodes of type xsd:ID are modified to remain as unique values in the instance data after the clones are inserted.

For details on how the insert action is processed, see the specification (link below).

Example

XML CopyCode image Copy Code
<xforms:action ev:event="xforms-ready">
   <xforms:insert nodeset="chapter/*" origin="instance('prototypes')/paragraph" at="7" position="before"/>
</xforms:action>

Attributes

Name Required / optional Description
context optional Attribute containing an XPath expression evaluated using the in-scope evaluation context.
origin optional Attribute containing an XPath expression evaluated using the in-scope evaluation context, which may have been amended by the context attribute.
The origin node-set is the set of one or more nodes to be cloned by the insert action.
at optional Attribute containing an XPath expression evaluated using the Node Set Binding node-set to help determine the insert location node.
position optional Selector that indicates where to put the cloned node or nodes relative to the insert location node.
Legal values: before and after. Default is after.
Node Set Binding optional Any attributes from the Node Set Binding Attributes group (nodeset, model, bind).
Common Attributes optional Any attribute from the Common Attributes collection (e.g. id).
XML Events optional Any attribute from the XML Events collection (e.g. ev:event)
Common Action Attributes optional Any attribute from the Common Action Attributes collection (if or while)

Content

The insert element does not allow any content.

Specification

Link to the XForms specification: the insert element.