W3C home > Mailing lists > Public > www-style@w3.org > March 2012

[css3-gcpm] Numbers in 'string-set', 'string()'

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Tue, 27 Mar 2012 08:17:42 +0200
Message-Id: <9F987CCA-2FB2-4D0D-A58B-CB348232A285@crissov.de>
To: www-style CSS <www-style@w3.org>
GCPM introduces document-dependent text variables with the ‘string-set’ property and the ‘string()’ pseudo-function usable within the ‘content’ property. <http://dev.w3.org/csswg/css3-gcpm/#running-headers-and-footers>, paraphrased:

Property values for ‘string-set’

  <string-set>   := [<identifier> <content-list>]# | ‘none’

  <content-list> := <string> | <counter> | <text-content> | <environment>

  <text-content> := ‘contents’ | ‘content-element’ | ‘content-before’ | 
                    ‘content-after’ | ‘content-first-letter’

  <environment>  := ‘env(’ [ ‘url’ | ‘date’ | ‘time’ | ‘date-time’ ] ‘)’

Pseudo-function parameters for ‘string()’

  <content-addon>:= ‘string(’ <identifier> [‘,’ <assignment> ]? ‘)’

  <assignment>   := ‘start’ | ‘first’ | ‘last’ | ‘first-except’

I was wondering whether it would make sense to have the string be typed sometimes, either on input or output. 

The ED already notes for the ‘env()’ pseudo-function that it might be desirable to have date and time localizable. It is also true for all kinds of numbers, e.g. standard or local digit glyphs, decimal or different base, unit incl. monetary and percentage before or after, unit symbol or name, decimal and group marker, group size, precision, scientific or engineering exponential format, leading and trailing zeros, … 

Number format is a complex matter where you could only provide a very limited set of predefined styles as keywords, the rest would have to be user-defined, e.g. with ‘@number-style’ akin ‘@counter-style’. Therefore you could hardly use separate pseudo-functions. I’m not sure how it would actually look like, e.g.

 ‘@number-style’ <identifier># ‘{’ … ‘}’

From the little brainstorming I’ve done over this I think I like an addition to ‘string()’ that parallels ‘attr()’ the best and am uncertain whether we would need keywords like ‘contents-numeric’:

  <content-addon>:= ‘string(’ <identifier> <type>? [‘,’ <assignment> ]? ‘)’
  <content-addon>:= ‘string(’ <identifier> <type>* [‘,’ <assignment> ]? ‘)’

I liked the special word ‘as’, but that has been dropped from ‘attr()’. Note that the types are not the same, because ‘attr()’ is for input, hence cast to CSS value types, and ‘string()’ is for output to be read by human beings.

Bastard use-case:

  td {string-set: data contents; content: string(data percent);}



I’d admit that something like

  td {number-style: percent;}

seems to look more intuitive, at first glance at least.

PS re ‘content-before’ and ‘content-after’: I don’t know why it should be possible at all to use content that was generated by CSS itself and put into ‘::before’ and ‘::after’’, but that’s not my point today.
PS re ‘env()’: I believe that pseudo-functions should only be used with (mostly) user-defined parameters, not with a predefined list of keywords, but that isn’t the point of this mail either.
Received on Tuesday, 27 March 2012 06:18:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:13 UTC