title: XPath to select all elements with a specified name
body: <p>I believe this should be able to be answered just using standard XPath without reference to implementation, but just for reference I am using the XML DOM objects in .Net (System.Xml namespace).</p>
  
  <p>I have a node handed to my function, from somewhere deep inside an XML document, and I want to select all descendant elements of this node that have a specific name, regardless of the intervening path to those nodes.  The call I'm making looks like this:</p>
  
  <pre><code>node.SelectNodes("some XPath here");
  </code></pre>
  
  <p>The node I'm working with looks something like this:</p>
  
  <pre><code>...
  &lt;food&gt;
    &lt;tart&gt;
      &lt;apple color="yellow"/&gt;
    &lt;/tart&gt;
    &lt;pie&gt;
      &lt;crust quality="flaky"/&gt;
      &lt;filling&gt;
        &lt;apple color="red"/&gt;
      &lt;/filling&gt;
    &lt;/pie&gt;
    &lt;apple color="green"/&gt;
  &lt;/food&gt;
  ...
  </code></pre>
  
  <p>What I want is a list of all of the "apple" nodes, i.e. 3 results.
  I've tried a couple of different things, but none of them get what I want.</p>
  
  <pre><code>node.SelectNodes("apple");
  </code></pre>
  
  <p>This gives me one result, the green apple.</p>
  
  <pre><code>node.SelectNodes("*/apple");
  </code></pre>
  
  <p>This gives me one result, the yellow apple.</p>
  
  <pre><code>node.SelectNodes("//apple");
  </code></pre>
  
  <p>This gives me hundreds of results, looks like every apple node in the document, or at least maybe every apple node that is a direct child of the root of the document.</p>
  
  <p>How do I create an XPath that will give me all the apple nodes under my current node, regardless of how deep under the current node they are found?  Specifically, based on my example above, I should get three results - the red, green, and yellow apples.</p>