I'm trying to update an attribute value of a node and return its previous value all in one query and I can't find a way to do it. I'm using BaseX as my XML/XQuery database.
For now I've tried doing this:
/Root/Elem/properties/property[@id='17']/@format,
replace value of node /Root/Elem/properties/property[@id='17']/@format with 'URL'
and also this:
for $prop in /Root/Elem/properties/property[@id='17']
let $format := $prop/@format
return (replace value of node $prop/@format with 'URL', $format)
And multiple other tests but they all lead to the following error:
List expression: no updating expression allowed.
Is it a limitation of BaseX or is it not possible in XQuery?