declare variable $local-config external; declare variable $global-config external; let $x := (for $y in fn:doc($local-config)//output-element return $y/@namespace, for $p in fn:doc($local-config)//use-prefix return $p, for $fn in fn:doc($local-config)//function-name return $fn/@namespace, if($local-config eq $global-config) then () else for $gy in fn:doc($global-config)//output-element return $gy/@namespace, for $gp in fn:doc($global-config)//use-prefix return $gp, for $gfn in fn:doc($global-config)//function-name return $gfn/@namespace ) return for $z in distinct-values($x) return $z