- From: Håkon Wium Lie <howcome@opera.com>
- Date: Fri, 12 Sep 2008 11:46:21 +0200
- To: "Refstrup, Jacob Grundtvig" <jacob.refstrup@hp.com>
- Cc: "www-style@w3.org" <www-style@w3.org>
Also sprach Refstrup, Jacob Grundtvig:
> > > 8. A book contains endmatter pages, e.g.:
> > >
> > > 8(a). Appendices that require continuation of the book's page
> > > numbering but different page headers that include the appendix number
> > > and title.
> >
> > This is a good use case. This style sheet should work:
> >
> > @page chapter {
> > @bottom-center { content: counter(page) }
> > }
> > @page appendix {
> > @top-center { content: "Appendix " counter(appendix) ":
> > " string(title) }
> > @bottom-center { content: counter(page) }
> > }
> >
> > div.appendix { counter-increment: appendix }
> > div.chapter { counter-increment: chapter }
> > h1 { string-set: title content() }
> >
> >
> > > 8(b). As in 8(a) but each appendix has its own page numbering.
> >
> > div.appendix { counter-reset: page }
> >
>
> What if these pages need to be referenced from a toc? Sometimes
> pages in appendices are numbered A-1, A-2, ... --- there may
> already exit the mechanism to do this but I think it would be a
> good use case to add.
Yes. Here's a some sample code, and sample rendering, for this use case:
http://www.princexml.com/howcome/2008/tests/appendix.html
http://www.princexml.com/howcome/2008/tests/appendix.pdf
The html file contains this code:
<html>
<style>
@page chapter {
@bottom-center { content: counter(page) }
}
@page appendix {
@bottom-center { content: "A-" counter(page) }
}
div.toc a { display: block; text-decoration: none }
div.toc a.chapter:after { content: leader('.') target-counter(attr(href, url), page) }
div.toc a.appendix:after { content: leader('.') "A-" target-counter(attr(href, url), page) }
div.chapter { page: chapter; page-break-before: always }
div.appendix { page: appendix; page-break-before: always }
#appendix1 { counter-reset: page 1 }
</style>
<body>
<div class=toc>
<a class=chapter href="#chapter1">First chapter</a>
<a class=chapter href="#chapter2">Second chapter</a>
<a class=appendix href="#appendix1">First appendix</a>
<a class=appendix href="#appendix2">Second appendix</a>
</div>
<div id=chapter1 class=chapter>....</div>
<div id=chapter2 class=chapter>....</div>
<div id=appendix1 class=appendix>....</div>
<div id=appendix2 class=appendix>....</div>
</body>
</html>
-h&kon
Håkon Wium Lie CTO °þe®ª
howcome@opera.com http://people.opera.com/howcome
Received on Friday, 12 September 2008 09:47:16 UTC