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: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 8 Apr 2005 21:36:19 +1000
> In fact, I think the function you want is:
> 
> <xsl:function name="type:is-number" as="xs:boolean">
>  <xsl:param name="arg" as="xs:string"/>
>  <xsl:sequence select="matches($arg, '\d+')"/>
> </xsl:function>

This does not say what the type of the argument, originally passed to
the function was.

It might have been a string that is the string representation of a number:

   "3.1415" (is a string)

but this is completely different from:

     3.1415 (is a number).

What will really be useful is a function with an argument of item(),
that returns the real type of the argument.

This would be trivial to achieve if same-arity function overloading was allowed.

Does anybody know of another way?

Or shall we propose an exslt:type-of()  ?

Cheers,
Dimitre Novatchev

Current Thread