Saxon 6.5.3 boolean function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Saxon 6.5.3 boolean function

Néstor Boscán
Hi
 
I'm using the boolean function in Saxon 6.5.3. If I pass 'false' I get true as the result. For example:
 
<xsl:value-of select="boolean ('false')"/>
 
The result is true.
 
Is there something wrong with the function?
 
Regards,
 
Néstor Boscán
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Saxon 6.5.3 boolean function

Andrew Welch
> I'm using the boolean function in Saxon 6.5.3. If I pass 'false' I get true
> as the result. For example:
>  
> <xsl:value-of select="boolean ('false')"/>
>  
> The result is true.
>  
> Is there something wrong with the function?

This a faq:

http://www.dpawson.co.uk/xsl/sect2/bool.html#d2657e54

However that's quite a long winded answer... basically the boolean
value of a string is true if it non-empty and false if it is empty.
The string 'false' is non-empty and therefore returns true.  You would
want to use the functions true() and false() eg
select="boolean(true())" or simply select="true()".

cheers
andrew


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Saxon 6.5.3 boolean function

Michael Kay
In reply to this post by Néstor Boscán
No, the spec says that when converting from a string to a boolean, the zero-length string is treated as "false" and everything else is treated as "true".
 
Michael Kay
http://www.saxonica.com/


From: [hidden email] [mailto:[hidden email]] On Behalf Of Néstor Boscán
Sent: 08 September 2005 00:37
To: [hidden email]
Subject: [saxon] Saxon 6.5.3 boolean function

Hi
 
I'm using the boolean function in Saxon 6.5.3. If I pass 'false' I get true as the result. For example:
 
<xsl:value-of select="boolean ('false')"/>
 
The result is true.
 
Is there something wrong with the function?
 
Regards,
 
Néstor Boscán
Loading...