[xquery-talk] Problems with string testing in if

Michael Kay mhk at mhk.me.uk
Tue Jun 1 16:11:08 PDT 2004


> One correct version looks like:
> 
> 	let $lang := if (contains($locale,'_') ) then 
> substring-before($locale,'_') else $locale
> 

Or if you prefer, you could code that as

let $lang = tokenize($locale, '_')[1]

Michael Kay




More information about the talk mailing list