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

David Lee dlee at calldei.com
Fri Mar 4 13:37:42 PST 2011


OK I'm insane my "fix" didnt work either.
Your right (Ghislain) something else is going wrong in my scripts


----------------------------------------
David A. Lee
dlee at calldei.com
http://www.xmlsh.org

-----Original Message-----
From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Fourny Ghislain
Sent: Friday, March 04, 2011 12:23 PM
To: David Lee
Cc: <talk at x-query.com>
Subject: Re: [xquery-talk] Elegant form of testing for () and ''


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


_______________________________________________
talk at x-query.com
http://x-query.com/mailman/listinfo/talk



More information about the talk mailing list