I'm trying to create a xquery expressions that inserts some new nodes only if a condition is true and returns an error if the condition is false. A simplyfied version of my state is:
let $a := [...]
return
if($a/@something != "true") then (
insert node (
element {'Foobar'} { }
) into $a/somenode
) else (
)
My problem: whenever if put something like <Error/>
into the else i get an error "[XUST0001] No updating expression allowed in this context".
/e: Okay...if I understand this correctly i can't have updateing expressions AND a return value....so I have to find another way.