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 18:59:21 +0100
> I repeated your experiment with Saxon 8.4, changing only the variable
> definition of $y to:
> 
>       <xsl:variable name="y" select="data(example/test/text())"/>
> 
> and still got:
> 
>        $y variable value: 132131
>        Test as string:false
>        Test as integer:false
> 
> It seems to me that the test as xs:string should be positive, because
> the typed value of a text node must be by definition xs:string.
> 

No, the typed value of a text node is by definition untypedAtomic - see

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

untypedAtomic is a chameleon type that is automatically cast to the type
required by the context where it is used.

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

Current Thread