Subject: [xsl] The generic numeric datatype From: Justin Johansson <procode@xxxxxxxxxx> Date: Mon, 23 Jul 2007 09:06:20 +0900 |
With reference to XQuery 1.0 and XPath 2.0 Functions and Operators "Functions and Operators on Numerics that accept 'numeric' parameters accept arguments of type xs:integer, xs:decimal, xs:float or xs:double." 'numeric' is an informally defined type within the spec. A typical standard function using this type signature is: fn:abs($arg as numeric?) as numeric? To maintain the strongest possible typing and semantics when defining user functions via xsl:function, what standard datatype should be used for 'numeric' in the absence of a standard numeric predefined type? Since xs:anyAtomicType includes xs:integer, xs:decimal, xs:float and xs:double as well as all the other non-numeric atomic types, it is obviously less specific than 'numeric' and, of course, item() is laxer still. (Saxon apparently understands xdt:_numeric_ as the 'numeric' datatype, but that's not spec-compliant according to my understanding). As a consequence of there apparently being no standard numeric type, it occurs to me that standard functions such as fn:abs cannot be expressed with 100% transparency via user written functions, as multiple type-wise overloaded versions of these functions (and with the same number of arguments) would result in a duplicate function definition(s). BTW. The higher-order function wrapper for fn:abs in FXSL uses item() as the type bearer. One would not think it to be a significant effort had something like xs:numeric or xs:anyNumericType be included in the spec. Please correct me if I have something wrong. Cheers Justin Johansson
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Efficiency: predicate vs fun, Justin Johansson | Thread | Re: [xsl] The generic numeric datat, Dimitre Novatchev |
Re: [xsl] Problem with XSL and Win2, pankaj singla | Date | Re: [xsl] The generic numeric datat, Dimitre Novatchev |
Month |