Re: [xsl] typing of integer operations in Xpath2

Subject: Re: [xsl] typing of integer operations in Xpath2
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Apr 2004 00:27:06 +0100
> I suspect his problem is that, without a schema, all elements from the input 
> XML file (e.g., foo/bar) default to double unless cast.  But, he didn't 
> provide enough detail to be sure.

They don't directly default to double they default to untypedatomic,
which is cast to double when used in an arithmetic operation but cast
to integer when used in an integer valued operator, so

given height="3"


1 to @height

works as @height gets cast to integer

1 to (@height + 1) 

fails as (@height + 1) is a double

and the case I had mostly

1 to $foo

works or not, depending on vagaries of the way the param foo is passed.

At best this could be described as weird.

If it was true that _everything_ (numeric) defaulted to double that would
be OK, and would be like the XPath 1 situation where substring(),
numeric predicates and friends all take doubles as arguments even though
logically one might have expected integers (Xpath1 not having integers)
if the "to" operator took a double, the above would have worked.
That would be fix "1" in my list (although the ordering was arbitrary, I
didn't mean to imply that was my preferred fix)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. 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