Re: Options as strings. Blech.

On 2 September 2011 18:51, Norman Walsh <ndw@nwalsh.com> wrote:
> Andrew Welch <andrew.j.welch@gmail.com> writes:
>> 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....
>
> No, XPath 2.0 preserves the 1.0 semantics for fn:boolean() because,
> well, because there were lots of folks used to it. The semantics
> of xs:boolean derive from XML Schema, I think.

Ah ok, I thought xs:boolean got it 'wrong'... I remember reading
(possibly on xsl-list) that treating 0 and 1 as booleans was a
hangover from previous times was only kept around for backwards
compatibility... I never knew fn:boolean was different.  Maybe that
was an attempt to do the right thing?


-- 
Andrew Welch
http://andrewjwelch.com

Received on Friday, 2 September 2011 18:01:58 UTC