title: XQuery - Strip out tag but leave its text
body: <p>How do I strip out a set of tags in XQuery but still leave its text there? For example, if I have:</p>
  
  <pre><code>&lt;root&gt;
      &lt;childnode&gt;This is &lt;unwantedtag&gt;some text&lt;/unwantedtag&gt; that I need.&lt;/childnode&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>How do I strip out the unwanted tag to get:</p>
  
  <pre><code>&lt;root&gt;
      &lt;childnode&gt;This is some text that I need.&lt;/childnode&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Actually, what I really want to end up with is just the text, like:</p>
  
  <pre><code>This is some text that I need.
  </code></pre>
  
  <p>When I do the following:</p>
  
  <pre><code>let $text := /root/childnode/text()
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>This is  that I need.
  </code></pre>
  
  <p>It's missing the <code>some text</code> part of it.</p>
  
  <p>Any ideas on how to return <code>This is some text that I need.</code>?</p>
  
  <p>Thank you.</p>