Re: [Fwd: Re: [whatwg] simple numbers]

Keryx Web wrote:
> 
> fantasai skrev:
> 
>> Lars, I think your point about needing to separate such formatting 
>> from the
>> markup makes sense. Could you summarize
>>   a) your arguments for why a number format function is needed
>>   b) proposed functionality
>>   c) a couple markup + expected results examples
>>
>> I'd like to put it here:
>>   http://csswg.inkedblade.net/ideas/content-formatting
>> (you can edit that yourself if you like)
>>
> 
> Done

  | ===== Numbers =====
  |
  | Proposal (draft)
  |
  | Add a CSS module for numbers
  |
  | Use XSLT's format-number syntax as a starting ground
  |
  | ==== Intended purposes ====
  |
  |    * i18n
  |    * Enhanced usability, without sacrificing accessibility or
  |      scriptability
  |    * Enhanced accessibility, without sacrificing usability or
  |      scriptability
  |
  | ==== Rationale ====
  |
  | This is a question about visual presentation. As such it should be
  | handled with CSS. No other technology can be made media-specific.

I think your examples and specific use-cases belong here. That will make
it easier to understand the problem your proposal is trying to solve.
"Accessibility" and "i18n" are very vague. I've shifted your markup
examples up as a starting point. You had several other examples that were
interesting. The better you fill out the use cases, the easier we can find
a good solution to this problem.

  | ==== New CSS rules ====
  |
  | **@decimal-format** that draws its ideas from xsl:decimal-format
  |
  | **number-format**   that draws its ideas from xsl:number-format
  |
  |
  | ==== Example CSS ====
  |   @decimal-format phone {
  |     grouping-separator: " ";
  |   }
  |   @decimal-format price {
  |     grouping-separator: ",";
  |     decimal-separator : "."
  |   }
  |   @decimal-format sweprice {
  |     grouping-separator: " ";
  |     decimal-separator : ","
  |   }
  |   @media all {
  |     td.phone {
  |         number-format: "## ##", "phone";
  |     }
  |   }
  |   @media screen {
  |     td.price {
  |         number-format: "###,##0.00", "price";
  |         /* price is actually redundant as this format would be the default */
  |     }
  |     td.price::after {
  |         content: " USD";
  |     }
  |     td.sweprice {
  |         number-format: "### ##0,00", "sweprice";
  |     }
  |     td.sweprice::after {
  |         content: " SEK";
  |     }
  |   }
  |   @media speech {
  |     /*
  |         Grouping both unnecessary and unwanted, words like
  |        "billion", "million" and "thousand" should be spelled out
  |     */
  |     td.price {
  |         number-format: "0.00", "price";
  |     }
  |     td.sweprice {
  |         number-format: "0,00", "sweprice";
  |     }
  |     td.price::after {
  |         content: " US dollars";
  |     }
  |     td.sweprice::after {
  |         content: " Swedish crowns";
  |     }
  |   }

Ok, I think you need to explain what your syntax *does*. What's the
effect of the rules in your examples? How does it become that? What
happens when these properties are applied to input that's a mix of
numbers and text? What happens if I apply the properties to <body>?

> See also http://keryx.se/dev/css3/number-format-1.xhtml (in Firefox or 
> Safari b3 - It's a true XHTML file that uses XSLT identity transformation)
> 
> Use http://keryx.se/dev/css3/number-format-1-static.html for other 
> browsers or to see the truly intended result...

CSS3's "text-wrap: suppress" should address your line-breaking concerns.

For speech readers, I would expect them to have or develop heuristics to
read numbers aloud. Credit card and phone numbers are more interesting
media-specific cases.

~fantasai

Received on Monday, 14 January 2008 18:51:37 UTC