xsltoc - Table of Contents Generator using XSL

  1. About xsltoc
  2. Release Notes
  3. Changelog
  4. Bugs
  5. Documentation
  6. Copyright Information

About xsltoc

The xsltoc package is contributed with LayManSys and is used for generating a second level table of contents within the XHTML files on the project website. Second level means it generates the TOC using the documents <h2> elements.

Release Notes

This is a feature enhancement and bug fix release, see the Changelog for details. Because only minor changes where made, upgrading is not a must, but recommended.

This contributed package is used internally for generating a Table of Contents in XHTML files. But you can also use it for your needs. All the files you need to use the package are bundled in the ZIP archive.


Version 0.1.1 changes


The current xsltoc version only supports headings of level 2, <h2>.


xsltoc is used as an addition to normal XHTML documents, so the first step in working with the program is writing XHTML files as you always do. You do not need to specify a doctype, because xsltoc.xsl already sets one for the output; its default values are

This option is necessary to have valid XHTML output and it omits many newlines.
default XHML character set
XHTML 1.0 documents may omit the XML declaration, which is necessary if Internet Explorer should display what we want.
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
If you want to use a HTML version, do not forget changing method to "html".

The input file is treated as XML file, so there has to be the XML declaration.

The documents <head> is parsed for the <title> element and the elements content is also wrote out as the first <h1> heading (the documents main heading). You can use xsltoc.xsl to add other general markup to the output, such as CSS file references. The documents <body> omits the main heading and is copied into the output after xsltoc added the <h1> and the TOC.

See the LayManSys CVS repository for examples.

Copyright © 2006, Robert Bienert for the LayManSys project

This package is distributed under the terms of the Creative Commons Attribution-ShareAlike 2.0 license.