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