sqf:add

This activity element adds a node to one or more nodes of the XML instance.

The attributes<icode type="attribute">match</icode>and<icode type="attribute">position</icode>define the position where the nodes will be added. The position is determined by the anchor node(s) (<a ref="#activityBase_match">@match</a>) and the insertion direction (<a ref="#add_position">@position</a>).

The attributes<icode type="attribute">node-type</icode>,<icode type="attribute">select</icode>and<icode type="attribute">target</icode>and the content of the element define the nodes to be added.

Element Information

Model

((ANY element from ANY namespace))

Attributes

QName Type Fixed Default Use Inheritable Annotation
match xs:string . optional
The<icode type="attribute">match</icode>attribute defines anchor nodes for an activity element.
For each selected anchor node, the command of the activity element will be executed. For each execution, the context will be set to the anchor node.
Exception: The<icode type="attribute">match</icode>attribute of the<a ref="#sqf_stringReplace">
  <icode type="element">sqf:stringReplace</icode>
</a>element should only select text nodes.
Value
XPath expression. The context of relative expressions is the context of the related Schematron rule.
Default
By default the anchor node is the context node of the related Schematron rule.
node-type sqf:nodeTypeType optional
The<icode type="attribute">node-type</icode>attribute defines the node type of the nodes to be added. The attribute is required, if the target attribute is set.
If the<icode type="attribute">node-type</icode>value is missing, the activity element should not have a<icode type="attribute">target</icode>attribute. In this case the nodes to be added will be defined by the activity elements content or<icode type="attribute">select</icode>attribute.
position sqf:positionType optional
The<icode type="attribute">position</icode>attribute defines the position of the nodes to be added relatively to the anchor node (see<a ref="#activityBase_match">@match</a>).
Default
If the value of the<icode type="attribute">node-type</icode>attribute is<icode type="attributeValue">attribute</icode>, the<icode type="attribute">position</icode>attribute should not be set, because the node to be added will always be inserted as attribute. Otherwise the default value is<icode type="attributeValue">first-child</icode>.
select xs:string optional
The<icode type="attribute">select</icode>attribute defines nodes or an atomic value as the content of the node to be added. If the<icode type="attribute">select</icode>attribute is set, the activity element should be empty.
The selected nodes will be copied into the node to be added. Unlike a deep copy function, the copied nodes could be manipulated by the current or other activity elements.
Value
XPath expression. The context of relative expressions is the anchor node.
Default
There is no default value. If the<icode type="attribute">select</icode>attribute is not set, the content of the activity element defines the content of the nodes to be added.
target xs:string optional
This attribute defines the name of the node to be added. The attribute is required if the<icode type="attribute">node-type</icode>attribute is specified and the value is not<icode type="attributeValue">comment</icode>.
Value
A string to define a node name. The string can be specified by XPath expressions which are marked by curly brackets. After processing, the name must be valid to the XML Schema type xs:QName.
Prefixes must be attached to a namespace in the current context of the Schematron schema. Names without prefixes will be attached to the namespace declared by the<icode type="element">sqf:default-namespace</icode>element or to the null namespace.
use-when xs:string true() optional
A condition for the action of the activity Element. The action will just be executed, if the condition returns true.
value
XPath expression. It expects as return value an xs:boolean.
Wildcard: ANY attribute from ANY namespace OTHER than 'http://purl.oclc.org/dsdl/schematron'

Used By

Element Group sqf:activityElements

Source

<xs:element name="add">
  <xs:annotation>
    <xs:documentation>This activity element adds a node to one or more nodes of the XML instance.</xs:documentation>
    <xs:documentation>The attributes
      <icode type="attribute">match</icode>and
      <icode type="attribute">position</icode>define the position where the nodes will be added. The position is determined by the anchor node(s) (
      <a ref="#activityBase_match">@match</a>) and the insertion direction (
      <a ref="#add_position">@position</a>).</xs:documentation>
    <xs:documentation>The attributes
      <icode type="attribute">node-type</icode>,
      <icode type="attribute">select</icode>and
      <icode type="attribute">target</icode>and the content of the element define the nodes to be added.</xs:documentation>
  </xs:annotation>
  <xs:complexType mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:group ref="sqf:templateElements"/>
    </xs:choice>
    <xs:attribute name="position" type="sqf:positionType">
      <xs:annotation>
        <xs:documentation>The
          <icode type="attribute">position</icode>attribute defines the position of the nodes to be added relatively to the anchor node (see
          <a ref="#activityBase_match">@match</a>).</xs:documentation>
        <xs:documentation source="Default">If the value of the
          <icode type="attribute">node-type</icode>attribute is
          <icode type="attributeValue">attribute</icode>, the
          <icode type="attribute">position</icode>attribute should not be set, because the node to be added will always be inserted as attribute. Otherwise the default value is
          <icode type="attributeValue">first-child</icode>.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="sqf:activityManipulate"/>
  </xs:complexType>
</xs:element>

Sample