Kepler Gelotte skrev:
That's interesting. I had thought of the lang attribute as well but didn't
think that Roman Numerals were attached to any language in particular (as
Lars points out).
I think maybe the HTML specification needs something like a num attribute
that allows you to specify the numeric system (e.g. <span
num="Boolean">10011</span>). Maybe this is too much classification being
added to HTML though.
Ages ago I suggested on the WHAT-WG list that HTML 5 should have a
number element or a number attribute. Did not meet with any enthusiasm,
though.
I will try to resuscitate it. Maybe some input from the members of this
list will be of value.
-------- Problem -------------
Consider the following, more common problem:
I want to write a big number, say 2345678912.123
How big was it? Hard to see, isn't it? Let's add thousand separators the
American way:
2,345,678,912.123
Yea, now I see how big it really is.
But in Sweden we would write it like this:
2 345 678 912,123
Bu neither way is good for anyone using a screen reader. I would like
the screen reader to actually say:
2 billion 345 million 678 thousand 912 point 123
Not:
2 comma 345 comma 678 comma 912 point 123
Or:
2
345
678
912
comma
123
And I definitely would not like the number to be split across two lines
if it's at the end of one or in a table cell. This could be remedied by
using non breaking space as a thousand separator, but that's a solution
that no CMS uses as far as I know, and it does not solve the problem
with screen readers.
Numbers may also be part of something that should be machine parsable,
perhaps with JavaScript. For such a scenario it is better to not have
any thousand separators as well.
There is a CSS rule that deals with the formatting of numbers:
-mso-number-format. However, it is only used when Excel imports data
from HTML, to set the formatting in Excel.
-------- Proposed solution ------------
I would suggest the following:
<number format="base10" dec=".">2,345,678,912.123</number>
Together with a W3C approved CSS-rule: number-format, based on
-mso-number-format.
This degrades gracefully as todays browsers would just show the number
as I've formatted it manually.
Suggested formats:
1. baseN, where N normally would be 10, 2, 16 or 8, but could be any
number. Perhaps with aliases: dec, binary, hex, octal.
2. Latin
3. Fraction
4. Greek, hebrew, etc may be added as well
The actual value will be parsed by the browser and be made available to
JavaScript through a DOM-property: E.title.
This property might be added manually as well, as in:
<number format="base10" dec="."
title="2345678912.123">2,345,678,912.123</number>
Using title in this way will make the actual value available to screen
readers. (Graceful degradation once again.)
Parsing rules:
1. If there is a manually set numeric value, it shall be used.
2. If not, parse according to the format. Suggested algorithm for
decimal numbers follow:
a. Strip out everything thats not a number, except any decimal separator
and percentage sign.
b. If there is a percentage sign, divide by 100 and strip it out as well.
3. If any CSS-rule has been set, redraw the number using that. Default
rules in the browser shall follow the language. An author may override
these using the language selectors in CSS.
This allows for easy localization. I can use space as a thousand
separator - line breaks within a number element would by default be
prohibited by the browser - but any American visiting my site could
still see commas.
If it would meet with approval, this also can be expanded with:
A. Numbers as input-rules for form fields. <input type="number">
B. Attribute for table cells. I.e. <td type="number"> is short for
<td><number>
Lars Gunther
My original suggestion to WHAT-WG:
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2006-June/006530.html
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************