Re: [css3-gcpm] counter() and "special" values

Also sprach Michael Day:

 > >    Are there any specially named values for counters?
 > > 
 > > E.g., can I generate content like this:
 > > 
 > >    content: "Page " counter(page) " of " counter(pages)
 > 
 > Prince treats "page", "pages", "footnote" and "list-item" as special 
 > counter values.

Right, so the above code works in Prince. 

 > However, I don't think the specifications define all these yet. There 
 > was a pages() function in a past draft of CSS3 Paged Media at one stage 
 > I believe.

In the Paged Media draft from 2004, the "page" and "pages" counters
were defined:

  http://www.w3.org/TR/2004/CR-css3-page-20040225/#number-of-pages

The "page" counter is still referred to in the latest draft:

  http://www.w3.org/TR/2006/WD-css3-page-20061010/#page-based-counters

But the magic is gone. That is, there is no text that prescribes the
creation of a counter called "page" unless it appears explicitly. Is
this what we want?

The main argument for a magic solution is that style sheets can be
shorter and that more things can be achieved. In the magic version,
your code would simply work:

   @page { @bottom-center {
     content: "Page " counter(page) " of " counter(pages);
   }}

In a version without magic, you would be abe to say:

   @page { counter-increment: page { @bottom-center {
     content: "Page " counter(page) " of " counter(pages);
   }}

However, you would not get the total page count. This is a
requirement, I believe. We could introduce functions:

   @page { counter-increment: page { @bottom-center {
     content: "Page " counter(page) " of " pages();
   }}

The magic is still there, but it it has been moved out of the
namespace for counters and into a function. Percievebly, we could add
other functions like date() and time() later.

Personally, I'm leaning towards defining the name of certain magic
counters in the GCPM draft.

  http://www.w3.org/TR/css3-gcpm/

What do others think?

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Wednesday, 30 May 2007 10:49:44 UTC