xsl-list
[Top] [All Lists]

RE: testing for string and number in XSLT 2.0 was Re: [xsl] Test For Numeric Values?

2005-04-08 14:11:40
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
http://www.saxonica.com/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>