title: XML selection of parents based on child and or grandchild
body: <p>I'm searching for an XPath string (for VBA Excel) that can look for all nodes on a specific level and that are only returned in case they have a specific (grand) child node. Regardless how 'deep' this is nested. Relationale: I don't know how deep a specific child is nested therefore I can't make a fixed path. </p>
  
  <p>In case of the example below. I'm searching for all nodes that are directly under the root '' and which have any child that contain the name 'Test' </p>
  
  <p><br>
  XML STRING:</p>
  
  <pre><code>&lt;Program&gt;
     &lt;AA name="1"/&gt;
     &lt;BB name="2"&gt;
        &lt;CC name="Test"/&gt;
     &lt;/BB&gt;
     &lt;DD name="Test"/&gt;
     &lt;EE name="3"&gt;
        &lt;FF name="4"&gt;
           &lt;GG name="Test"/&gt;
        &lt;/FF&gt;
     &lt;/EE&gt;
  &lt;/Program&gt; 
  </code></pre>
  
  <p><br>
  REQUIRED SELECTION:</p>
  
  <pre><code>Item(0) = &lt;BB name="2"&gt;
  Item(1) = &lt;DD name="Test"&gt;
  Item(2) = &lt;EE name="3"&gt;
  </code></pre>
  
  <p><br>
  The following XPath expression gives the nodes under <code>Program</code></p>
  
  <pre><code>xmlDoc.selectNodes("/Program/*")
  </code></pre>
  
  <p><br>
  The following XPath expression gives the nodes which contain the name <code>Test</code></p>
  
  <pre><code>xmlDoc.selectNodes("//*[@name="Test"]")
  </code></pre>
  
  <p><b>What I need is not a 'union' of the 2 paths but a 'overlap'. Does anybody know how to make this?</b></p>