Re: [xsl] expression syntax

Subject: Re: [xsl] expression syntax
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Mon, 15 Nov 2004 08:34:54 -0800
Nice, Ok, thanks for the clarification :)

David Carlisle wrote:

me>test="@foo=1"
me>
me>is false if the source has foo="1.0"
me>
me>but me>
me>test="number(@foo)=1"
me>
me>would be true in that case.
me> me>
you>again, this brings in to light the purpose of the function...


probably did, although actually the example is completely wrong:-)

comparsion of a node set to a number is one place where number() _is_
implictly applied so
@foo=1
is exactly the same as
number(@foo)=1

A better example would be comparing two attributes

@foo = ../@foo

would be false if
this node had foo="1" and its parent had foo="1.0"
as the default is string comparison but


number(@foo) = number(../@foo)

or even just one side, eg:

number(@foo) = ../@foo

would force numeric comparison so then 1.0 and 1 would be equal.

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