title: XPath to get all parent nodes that have any child node with a specific attribute
body: <p>I have an XML that does not have a consistent structure.  I need to see if there is an easy way to search for all parent nodes that have at least one child node with an attribute modified="yes".  Is there an easy way to do this with XPath?  The XML I will be dealing with is pretty huge and I will be working with a 4GL language that does not have all the functionality of Visual Studio, but it does provide some COM objects to help navigate XML DOM.  The code looks very similar to what I would do in Visual Studio (see below the sample xml)</p>
  
  <p>Sample XML (simplified greatly for easy readability):</p>
  
  <pre><code>&lt;RootNode&gt;
     &lt;BOOK&gt;
        &lt;PRICE modified="yes"&gt;15&lt;/PRICE&gt;
        &lt;COPIES&gt;10&lt;/COPIES&gt;
     &lt;/BOOK&gt;
     &lt;MAGAZINE&gt;
        &lt;PRICE&gt;8&lt;/PRICE&gt;
        &lt;COPIES modified="yes"&gt;100&lt;/COPIES&gt;
     &lt;/MAGAZINE&gt;
     &lt;NEWSPAPER modified="yes"&gt;
        &lt;PRICE&gt;2&lt;/PRICE&gt;
        &lt;COPIES&gt;75&lt;/COPIES&gt;
     &lt;/NEWSPAPER&gt;
     &lt;KINDLE_SUB&gt;
        &lt;PRICE modified="yes"&gt;6&lt;/PRICE&gt;
        &lt;COPIES/&gt;
     &lt;/KINDLE_SUB&gt;
     &lt;EMAIL_SUB&gt;
        &lt;UNSUBSCRIBE modified="yes"&gt;1&lt;/UNSUBSCRIBE&gt;
     &lt;/EMAIL_SUB&gt;
  &lt;/RootNode&gt;
  </code></pre>
  
  <p>In Visual Studio you might do:</p>
  
  <pre><code>XmlDocument xmldoc = new XmlDocument();
  xmldoc.LoadXml( [above xml] );
  
  XmlNodeList nodelist = xmldoc.SelectNodes(" *XPATH HERE* ");
  </code></pre>
  
  <p>should hopefully return to me:BOOK, MAGAZINE, KINDLE_SUB and EMAIL_SUB nodes in a XmlNodeList object.</p>
  
  <p>The NEWSPAPER node should not be selected because it does not have child nodes that have a attribute of modified="yes" even though the NEWSPAPER node itself has this attribute.</p>