Forum How do I...?

counter-reset for folios

Hello PrinceXML users
I want to reset the page counter to 1 starting from 1st chapter including appendices.
This is to change from lower-roman folio for frontmatters to decimal folio for chapters, appendices

What should I change to achieve this ? Can you help me ?
Here is the html code:
<div class="preface">
<div class="chapter">
<div class="appendix">

Here is the css code:
div.chapter:first-of-type {
   counter-reset: div.chapter
@page standard { 
   @bottom-left { content: counter(page, decimal)}
@page frontmatter { 
   @bottom-left { content: counter(page, lower-roman)}
Try this:
div.chapter { counter-reset: page 1 }
div.chapter ~ div.chapter { counter-reset: none }

The :first-of-type pseudo-class only matches elements that are the first element with that name in their parent. So it won't match the chapter div, as there is already an earlier div element, the preface div.

There isn't actually a direct way of saying "match the first element that matches this other selector", but an indirect way of doing it is to match all the chapter divs, and then override that with another rule that matches all the chapter divs that follow a chapter div, which excludes the first chapter div.

Edited by mikeday

Hello mikeday
thanks very much; this works perfectly.
regards, Peter