Replacing Node Values
The
replace
expression is an updating expression that can be used to replace a node or a node’s value. Its syntax varies based on the type of replacement.Example
The change-values.xq example queries holdings.xml. It looks for a user, Minollo (/table/holdings[UserId eq 'Minollo']), and increases his stock holdings (
<shares>
) by 20%, replacing the current value with the calculated value.Results of the query are written to a new XML document, more-shares.xml, using the
fn:put()
function: