[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: Fri, 8 Apr 2005 22:11:40 +0100
RE:  testing for string and number in XSLT 2.0 was Re:
> take for example xsl:sort
> <xsl:sort select="." data-type="number"/>
> what does 'number' mean here?

It's retained for backwards compatibility with XSLT 1.0; the "native" way of
doing this in 2.0 would be

<xsl:sort select="xs:double(.)"/>

if they are doubles, or more likely

<xsl:sort select="xs:integer(.)"/>

if they are integers.

> and if we are comfortable with this type of ambiguity of identifying
> something purely as a 'number'....then why not have some fairly useful
> functions such as is-number() and is-string() that exist in 
> this no mans land.

You're welcome to write your own function is-string($x) that has the same
effect as the expression ($x instance of xs:string), but the WG wants to
avoid bloating the language with redundant ways of doing the same thing.

Michael Kay

Current Thread


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.
First Name
Last Name
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.