W3C home > Mailing lists > Public > www-html@w3.org > November 2002

Re: Element for Numbers

From: Mikko Rantalainen <mira@st.jyu.fi>
Date: Tue, 19 Nov 2002 14:01:51 +0200
Message-ID: <3DDA282F.6080709@st.jyu.fi>
To: www-html@w3.org
Cc: Rowland Shaw <Rowland.Shaw@crystaldecisions.com>

Rowland Shaw wrote:
> Christoph Päper wrote:
>> 
>> <proposal>
>> 
>>  Element | Attributes              | Minimal Content Model
>> ---------+-------------------------+-----------------------
>>  nr      | Common, value (Number), | (PCDATA | Inline)*
>>          | dim (Dimension)         |
>> 
>> X.Y The *nr* element
>> 
>> The nr element indicates that a text fragment is of a numeric kind (e.g.
>> date, measurement, price). It may supply a standardized representation of
>> the enclosed term and may then be treated as a replaced element: the UA
>> replaces the contents by a form best matching the document language and
>> user preferences.

> Seems like a reasonable suggestion, a few comments I'd make:

> * I would see dates in a separate element

> I'd prefer the date and time to be something more akin to:

> <p>It's my birthday on <date month="11" day="23" year="2002"
> form="shortdate">23/11/02</date></p>

Please, we have perfectly good standard for date and time presentation: 
ISO-8601. I agree that we need both "generic numeric element" and 
"datetime element".

How about something like
<date time="2002-11-19T13:24:38+02:00" lang="fi">13:25 19.11.2002</date>
and no other format for time attribute would be allowed. Shorter forms 
defined in ISO-8601 would be OK, though. And I'd allow space instead of 
"T" between date and time. Default rendering would be to replace content 
with localized date and time. Rendering content inline and displaying it 
localized in a tooltip or equivalent could be OK, also.

As for numbers, I'd just use nr element with only a few types:
<nr type="integer" value="32847983265981263589632">3.3e22</nr> -- a 
large integer could be marked up like this in a table for space 
considerations.
<nr type="real" value="3.14159265359">PI</nr> -- a real number
<nr type="literal">123.56.123.62</nr> -- something like IP number where 
UA shouldn't touch the value. "literal" type would be the default.

IMO, XHTML doesn't require other numeric types. nr element could also 
have attribute called "unit" and possible values for it would be si 
units plus 3 letter currency acronyms. unit should probably allow things 
like "mm^2" and "m/s" too.

That stick is <nr value="0.6" unit="m">2 feet</nr> long.
Just my <nr value="0.02" type="real" unit="EUR">2 cents</nr>.

Minimum rendering would be to display element's contents inline and 
provide a method to access the standard value (a tooltip or rendering it 
inside parentheses would be ok) which would be rendered as "$value 
$unit". For example, tty rendering for the above could be

That stick is 2 feet (0.6 m) long.
Just my 2 cents (0.02 EUR).

I'm still wondering if a language like XHTML should also have attribute 
called "precision" for nr. Usage would be <nr type="real" value="3.14" 
precision="1e-2">PI</nr>. I think it should be limited for type="real" only.

-- 
Mikko
Received on Tuesday, 19 November 2002 07:33:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:53 GMT