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

RE: testing for string and number in XSLT 2.0 was Re:

Subject: RE: testing for string and number in XSLT 2.0 was Re: Test For Numeric Values?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 10 Apr 2005 00:30:34 +0100
compare number xsl
> Yes, I saw this in the spec, too.
> 
> I have two questions:
> 
>   1. What was the reason for the decision that the typed value of a
> text node must be of type xdt:untypedAtomic ? If the node is a *text*
> node, then its value must be *text* -- that is *string*.

WGs don't document their reasons for a decision unless challenged. It might
be that different people have different reasons. Sometimes no-one likes it
the way it is, but no-one can suggest an alternative that everyone
prefers...

You seem to be arguing that the typed value should be a string based on some
kind of notion that the English words "text" and "string" are related -
which isn't a good enough reason.

One rationale is that the typed value of the text node should be the same as
the typed value of its containing element.

Another rationale is that nothing in a document should be strongly typed
unless there is a schema to say what the type is.
> 
> 
>   2. I didn't find in the F & O spec any explanation why a value
> comparison (such as lt) of two xdt:untypedAtomic values treats them as
> strings. Why not as integers? Why/how this happens? Is there something
> like a "preferred/default datatype" for the value-comparison
> operators? 

The rule isn't in F+O, it's in the XPath language book, at

http://www.w3.org/TR/xpath20/#id-value-comparisons

(see rule 4)

The rationale here, I think, is that lt and le should behave the same as eq,
and string comparison is the most usual eq comparison and therefore the
default.

Michael Kay
http://www.saxonica.com/

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.