title: Can I return a whole XML document using XPath in javascript?
body: <p>I am using Javascript, and I want to return an XML document with the results I want. </p>
  
  <p>For example, the XML document can be
  <code>
  &lt;books&gt;
  &lt;book&gt;
  &lt;title&gt;
  Introduction to XML
  &lt;/title&gt;
  &lt;/book&gt;
  &lt;book&gt;
  &lt;title&gt;
  Introduction to Javascript
  &lt;/title&gt;
  &lt;/book&gt;
  &lt;/books&gt;
  </code></p>
  
  <p>and using this XPath expression:
  <code>//book[./title="Introduction to XML"]</code> I want to get a document like that 
  <code>
  &lt;books&gt;
  &lt;book&gt;
  &lt;title&gt;
  Introduction to XML
  &lt;/title&gt;
  &lt;/book&gt;
  &lt;/books&gt;
  </code></p>
  
  <p>I know XQuery sounds like the solution here, but I am using Javascript, and there are no built-in implementations, as far as I know, for XQuery in Javascript.</p>
  
  <p>I want to return the ancestors along with the thing I need. But it should also work if I get several results.. is this doable using XPath?</p>