If I have this input file:
<root>
<node id="N1">
<fruit id="small_fruit">
<orange id="1" action="create">
<attribute>
<color>yellow</color>
</attribute>
</orange>
</fruit>
<fruit id="large_fruit" action="create">
<melon id="1" action="destroy">
<attribute>
<color>green</color>
</attribute>
</melon>
</fruit>
</node>
<node id="N2">
<dog id="small_dog">
<poodle id="1" action="create">
<attribute>
<color>Yellow</color>
</attribute>
</poodle>
<poodle id="1" action="change">
<attribute>
<color>Brown</color>
</attribute>
</poodle>
<terrier id="2" action="destroy">
<attribute>
<color>Blue</color>
</attribute>
</terrier>
</dog>
</node>
</root>
and I need to separate into two files: output1: node_destroy.xml
<root>
<node id="N1">
<fruit id="large_fruit" action="create">
<melon id="1" action="destroy">
<attribute>
<color>green</color>
</attribute>
</melon>
</fruit>
</node>
<node id="N2">
<dog id="small_dog">
<terrier id="2" action="destroy">
<attribute>
<color>Blue</color>
</attribute>
</terrier>
</dog>
</node>
</root>
output2: node_other_than_destroy.xml
<root>
<node id="N1">
<fruit id="small_fruit">
<orange id="1" action="create">
<attribute>
<color>yellow</color>
</attribute>
</orange>
</fruit>
</node>
<node id="N2">
<dog id="small_dog">
<poodle id="1" action="create">
<attribute>
<color>Yellow</color>
</attribute>
</poodle>
<poodle id="1" action="change">
<attribute>
<color>Brown</color>
</attribute>
</poodle>
</dog>
</node>
</root>
Basically I need to remove the node with action='destroy' to one file and other node with other action into another file. (the checked action-node is melon, poodle, terrier NOT their parents, i.e. fruit and dog)
Please help me with the transformation file. Thanks very much.
regards, John