[xquery-talk] Problems with string testing in if
Jason Hunter
jhunter at xquery.com
Tue Jun 1 01:50:26 PDT 2004
Sjur Nørstebø Moshagen wrote:
> Hello,
>
> I'm new to this list, my apologies if this posting is outside the
> intended scope.
It's right within scope.
> The problem is it does not work as expected. So far I have tried the
> following:
>
> input output
> ----- ------
> no nor
> se nor
> sme nor
>
> The function is:
>
> (: Convert incoming locale strings to 3-letter language codes (ISO 639) :)
> declare function fn:locale2lang($locale as xs:string) as xs:string
> {
> let $lang := substring-before($locale,'_')
> return
> if ($lang = "no" or "nn" or "nb") then "nor"
> else if ($lang = "se") then "sme"
Try:
if ($lang = "no" or $lang = "nn" or $lang = "nb") then "nor"
else ...
-jh-
More information about the talk
mailing list