title: XPath / XQuery: find text in a node, but ignoring content of specific descendant elements
body: <p>I am trying to find a way to search for a string within nodes, but excluding ythe content of some subelements of those nodes. Plain and simple, I want to search for a string in paragraphs of a text, excluding the footnotes which are children elements of the paragraphs. </p>
  
  <p>For example,</p>
  
  <p>My document being: </p>
  
  <pre><code>&lt;document&gt;
     &lt;p n="1"&gt;My text starts here/&lt;/p&gt;
     &lt;p n="2"&gt;Then it goes on there&lt;footnote&gt;It's not a very long text!&lt;/footnote&gt;&lt;/p&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>When I'm searching for "text", I would like the <code>Xpath / XQuery</code> to retrieve the first p element, but not the second one (where "text" is contained only in the footnote subelement).</p>
  
  <p>I have tried the <code>contains()</code> function, but it retrieves both p elements. </p>
  
  <p>Any help would be much appreciated :) </p>