Re: Element for Numbers

Mikko Rantalainen <mira@st.jyu.fi>:
> Rowland Shaw wrote:
>
>> <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".

I thought about that, too, but didn't want to propose two new elements at
once, 'dt' is already used, though. On the other hand, if this required a
module on its own after all, I'd rather see two elements than one in it,

> <date time="2002-11-19T13:24:38+02:00" lang="fi">13:25 19.11.2002</date>

That would be reasonable, although the lang attribute is gone and I suppose
the literal date was in the document language.

> Default rendering would be to replace content
> with localized date and time.

I'm not so sure about that. The document language is IMHO more important,
but if for instance the document has Content-Language: de and/or <html
xml:lang="de" ...> then somewhere in the text appears <nr value="1234.5"
dim="m">1'234,5m</nr>, which appears to be the de-CH form, but the UA is
de-DE, it should replace the content with "1.234,5 m". Make your own example
for en-UK/en-US and a date.

> Rendering content inline and displaying it
> localized in a tooltip or equivalent could be OK, also.

Tooltip or something like

  nr::after {
    content: "(" attr(value) "\2009" attr(dim) ")";
    white-space: nowrap;
  }

No localisation, i.e. conversion, here, though.

> As for numbers, I'd just use nr element with only a few types:

I don't like 'type' to be used as an attribute name, if its value isn't a
MIME type.

> <nr type="integer" value="32847983265981263589632">3.3e22</nr>

I like this example of space saving.

> <nr type="real" value="3.14159265359">PI</nr> -- a real number

So, should 'value' be allowed to have symbols like &pi;, e (Euler) or even
whole equations in it?

> nr element could also have attribute called "unit" and

'Unit', 'dim' -- whatever.

> possible values for it would be si units plus 3 letter currency acronyms.

These are the most important, but imagine

  "I paid 7 camels for my second wife."

One of the reasons for my proposal was to have an element that enclosed the
number and its 'unit', in this case  <nr>7 camels</nr>, thus having the
possibility to avoid linebreaking between them. What should the attribute
for this example look like?

> unit should probably allow things like "mm^2" and "m/s" too.

It really should, but it doesn't make implementation easier.

> That stick is <nr value="0.6" unit="m">2 feet</nr> long.

That's only approximately used correctly.

> Just my <nr value="0.02" type="real" unit="EUR">2 cents</nr>.
> Just my 2 cents (0.02 EUR).

This is a bad example, IMO. It's an example for when the attributes should
be omitted.

Christoph Päper

Received on Tuesday, 19 November 2002 10:26:55 UTC