Michael Huebner wrote:
> I can get the counters that I need with the existing non-precedural (or
> "declarative") counter mechanism.
> This requires a little extra work because for every (up to a maximal)
> nesting level I have to specify a counter with appropriate CSS parent
> selectors.
> To get different numbering formats (upper-latin and decimal) I use two
> counters. The "major" counter uses "-" to skip the minor elements.
>
> Example:
> chapter:before {
> content: counter(n, upper-latin);
> }
>
> section:before {
> content: counter(n-, upper-latin) "." counter(n, decimal);
> }
>
> section > section:before {
> content: counter(n--, upper-latin) "." counter(nn, decimal);
> }
>
> section > section > section:before {
> content: counter(n---, upper-latin) "." counter(nnn, decimal);
> }
>
> Btw. the intended solution with CSS2.0 procedural counters would not
> work for me!
>
> Citation from the CCS2.0 standard:
>
>
> 12.5.1 Nested counters and scope
>
> "The self-nesting is based on the principle that every element that has
> a 'counter-reset'
> <http://www.w3.org/TR/REC-CSS2/generate.html#propdef-counter-reset> for
> a counter X, creates a fresh counter X, the scope of which is the
> element, its preceding siblings, and all the descendants of the element
> and its preceding siblings."
>
> Problem:
> This specification of the counter scope makes it difficult to use
> "counters" for directly nested elements.
>
> Example:
> section:before {
> content: counter(section-number);
> counter-increment: section-number;
> }
>
> The counter of nested section elements has yet to be reset, but
> counter-reset: section-number;
> would not work because it would also effect the counter in the element
> itself.
>
> So non-procedural counters are fine for me!
Great!
> The problem that remains is:
> 1) In the elements that reference (have an IDREF attribute pointing to)
> a section, I need to display the number of the section.
> 2) Up to now even regular attributes of the target element can not be
> displayed on the referring site.
> My point is: when you make a decision to support 2) it would be great if
> you could handle 1) in a similiar way.
> This could be achieved by handling counters as (pseudo) attributes of
> the referred element. But how can a counter be referred to, if it has no
> name?
>
> That's why I vote for a mean of identifying counters.
>
> My favorit approach is to use "counters()" instead of "counter()", using
> its name-parameter for the identification and to allow the style-parameter
> to have values not defined by the CSS2 specification.
> To allow different formating styles on different levels, the
> style-parameter could contain a format string mad of the following
> characters for every element level
> - = ignore
> d = decimal
> a/A = lower-/upper-alpha
> l/L = lower-/upper-latin
> r/R = lower-/upper-roman
>
> Example:
> section > section > section:before {
> content: counters(section-number, ".", "Lddd");
> }
Well, we can just give you our word that you'll have (2) in XXE V2.6.
> May be to stress the difference to the CSS specification, instead of the
> name "counters" a proprietary name could be used, e.g. "index",
> "numbering" or so.
You are right but it is a bit too late to change this for current
counter/counters which are already different from the CSS specification.