RE: SAXON 5.4 bug in boolean cast to number in xsl:sort

Subject: RE: SAXON 5.4 bug in boolean cast to number in xsl:sort
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 4 Aug 2000 00:32:19 +0100
> -----Original Message-----
> From: Jeni Tennison [mailto:jeni@xxxxxxxxxxxxxxxx]
> Sent: 03 August 2000 23:17
> To: Michael.Kay@xxxxxxx
> Subject: SAXON 5.4 bug in boolean cast to number in xsl:sort
> 
> 
> Mike,
> 
> You may have caught this on XSL-List.

No, I missed it. Either I hit the delete key too quick, or (as I suspect)
XSL-List mail gets to me via Jeni quicker than it does by the direct route.

>  SAXON 5.4 seems not to automatically
> cast booleans to numbers when xsl:sort has a data-type of 'number'.

There's a weirdness in the spec here: the value of the select expression
defining the sort key is always converted first to a string, and if
data-type is "number", this string is then converted to a number. The result
in this case is counter-intuitive, but it's clearly what the spec says.

If you specify a sort key of "number(contains(x,y))" the boolean result of
contains is converted to a number, this is converted to a string to form the
sort key, the fact that data-type="number" then causes this string to be
converted back to a number (it will be the same number in cases other than
NaN, infinity, etc).

Mike Kay
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread