Forum How do I...?

Generated table of contents

misc
I'm evaluating Prince to see if it's a suitable solution for producing a press-ready PDF for our product catalogue.

I'm currently trying to set up a table of contents that's automatically generated from the <h2 class="product-name"> and <span class="company-name"> tags on each product page. Ideally it should look something like this:

Company Name | Product Name .......... Page Number

Could you tell me if this is possible, and if so, how to achieve it?

Many thanks!
mikeday
Use JavaScript to scan for these elements, then generate HTML for the table of contents that includes a link to the product section:
<a href="#prod42" class="prodlink"></a>

Which you can style with CSS generated content:
.prodlink {
    content: leader('.') target-counter(attr(href, url), page)
}