(update insert comment {"unable to parse target: " || serialize($link)} following $link,
update delete $link)
else
let $targetNode := $f-indexproc:dataCollection/id($id)
return
if(count($targetNode) gt 1)
then (update insert comment {"xml:id used multiple times. this occurence is removed. please check and reinsert item when xml:id is unique. " || serialize($id[2])} following $id[2],
update delete $id[2]
)
else if(count($targetNode) = 0)
then
(update insert comment {"ID " || $id || " not found: Please create an appropriate item. " || serialize($link)} following $link,
update delete $link
)
else
let $list := local:get-list-by-entity($targetNode)
let $icon := local:get-icon-by-entity($targetNode)