Title: How to save changes to input document?
Tags: xquery
Question: 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.
I have following code:
let $test := doc("/db/test/test.xml")/items/item
let $testSet := <items&gt;{$test}</items&gt;
let $write := xmldb:store("/db/test", "test.xml", $testSet)
return $test
But it seems writing back to the document(line 3) screws up the content
of $test(line 1).
Any help is appreciated.Thank you very much!
Comment: Would be good if you could post test.xml too.


Here is another answer: I see you've asked this same question on the exist-open list, and I think Wolfgang already gotten it answered there.  See http://exist-open.markmail.org/thread/g4dnipbcngimrqma.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2011:00:09/04/11', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<xquery>', 'Title': 'How to save changes to input document?', 'ViewCount': 48, 'id': 7299918, 'user_AboutMe': None, 'user_AccountId': 59563.0, 'user_DisplayName': 'wrb302', 'user_Reputation': 3.0, 'user_Views': 13.0, 'user_id': 178188.0}}