This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Floating point numbers in XPath
- From: "Richard Jinks" <cyberthymia at yahoo dot co dot uk>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 9 Apr 2002 16:10:34 +0100
- Subject: Re: [xsl] Floating point numbers in XPath
- References: <a0510030eb8d8afade1d6@[192.168.254.19]>
- Reply-to: xsl-list at lists dot mulberrytech dot com
From: "B. Tommie Usdin" <btusdin@mulberrytech.com>
> >From: burisch@london.com
> >To: XSL-List@lists.mulberrytech.com
> >Reply-To: curtis@london.com
> >Subject: Re: [xsl] Floating point numbers in XPath
> >Date: Tue, 09 Apr 2002 15:17:00 +0100
> >
> >Jeni,
> >
> >Something caught my attention.
> >
> >You said:
> >
> >>[134] DoubleLiteral ::= (("." [0-9]+) |
> >> ([0-9]+ ("." [0-9]*)?))
> >> ([e] | [E]) ([+] | [-])? [0-9]+
> >
> >The first bit caught my attention: ("." [0-9]+)
> >This appears to me to be incorrect. It would allow .0 as a valid
> >DoubleLiteral, and runs counter to the other rules you mentioned. (+-0 -
> >
> >> "0"; 0.1 -> "0.1"; ".1" is invalid because there are <1 digits to the
> >
> >left of the decimal point.)
> >
> >Comments? It's possible I'm just having my usual lousy Tuesday...
> >
> >Regards,
> >Curtis.
>
Hi
I haven't had time to read the XPath 2 working draft yet so Jeni would
still probably be the best person to answer this, but...
This is already allowed in XPath v1, if my reading of the spec is correct -
http://www.w3.org/TR/xpath#NT-Number
[30] Number ::= Digits ('.' Digits?)?
| '.' Digits
[31] Digits ::= [0-9]+
The bit about needing at least one digit only applies for converting numbers
to strings with the string() function.
http://www.w3.org/TR/xpath#function-string
It doesn't apply for numbers as a whole, or for converting strings to
numbers
with the number() function.
http://www.w3.org/TR/xpath#function-number
As this is the case, it seems sensible to continue the trend and apply
similar
rules to the new numeric types (e.g. DoubleLiteral) in XPath 2.
Richard
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list