title: Checking node contents against a given set of values
body: <p>Given an XML document such as this:</p>
  
  <pre><code>&lt;root&gt;
      &lt;foo&gt;
          &lt;bar&gt;a&lt;/bar&gt;
          &lt;bar&gt;b&lt;/bar&gt;
          &lt;bar&gt;c&lt;/bar&gt;
      &lt;/foo&gt;
      ...
  &lt;/root&gt;
  </code></pre>
  
  <p>How can I retrieve all <code>foo</code>-nodes that have <code>bar</code>-subnodes with certain values?</p>
  
  <p>So for instance, if I need all <code>foo</code>-elements that have <code>bar</code>-subelements with values <code>a</code> and <code>c</code>, I am currently using this expression:</p>
  
  <pre><code>//*/foo[bar/text()='a'][bar/text()='c']
  </code></pre>
  
  <p>which is fine, except that it gets clumsy if I have more "<code>bar</code>-constraints" and I'm not too big of a fan of programmatically generated XPath expressions :). What I am looking for is something along these lines (obviously invalid syntax):</p>
  
  <pre><code>//*/foo[bar/text() in-set('a', 'c')]
  </code></pre>
  
  <p>Any ideas?</p>