 <p>Every node selected by an XPath expression has a corresponding string value. From <a href="http://www.w3.org/TR/xpath/#dt-string-value" rel="nofollow">the spec</a>:</p> <blockquote> <p>The string-value of an element node is the concatenation of the string-values of all text node descendants of the element node in document order.</p> </blockquote> <p>Which is exactly what you want. This string value is often used implicitly, but you can <em>explicitly</em> retrieve it with the <code>string</code> function. Again, <a href="http://www.w3.org/TR/xpath/#section-String-Functions" rel="nofollow">the spec</a>:</p> <blockquote> <p>The string function converts an object to a string as follows:</p> <ul> <li>A node-set is converted to a string by returning the string-value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.</li> </ul> </blockquote> <p>Use it like this:</p> <pre><code>string(/html/body/h1) </code></pre>