Re: auto-numbering in CSS (was: content property)

Paul Prescod wrote:
> .... I think you want to know how you
> just manually start the counting at a particular number. Choose a
> syntax:
> ...

I think you're missing my point. Consider a 10-chapter document with
each chapter a separate file. H1 is used for chapter titles, so there
is only one instance of H1 per document. In an _external_ stylesheet
used for all chapters (using yet another speculative simplified syntax
for accessing element properties)...

  H1:before { content: number ". " }
  H2:before { content: H1?number "." child-number ". " }

(Note that a DIV will be needed to force H2 child-numbering to work.)

Now, in a style declaration at the beginning of chapter 5, all you need
is...

  H1        { number: 5 }

and, according to rules of cascading, all the relative numbering will
be correct.


> > 2. How to specify the number type (i.e. decimal, lower-alpha,
etc.)?
> 
> I dunno. Use whatever syntax you like. Maybe one of these:
> 
> H1:before { "Section " element-number-lower-alpha in BODY + 5 "."}
> H1:before { "Section " element-number( lower-alpha ) in BODY + 5 "."}
> H1:before { "Section" lower-alpha( element-number ) in BODY +5 "." )

Looks pretty confusing to me. Why not declare the number type
associated with the element as part of the element declaration?

  H2     { number-type: lower-alpha }

This makes for a much simpler numbering declaration, as noted in
previous examples.

David Perrell

Received on Thursday, 8 May 1997 21:19:29 UTC