title: how to define specific XML element in XPath to delete with xmlStarlet?
body: <p>I am trying to use xmlStarlet to delete a particular element in an XML file and I am having problems with the XPath specification. This is the node/element that I need to delete, i.e., specify in XPath:</p>
  
  <pre><code>   &lt;ShowFrame/&gt;
        &lt;DoAction&gt;
           &lt;actions&gt;
              &lt;Stop/&gt;
              &lt;EndAction/&gt;
           &lt;/actions&gt;
        &lt;/DoAction&gt;
     &lt;ShowFrame/&gt;
  </code></pre>
  
  <p>The problem is that there are other DoAction elements with an actions child that I do not want to delete. Only the DoAction elements with a child actions which has those 2 children: Stop and EndAction. The DoAction elements that I do not want to delete have different children in the actions child.</p>
  
  <p>When I use this XPath specification in the delete xmlStarlet command only the Stop descendant is deleted:</p>
  
  <p>"/swf/Header/tags/DoAction/descendant::actions/descendant::Stop"</p>
  
  <p>but I want to delete the complete DoAction element. Actually, I really need to also delete the ShowFrame element following the DoAction element so there is not 2 adjacent ShowFrame elements remaining after the deletion. </p>
  
  <p>I have been trying to study the XPath spec but I don't understand it. The examples I find use attributes but there are no attributes in this XML file.</p>
  
  <p>Any help with this would be greatly appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>-Andres</p>