I have a numbering scheme set up for a large document with a bunch of nested <section> tags. The idea is to show the number of the top level sections and then the page number within that.
So, with some markup that's nested like this:
only the top level sections should be counted and the page count should reset for every new top level section. The output should look like this (depending on how long the nested sections are):
1-1
1-2
2-1
2-2
2-3
3-1
3-2
3-3
I actually have it working in the table of contents, which is using target-counter, but when I try to display the same counter in the page footer, the first number is always 0 and the second one works fine.
The CSS looks like this:
The 'report-tag' elements are part of the markup that's inserted into the footer (using flow()). The class names aren't really relevant because I'm overriding some existing behavior (that also works fine).
Again, the numbering in the TOC is working how I want and both places are using the same counters so I'm not sure why the ones in the footer aren't working.
So, with some markup that's nested like this:
<section>
<section>content</section>
<section>content</section>
<section>content</section>
</section>
<section>
<section>content</section>
<section>content</section>
<section>content</section>
</section>
<section>
<section>content</section>
<section>content</section>
<section>content</section>
</section>
only the top level sections should be counted and the page count should reset for every new top level section. The output should look like this (depending on how long the nested sections are):
1-1
1-2
2-1
2-2
2-3
3-1
3-2
3-3
I actually have it working in the table of contents, which is using target-counter, but when I try to display the same counter in the page footer, the first number is always 0 and the second one works fine.
The CSS looks like this:
section {
counter-increment: section;
counter-reset: page 1;
}
section section {
counter-increment: none;
counter-reset: none;
}
.toc a:after {
content: leader('. ') target-counter(attr(href), section) "-" target-counter(attr(href), page);
}
.report-tag.current-page {
content: counter(section);
}
.report-tag.total-pages {
content: counter(page);
}
The 'report-tag' elements are part of the markup that's inserted into the footer (using flow()). The class names aren't really relevant because I'm overriding some existing behavior (that also works fine).
Again, the numbering in the TOC is working how I want and both places are using the same counters so I'm not sure why the ones in the footer aren't working.