title: How to save changes to input document?
body: <p>I am tryinig to use a cache while generating RSS feed for a collection in eXist database. So I need to
  read content from a document, makes some changes and write back to the
  cache.</p>
  
  <p>I have following code:</p>
  
  <pre><code>let $test := doc("/db/test/test.xml")/items/item
  let $testSet := &lt;items&gt;{$test}&lt;/items&gt;
  let $write := xmldb:store("/db/test", "test.xml", $testSet)
  return $test
  </code></pre>
  
  <p>But it seems writing back to the document(line 3) screws up the content
  of $test(line 1).</p>
  
  <p>Any help is appreciated.Thank you very much!</p>