title: Count number of nodes with substring of attribute equivalent to some value
body: <p>Example: trying to count number of b nodes that are images.</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;a&gt;
   &lt;b mediatype='image/jpeg'&gt;
    &lt;c&gt;hello.jpg&lt;/c&gt;
   &lt;/b&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>XPath:</p>
  
  <pre><code>count(//b[substring(@mediatype, 0, 5) = 'image'])
  </code></pre>
  
  <p>Using the Xpath Tester: <a href="http://codebeautify.org/Xpath-Tester" rel="nofollow">http://codebeautify.org/Xpath-Tester</a>
  Evaluates to 0.0</p>
  
  <p>Thanks to the answers, have chosen the best answer based on the information given as well as the improved XPath using starts-with.</p>