- From: (wrong string) äper <christoph.paeper@tu-clausthal.de>
- Date: Tue, 19 Nov 2002 02:38:32 +0100
- To: <www-html@w3.org>
A while back (<mid:018701c249f7$e1d41e80$3ef4ae8b@heim4.tuclausthal.de>, <http://lists.w3.org/Archives/Public/www-html/2002Aug/0313.html>) I proposed a new element for marking up numbers. I thought a bit about it and came to the conclusion, that that approach isn't applicable for a simple markup language like (X)HTML, that should be easy to learn. The main intentions were keeping together what belongs together (value and unit, preceding minus) and are still valid. Thus I precise/correct the proposal as following: <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. /Attributes/ The Common collection A collection of other attribute collections, including: Core, Events, I18N, and Hypertext value = number <!-- could be text [CI] --> This attribute serves the actual value of the enclosed text. dim = dimension <!-- could be text [CD] --> This attribute specifies the literal dimension to the value attribute. /Examples/ | Henry <nr value="7" dim=".">VII</nr> had <nr value="6">six</nr> wives. | <nr value="355.6" dim="mm">14''</nr> display. | <nr value="123,000,255,017" dim="&">123.0.255.17</nr> is an IP address, | <nr value="49,160,1111111" dim="&"> a German mobile phone number. | We'll meet on <nr value="2002-08-22" dim="date">August 22nd</nr> | at <nr value="12:00+00:00" dim="time">twelve o'clock</nr>. | <nr value="5">Five</nr> is binary | <nr><nr>1</nr><nr>0</nr><nr>1</nr></nr>. | <nr dim="date"> | <nr value="22" dim="DD">22.</nr> | <nr value="08" dim="MM">VIII. </nr> | <nr value="2002" dim="YYYY"> | <abbr title="Anno Domini" xml:lang="la">A.D.</abbr> 2002 | </nr> | </nr> ------------------------------------------------------------------------ 5.5 Attribute Types Number Either a signed decimal number with optional signed two digit exponent and mantissa separated by a dot (e.g. -1.2345E+03), ISO [ISO 8601] or a comma separated list of numbers. Dimension A case dependent string describing a dimension according to table 1: (x and y are literal variables, 0 is numeric variable everything else is a string.) Table 1: -----+--------------------------------------------------------------- . | ordinal # | general numeric value, default & | a phone or similar number, incl. IP numbers % | percentage xy | a unit 'y' (tables 3) possibly preceded by a modifier 'x', | (table 4) and maybe succeeded by an integer as exponent. | Combinations with 0, ^, * and / are possible. $x | The currency that the (omittable) string 'x' consisting of | three uppercase chars refers to, e.g. "$USD". *x | a date or time, for values of 'x' see table 2, if 'x' is | omitted, any ISO date, time, span format is acceptable: date | keyword, a date in ISO format (2002-11-18). time | keyword, a time in ISO format. span | keyword, a time span in ISO format. zip | keyword, a postal code. ... | ... -----+--------------------------------------------------------------- <!-- date, time and span could be omitted in favor of '*', zip for '&'. Or vice versa, there could be keywords like 'ordinal' as well. --> Table 2: Date and time values -----+--------------------------------------------------------------- CC | century with leading zero, signed YY | year of century with leading zero MM | numeral month of year with leading zero DD | day of month with leading zero S | second of minute with leading zero M | minute of hour with leading zero H | hour of day with leading zero -----+--------------------------------------------------------------- Table 3a: 'Primary' SI units -----+--------------------------------------------------------------- * m | Meter * s | Second * g | Gramme <!--kg is used to define--> * A | Ampére K | Kelvin mol | Mol cd | Candela -----+--------------------------------------------------------------- Table 3b: 'Secondary' SI units -----+--------------------------------------------------------------- * J | Joule (kg·m²/s²), (N·m) * C | Coulomb (A·s) * N | Newton (kg·m/s²) * O | Ohm (kg·m²/A²·s³), (J/A²·s), (V/A) <!--actually it's Omega--> * V | Volt (kg·m²/A·s³), (J/A·s), (W/A) * l | Liter (dm³) * F | Farad (A²·s²/J), (C/V) * Hz | Hertz (s^-1) * Pa | Pascal (kg/m·s²) * W | Watt (kg·m²/s³), (J/s) -----+--------------------------------------------------------------- Table 3c: 'Tertiary' SI units -----+--------------------------------------------------------------- min | Minute (60s) h | Hour (60min) d | Day (24h) w | Week (7d) y | year (365.2425d) <!--what about fiscal etc.?--> * t | Ton (1000kg) u | Atomar Mass Unit (1.66054·10^-27kg) * eV | Electron Volt (1.60218·10^-19J) °C | Degree Celsius (-273.15 K) -----+--------------------------------------------------------------- Table 3d: Non SI units <!-- shouldn't (all) be allowed IMHO --> -----+--------------------------------------------------------------- in | inch (0.0254m) ft | foot (0.3048m) * B | byte (8bit) rad | Radiant (180°/Π) deg °| Degree ... | ... -----+--------------------------------------------------------------- (* := usually accepts prefixes, not necessarily all) Table 4: Decimal (and binary) modifier prefixes -----+-------+------------------------------------------------------- f | femto | 10^-15 p | piko | 10^-12 n | nano | 10^- 9 µ | mikro | 10^- 6 m | milli | 10^- 3 c | centi | 10^- 2 d | dezi | 10^- 1 D | deka | 10^+ 1 h | hekto | 10^+ 2 k | kilo | 10^+ 3 | 2^10 M | mega | 10^+ 6 | 2^20 G | giga | 10^+ 9 | 2^30 T | tera | 10^+12 | 2^40 E | eta | 10^+15 | 2^50 -----+----------------+---------------------------------------------- </proposal> It might be an option, to forget about the proposed element, adding the attributes to the existing element "var" instead. It would be nice if there was already a RFC or something for the Dimension attribute type. Christoph Päper
Received on Monday, 18 November 2002 20:38:25 UTC