|Kongregate Registration for Free Flash Games and Chat with solprovider|
Adding a Menu of the Header tags within a Document
This explains how to add an automatically updated menu of all the Header tags within a Lenya document. It handles all 6 levels of headers (H1, H2, H3, H4, H5, H6), and only requires changing the XSL and CSS.
This solution depends on CSS for formatting the data; the XML data is never hierarchical. I have not found an easy method to create a hierarchical data structure from flat (non-hierarchical) data using just XSL. This means an H4 directly under an H2 will still be formatted (indented) as an H4, which is probably the desired display.
The anchors are named like "h3-7" (tag name + "-" + absolute position) to solves the issues of duplicates and url-encoding the text, but makes the names much less memorable. The tag name and the dash are not necessary; they are remnants of earlier attempts.
Put this line where you want the headers menu:
Add these matches:
Add this to your CSS (to indent each level):