stm:delete
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:delete

Deletes a document branch


Attribute
xpaththe target path into the operand document

The stm:delete operation is used to delete an element, attribute or document fragment located by an xpath.
CAUTION: If the xpath value returns multiple targets all of them are deleted.

Example

Example 1: Delete a branch

This example deletes the complete document branch below and including the first <b> element.

<idoc>
  <seq>
    <instr>
      <type>stm</type>
      <operand>doc.xml</operand>
      <operator>
        <stm:group xmlns:stm="http://1060.org/stm">
          <stm:delete xpath="/a/b[1]" />
        </stm:group>
      </operator>
      <target>this:response</target>
    </instr>
  </seq>
</idoc>

Try it

Example 2: Delete multiple targets

This demonstrates a mutlivalued xpath target. The xpath /a/b is ambiguous and produces two <b> elements. The delete operation is applied to each of them!

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

Try it

Example 3: Delete a single leaf element

This example demonstrates deleting a single element. It removes the <c> element from the second <b> element.

<idoc>
  <seq>
    <instr>
      <type>stm</type>
      <operand>doc.xml</operand>
      <operator>
        <stm:group xmlns:stm="http://1060.org/stm">
          <stm:delete xpath="/a/b[2]/c" />
        </stm:group>
      </operator>
      <target>this:response</target>
    </instr>
  </seq>
</idoc>

Try it

Example 4: Delete a set of attributes

This example demonstrates deleting a set of attributes. It removes the food attribute from the all <c> elements.

<idoc>
  <seq>
    <instr>
      <type>stm</type>
      <operand>doc.xml</operand>
      <operator>
        <stm:group xmlns:stm="http://1060.org/stm">
          <stm:delete xpath="/a/b/c/@food" />
        </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