stm:regex
STM by Example
Release Notes
Developing with NetKernel
Module Development Guide
Introduction
Design Model
Parameter Substitution
Namespaces
Examples readme
Tree Operations
stm:set
stm:append
stm:delete
stm:create-path
stm:get-fragment
stm:rename
stm:apply-ns
stm:remove-ns
stm:insert-before
stm:insert-after
stm:regex
stm:replace
stm:append-text
stm:append-attr
stm:set-xpath-eval
stm:basis
DPML Reference Guide
XRL Reference Guide
XForms Processing Guide
XAccesor/XAHelper
XDA
Session Guide
Mod DB Guide
Compound URI Guide
License
Change History
NetKernel History
Acknowledgements

stm:regex

Get those document fragments whose subxpath matches a regular expression


Attribute
xpathrequired the target xpath into the operand document
subxpathrequired an unambiguous relative xpath below xpath in the operand document
selectoptional an unambiguous xpath into the child document fragment contained by the stm:set element

The stm:regex returns document fragments located at an element located by an xpath. The regex match is applied to the unambiguous single valued target located at the relative xpath <subxpath>. The regex pattern is the value enclosed by the <stm:regex> element or obtained from the select xpath location of an enclosed fragment.

The document fragments are appended in match order to a new root element <regex-matches>.

Example

Example 1: Regex match

This example sets a base xpath of /a/b, the document fragment located below /a/b will be returned given a match. The subxpath c is a relative xpath and must be relative with respect to the base xpath. The pattern is donk.* which will match "donkey".

<idoc>
  <seq>
    <instr>
      <type>stm</type>
      <operand>doc.xml</operand>
      <operator>
        <stm:group xmlns:stm="http://1060.org/stm">
          <stm:regex subxpath="c" xpath="/a/b">donk.*</stm:regex>
        </stm:group>
      </operator>
      <target>this:response</target>
    </instr>
  </seq>
</idoc>

Try it


1060® NetKernelTM Documentation
(C) 2003-2004 1060 Research Limited

Send Feedback

© 2003,2004, 1060® Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited