XSL template for Generating Per Page TOC for Docbook HTML Output

Sometime back I worked on this upcoming Ruby On Rails Book and helped the author convert his docbook to various formats like HTML, PDF, EPUB, Kindle etc. While working with the HTML output, I figured that the standard output spewed out by the Docbook XSL stylesheets is quite boring. So I improvised a lil, added per page TOC, pretty css, icons etc. I spent quite some time on the per page TOC feature. Here’s the XSL template that I wrote for the TOC. Continue reading