Hi,
I have a collection MyData/Test and another collection MyData/Real. I have the following XML occurring about five times in total, 4 times in collection MyData/Test and once in MyData/Real:
<APPLICATION> <APPLICATION_ID>1</APPLICATION_ID> </APPLICATION>
When I seek to delete this application only from MyData/Test using updating xquery like so: xquery version "1.0";
declare namespace fn="http://www.w3.org/2005/xpath-functions";
let $dataSet := 'Test' let $databaseName := 'MyData' let $applicationID := '1'
let $finalURL := fn:concat($databaseName, "/",$dataSet) let $applicationsModified := <APP-DATA-ROOT xmlns:xforms="http://www.w3.org/2002/xforms%22%3E; <APPLICATION> <APPLICATION_ID>2</APPLICATION_ID> </APPLICATION> </APP-DATA-ROOT>
for $all in fn:collection($finalURL) for $anApp in $all/APPLICATION[APPLICATION_ID=$applicationID] return ( delete nodes $anApp )
The application gets deleted from MyData/Real collection as well!
Moreover, an insert statement to insert an APPLICATION element in the return block above, such insert statement placed after the deletion statement above, does not appear to insert anything.