- From: Andrew Welch <andrew.j.welch@gmail.com>
- Date: Fri, 2 Sep 2011 11:49:29 +0100
- To: Florent Georges <fgeorges@fgeorges.org>
- Cc: vojtech.toman@emc.com, xproc-dev@w3.org
On 2 September 2011 11:28, Florent Georges <fgeorges@fgeorges.org> wrote:
> 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.
Ah ok sorry... I must admit I didn't know about the difference between:
<xsl:if test="boolean('0')">aaa</xsl:if>
vs
<xsl:if test="xs:boolean('0')">bbb</xsl:if>
(outputs 'aaa' but not 'bbb')
I thought they both behaved the same....
--
Andrew Welch
http://andrewjwelch.com
Received on Friday, 2 September 2011 10:49:57 UTC