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

Subject: RE: [xsl] testing for string and number in XSLT 2.0 was Re: [xsl] Test For Numeric Values?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 9 Apr 2005 23:15:39 +0100
>         y variable value(so we know we are selecting it): 3123123
>         Test y as string:true
>         Test y as integer:true
> 
> back to my original question, how can I test if a value is a string or
> integer (with the very real constraint of data not being 
> explicitly typed).
> 

If the data is untyped then ($x castable as xs:string) will always be true.
If the string consists of digits then ($x castable as xs:integer) will also
be true, as your experiments show.

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

Current Thread