Re: [xsl] expression syntax

Subject: Re: [xsl] expression syntax
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 15 Nov 2004 14:10:05 GMT
> Yeah, the "2004-11-15" not being considered a number I knew, but without 
> referencing the spec I was unsure of the exact nature of the number 
> function and what the intended primary purpose was.
> 
> > ... which, BTW, doesn't compare true in any comparison with anything, 
> > including itself.
> 
> Wait, are you refering to attember a cast to a number and then 
> comparing?  Obviously if compared to another string of equal value it 
> would evaluate to true... or am I missing something that is important to 
> understand in the comparison of this particular string?

yes the string is equal to itself but 
number("2004-11-15")
 is not equal to 
number("2004-11-15")

as they are both NaN and NaN compares false with everything (with any
comparison operator).  This is why one way of testing if @foo contains a
numeric value is to test
test="number(@foo)=number(@foo)"

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread