[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Cannot compare xs:untypedAtomic to xs:double

Subject: Re: Cannot compare xs:untypedAtomic to xs:double
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Jul 2015 20:49:16 -0000
Re:  Cannot compare xs:untypedAtomic to xs:double
> On 29 Jul 2015, at 19:54, Jorge . chocolate.camera@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> When comparing numeric values of node attributes to a double, I have
> to explicitly convert those attribute values too into a double or else
> Saxon complains that I cannot compare an untyped value to a double.

Saxon of course is only doing what the XSLT 2.0 specification requiresb&.

The general comparison operators like b<b (unlike bltb) convert an
untyped operand to the type of the other operand. This is often handy, but it
does make optimization more difficult (for example, Saxon-EE isnbt able to
use hashing and indexing unless it can infer the types of the operands
statically).

>
> Considering that the input tree actually is generated some steps above
> via an identity copy and stored into a variable, is there a way to
> create it so that Saxon does know that those attribute values are
> doubles

Yes, you can make the stylesheet schema-aware, in which case the numeric
attributes will be labelled as numeric rather than being untyped.

Michael Kay
Saxonica

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.