Example 3: Tree Transformation.
As example 2 above but then rename highlighted item to luxury-item
Similar to before only this time we'll rename all "expensive:item" to "expensive:luxury-item". This
shows how operations subsequent to a namespace declaration can incorporate the namespace into the
target xpath to process a subsection of the original document.
<idoc> <seq> <instr> <type>stm</type> <operand>data.xml</operand> <operator> <stm:group xmlns:stm="http://1060.org/stm"> <stm:delete xpath="/data/item[price < 100]" /> <stm:apply-ns prefix="expensive" uri="temp:/what/a/rip/off" xpath="/data/item[price > 500]" /> <stm:rename xpath="/data/expensive:item">luxury-item</stm:rename> </stm:group> </operator> <target>this:response</target> </instr> </seq> </idoc>
Try it
 |