W3C home > Mailing lists > Public > www-style@w3.org > May 1997

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

From: Paul Prescod <papresco@calum.csclub.uwaterloo.ca>
Date: Thu, 08 May 1997 19:15:25 -0400
Message-ID: <33725E8D.9657ED2F@calum.csclub.uwaterloo.ca>
To: www-style@w3.org
David Perrell wrote:
> 1. HTML documents might be part of a larger document. How do you
>    specify an element's start number using the DSSSL method?

I presume you are talking about multiple HTML documents making up a
single logical document. I don't see how this can be handled
automatically by any stylesheet system. I think you want to know how you
just manually start the counting at a particular number. Choose a
syntax:

H1:before { "Section " element-number in BODY  + 5 }

or

H1:start { 5 }
H1:before{ "Section " element-number }

Again, no predeclaration required. Constrained predeclaration (basically
"macros" or "entities") could shorten the syntax without introducing the
problems of global variables.

> 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 "." )

or

H1:counter-style { alpha }
H1:before { "Section " element-number( lower-alpha ) }

Again, constrained predeclaration (something like macros) could shorten
the syntax without introducing problems or weakening the power.
 
> 3. What's the proper syntax for referencing an ancestor element's
> number?

I dunno. Use whatever syntax you like. Maybe one of these:

H1:before {"Section " element-number DIV in BODY "." element-number in
BODY}

H1:before { DIV:before "." element-number in BODY }
 
> 4. Would an element's number include occurrences of its subclasses?
>    (i.e. would P.first be included in P's child-count?)

I would say yes for three reasons:

#1. People in the HTML/CSS world are encouraged to make up new classes
whenever they need it. This habit could cause some really mysterious
renumbering problems.

#2. People in the SGML world are not used to thinking of one attribute
changing an element's fundamental type.

#3. A subclass is still an instance of this class. If you want certain
instances to behave different han the others, then you should make a NEW
subclass.

I haven't thought this syntax through. I suspect that the simple cases
can be VERY SIMPLE (simpler than with declared counters) and that
extremely advanced cases can be handled as elegant extensions.

 Paul Prescod
Received on Thursday, 8 May 1997 19:19:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:50 GMT