Discussion Locked

Creating table of contents with XSLT

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi Guys,

A question, how can I create a table of contents from an XML file with rule-based XSLT stylesheet? I've been trying to do that but with my current stylesheet every text on the XML file will be transformed to html file, not just the highlights that I want to show. Know the answer? My Thanks in advance.

Martin




Table of contents

Table of contents


3 replies

by geert pante

Hi,

You know that in XSLT there are two default templates with low priority:





You use them both implicit in your example, since in the main template, you put an , causing every child to be elected for template matching, and they all match one of the default templates.

The second default template causes every node text or attribute to be displayed, which is a problem in your case.

One possible solution is to explicitly select all nodes you want to match in the main template:

An other solution is to override the second default template, and select the content of you explicitly.


by mstefanus

The selection of template helped... but there is an important attribute when you want to make a table of contents, which is mode="toc"

This discussion is closed to new replies.