Sometimes I wish that XQuery had hashes:
Clunky XQuery 1.0 way:
if ($n = "a") then "aardvark"
else if ($n = "b") then "bandicoot"
...
else if ($n = "z") then "zebra"
else ()
Declunked way:
define variable $animals as xqy:hash {
"a" => "aardvark", "b" => "bandicoot", ... , "z" => "zebra"
}
$animals[$n]
Best
Tim Finney