Hi Jan, Hi Ronny, maybe you might want to use the following approach:
declare variable $a external; let $default := "<b>I am default</b>" let $vals := ( try { $a } catch * {()}, $default )[1] return parse-xml($vals)
the try clause tries to assign $a to $vals, and if catched assigns the empty sequence to $vals. The [1] predicate selects the first element of this sequence, as empty subsequences are flattened, the value for $default is returned if $a has been set to the empty sequence. I chose parse-xml instead instead of util:eval; might be both a little faster and definitely more secure :-) Hope this helps (and works ;-)). Kind Regards Michael Am 13.03.2012 um 17:20 schrieb Jan Vlčinský (TamTam Research):
let $xml := util:eval($xmlString)