[csswg-drafts] [css-page] @page rule should allow definition of page number formatting details

drmacro has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-page] @page rule should allow definition of page number formatting details ==
https://drafts.csswg.org/css-page-3/#at-page-rule

When creating references to page numbers of elements (target-counter()) there is currently no way for the target-counter() function to know, based on the details of the page on which the target falls, what format to apply to the page number.

This means that the page number reference must specify the page number format.

In practice this means that the element that will be rendered as a page number reference must specify, as part of its source, the format to use, either directly (e.g., page-format="lower-roman") or through a style that reflects some distinguisher on the target that the allows the correct page number format to be chosen. This is reflected in the example in the target-counter() defining in the CSS Content spec (see issue https://github.com/w3c/csswg-drafts/issues/1107).

The problem is that this requires the author of the element to be rendered as a page number reference to know, at the time of authoring or generation, what page numbering format applies, which means that there must both be coordination between the source author and the CSS author and all possible page styles applied to the source must reflect the same page numbering rules or at least the same page-number-format application distinctions. It will not always be possible or practical for the author (or more likely, generation process) to know what the page format context for a given reference is.

This level of coordination required between source and CSS creates an unnecessary and problematic dependency between things that should be otherwise largely separate (meaning that it should be possible to change *all aspects* of the layout and styling for a given source document without the need to modify the source document.

But that is not the case here.

One solution would be to add page formatting rules to the @page rule, rather than leaving it entirely a function of how page counters are rendered by the counter() function in page edge regions.

The XSL-FO model seems like a reasonable guide: the fo:page-sequence element takes properties that specify the base page number format as well as subelements that enable specifying addition folio construction details (folio-prefix and folio-suffix).

For example, something like a @folio sub-rule of @page would make sense:

```
@page frontmatter {

  @folio {
     counter-style: lower-roman;
     folio-prefix: 'FM ';
     folio-suffix: ' (' attr(status) ')';
  }

}

This would serve to both define the values to be returned by the target-counter() function when no counter format is specified and also the value returned by counter(page) when no counter format is specified.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1108 using your GitHub account

Received on Thursday, 16 March 2017 09:35:23 UTC