title: Using XPath, How do I get the text nodes that are not part of hyperlinks
body: <p>I would like to get all the text nodes of a document, but only those that are NOT part of a hyperlink. </p>
  
  <p>Test sample:</p>
  
  <pre><code>Hello &lt;a class='foobar' href='foo.html'&gt;foo&lt;/a&gt;World Hello foo World
  </code></pre>
  
  <p>The result text nodes should include the text node with Hello foo World, but not the hyperlink.</p>
  
  <p>I tried <code>"//*[not(@href)]/text()"</code> , but this does not appear to work.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>As my answer below (hopefully) explains, my problem was that the query was looking for nodes inside the root node, but not the root node itself. My answer is below. </p>
  
  <p>Andrew came up with a different approach that is probably more clear as to intent.</p>