A “traditional” way from XML to print:
Transform to XHTML and then apply CSS:
div.contents ol li a:after { content: " " leader(dotted) " " target-counter(attr(href, url), page); }
<div class="contents"> <h1>Table of Contents</h1> <ol><li><a href="#preface">Preface</a></li> <li><a href="#c1">Chapter One</a></li> </ol></div>
Table of Contents Preface . . . . . . . . . . . 7 Chapter One . . . . . . . . 11
All images are from fromoldbooks.org (an image site maintained by the author of this presentation) or by Liam Quin, except the viewport illustration from XSL-FO and the Open Web Platform logo from openwebplatform.org.