XQuery Update
Posted: Wed Jan 25, 2012 1:40 pm
Hello,
I've got Problems with executing XQuery Update expressions but can'f find any wrong settings. Running Oxygen Editor 13.2.
Examples:
returning "F [Saxon-EE XQuery 9.3.0.5] Updating functions are allowed only in XQuery Update"
for
returning "F [Saxon-EE XQuery 9.3.0.5] Unexpected token "copy" in path expression"
for
Any ideas?
I've got Problems with executing XQuery Update expressions but can'f find any wrong settings. Running Oxygen Editor 13.2.
Examples:
returning "F [Saxon-EE XQuery 9.3.0.5] Updating functions are allowed only in XQuery Update"
for
Code: Select all
declare updating function
upsert($e as element(),
$an as xs:QName,
$av as xs:anyAtomicType)
{
let $ea := $e/attribute()[fn:node-name(.) = $an]
return
if (fn:empty($ea))
then insert node attribute {$an} {$av} into $e
else replace value of node $ea with $av
}
for
Code: Select all
let $source := doc('juicers.xml')
let $images := doc('juicer-images.xml')
return
for $i in $source//juicer return
copy $j := $i
modify
replace node $j/image with
element {'image'}
{
for $j in $images//image[@id eq $j/@id]/* return
element {$j/name()} {data($j)}
}
return $j