W3C home > Mailing lists > Public > xproc-dev@w3.org > September 2011

Re: Options as strings. Blech.

From: Florent Georges <fgeorges@fgeorges.org>
Date: Fri, 2 Sep 2011 12:28:00 +0200
Message-ID: <CADyR_r32XPJxJ6S9BBMnGNxddVtZBGBZFRK43ujKzeVu+B3rHw@mail.gmail.com>
To: Andrew Welch <andrew.j.welch@gmail.com>
Cc: vojtech.toman@emc.com, xproc-dev@w3.org
On 2 September 2011 12:20, Andrew Welch wrote:
> On 2 September 2011 11:10, Florent Georges wrote:

  Hi,

>>  If we look at the definition of EBV[1], actually any string
>> returns true except the empty string.  So even 'false' returns
>> true:

>>    (: returns true() :)
>>    if ( 'false' ) then true() else false()

>>    (: returns false() :)
>>    xs:boolean('false')

> Don't forget the gotcha that the only non-empty string to
> return false is '0'... xs:boolean('0') returns false.

  No.  We talk about two different things here: first the EBV,
defined using boolean() (that is, fn:boolean()), and second the
boolean item constructor, that is xs:boolean() (note fn:* versus
xs:*).

  For the EBV and fn:boolean(), only the empty string returns
false, all other strings return true (including 'false' and '0').
For xs:boolean(), 'true' and '1' return true, 'false' and '0'
return false, and any other string is a cast error.

  Unless I missed something, of course.

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
Received on Friday, 2 September 2011 10:28:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 2 September 2011 10:28:48 GMT