Forum How do I...?

Total pages per section

yet
This is a followup or related to

https://www.princexml.com/forum/topic/504/reset-the-pages-plural-counter

My document contains several repetitive elements like

    <section class="account-statement">
        ........
        <div class="end"></div>
    </section>


In the bottom of each page I need to print "Page x of y":

    @bottom-right {
        content: "Page " counter(page) " of " target-counter(url(.end), page);
    }


I reset the counter for each section using

.
account-statement {
    page: statement;
    counter-reset: page 1;
}


and the out is alway "Page 1 of 0", "Page 2 of 0", ....

So somehow the target-counter() call does not work as expected.

Any idea?

Edited by yet

mikeday
Unfortunately url(.end) will not work, it will need to be an actual unique ID, #statement594 or something like that. You could add such IDs with JavaScript.
yet
Generating unique IDs would not be a problem. But how would you configure the individual content: rules with the related generated IDs?
mikeday
That might be slightly awkward, it might require a separate named page for each section.