This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XSLT 2.0 format-number() question


Hi Mike,

> XSLT 2.0 says, regarding format-number():
>
> "The number is supplied as the value of the first argument. The
> required type of this argument is xsd:double; if the value is not of
> the right type, it is converted using the standard conversion rules"
>
> I'd like this to be more clear. What are "the standard conversion
> rules"?
>
> I have an idea what they are, but I'd like to not have to guess. Can
> we get an actual reference in there?

The functions defined in XSLT 2.0 are specified as being
"XSLT-specific additions to the core XPath function library", so it's
not too big a leap to get to the "function conversion rules" described
in Section 2.2.4 of XPath 2.0
(http://www.w3.org/TR/xpath20/#id-function-calls), but I agree that it
wouldn't hurt to have a reference to this section at the beginning of
Section 14 of the XSLT 2.0 spec.

> I also noticed XSLT 1.0's format-number() doesn't say that the
> conversion of the first argument to a number occurs at all; should I
> assume that it does?

In Section 3.2 of the XPath 1.0 spec
(http://www.w3.org/TR/xpath#section-Function-Calls) it says (my
emphasis):

 "A FunctionCall expression is evaluated by using the FunctionName to
  identify a function in the expression evaluation context function
  library, evaluating each of the Arguments, **converting each
  argument to the type required by the function**, and finally calling
  the function, passing it the converted arguments."

Since calls to the format-number() function are just like calls to any
other function, and format-number() is defined as requiring a number
as its first argument, I think it's reasonable to assume that the
first argument to format-number() gets converted to a number.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]