[xquery-talk] Elegant form of testing for () and ''

Fourny Ghislain gfourny at inf.ethz.ch
Fri Mar 4 17:23:13 PST 2011


Hi David,

() ne '' should return the empty sequence, the effective boolean value of which is false so that the function returns "<untitled>" as well when $name is empty - or did I miss something?

The following query works fine with Zorba (it returns "<untitled>"):

__
declare function local:getname( $e ) as xs:string
{
let $name := $e/name/string()
return
  if( $name ne '' ) then $name else "<untitled>"
};

local:getname(())
__

Could it be that it crashes for another reason?

Kind regards,
Ghislain




More information about the talk mailing list