sqf:stringReplace

This activity element replaces substrings of text nodes by other nodes. The text nodes are defined by the<icode type="attribute">match</icode>attribute. The<icode type="attribute">regex</icode>attribute defines the substrings of the text nodes.

The nodes to be inserted are defined by the content of the<icode type="element">sqf:stringReplace</icode>element or the<icode type="attribute">select</icode>attribute.<b>Note:</b>The context within the<icode type="element">sqf:stringReplace</icode>element is set to the substrings. So, it is an atomic value.

Element Information

Model

((ANY element from ANY namespace))

Attributes

QName Type Fixed Default Use Inheritable Annotation
flags xs:string optional
Value
Flags to control the interpretation of the regular expression (given in the<icode type="attribute">regex</icode>attribute). The flags can be specified by XPath expressions which are marked by curly brackets. After processing, the flags must meet the requirements of the<icode type="attribute">flags</icode>attribute of the<icode type="element">xsl:analyze-string</icode>element.
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.
regex xs:string required
Value
Regular expression. The expression can be specified by XPath expressions which are marked by curly brackets. After processing, the regular expression must meet the requirements of the<icode type="attribute">regex</icode>attribute of the<icode type="element">xsl:analyze-string</icode>element.
select xs:string optional
The<icode type="attribute">select</icode>attribute defines nodes or an atomic value as the nodes to be inserted. If the<icode type="attribute">select</icode>attribute is set, the<icode type="attribute">sqf:stringReplace</icode>element should be empty.
The selected nodes will be copied. 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 substring to replace.
<b>Note:</b>The context will be always an atomic value. To select nodes from the XML instance, the use of variables outside of the<icode type="element">sqf:stringReplace</icode>element is necessary.
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 nodes to be inserted.
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="stringReplace">
  <xs:annotation>
    <xs:documentation>This activity element replaces substrings of text nodes by other nodes. The text nodes are defined by the
      <icode type="attribute">match</icode>attribute. The
      <icode type="attribute">regex</icode>attribute defines the substrings of the text nodes.</xs:documentation>
    <xs:documentation>The nodes to be inserted are defined by the content of the
      <icode type="element">sqf:stringReplace</icode>element or the
      <icode type="attribute">select</icode>attribute.
      <b>Note:</b>The context within the
      <icode type="element">sqf:stringReplace</icode>element is set to the substrings. So, it is an atomic value.</xs:documentation>
  </xs:annotation>
  <xs:complexType mixed="true">
    <xs:choice>
      <xs:group ref="sqf:templateElements"/>
    </xs:choice>
    <xs:attributeGroup ref="sqf:activityBase"/>
    <xs:attribute name="regex" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation source="Value">Regular expression. The expression can be specified by XPath expressions which are marked by curly brackets. After processing, the regular expression must meet the requirements of the
          <icode type="attribute">regex</icode>attribute of the
          <icode type="element">xsl:analyze-string</icode>element.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="select" type="xs:string">
      <xs:annotation>
        <xs:documentation>The
          <icode type="attribute">select</icode>attribute defines nodes or an atomic value as the nodes to be inserted. If the
          <icode type="attribute">select</icode>attribute is set, the
          <icode type="attribute">sqf:stringReplace</icode>element should be empty.</xs:documentation>
        <xs:documentation>The selected nodes will be copied. Unlike a deep copy function, the copied nodes could be manipulated by the current or other activity elements.</xs:documentation>
        <xs:documentation source="Value">XPath expression. The context of relative expressions is the substring to replace.</xs:documentation>
        <xs:documentation>
          <b>Note:</b>The context will be always an atomic value. To select nodes from the XML instance, the use of variables outside of the
          <icode type="element">sqf:stringReplace</icode>element is necessary.</xs:documentation>
        <xs:documentation source="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 nodes to be inserted.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="flags" type="xs:string">
      <xs:annotation>
        <xs:documentation source="Value">Flags to control the interpretation of the regular expression (given in the
          <icode type="attribute">regex</icode>attribute). The flags can be specified by XPath expressions which are marked by curly brackets. After processing, the flags must meet the requirements of the
          <icode type="attribute">flags</icode>attribute of the
          <icode type="element">xsl:analyze-string</icode>element.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>
</xs:element>

Sample