qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qexo-general] Function return value


From: Per Bothner
Subject: Re: [Qexo-general] Function return value
Date: Tue, 09 Mar 2004 05:20:59 -0800
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113

Jun Yu wrote:

My XQuery program "test.xql" is like this:

define function authenticate($username,$password) as boolean {
let $s:=document("session.xml")/login
return
  if ($s/username=$username and $s/password=$password) then
     true
  else
     false
}

'true' and 'false' are parsed as node tests, i.e. as short for
./child::true and ./child::false.  Qexo is warning you that context
(i.e. the current node '.') isn't defined here.

You probably meant to write:

  return
    if ($s/username=$username and $s/password=$password) then
      true()
    else
      false()

or just plain:

  return
    $s/username=$username and $s/password=$password

Likewise:

  if (authenticate(...) = true) then ...

should be:

  if (authenticate(...) = true()) then ...

or better:
   if (authenticate(...)) then ...
--
        --Per Bothner
address@hidden   http://per.bothner.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]