HTML frameset

There may be situations where an HTML frameset is appropriate for the presentation of your documents. A typical frameset arrangement puts a table of contents list in the left frame, and the main text in the right frame. When a user clicks on any title in the left frame, the content is displayed in the right frame.

A simple two-frame setup like this can be easily done with the DocBook chunk stylesheet, provided you write the frameset file by hand. The following is an example frameset file:

  <title>My Document Title</title>
<frameset cols="30%,*">
 <frame src="index.html" name="list">
 <frame src="intro.html" name="body">

This creates two frames, the left one named list and the right one named body. You need to put the table of contents file in the left frame. In a typical chunked output, that file is named index.html. You can put an introductory file into the right frame so it is not empty when the frameset starts up.

In order for links in the left frame list to show up in the right frame, you need to add <base target="body"> to the HEAD element of the index.html file. Without further customization, there is no way to put that base element into just one of the chunked files. But it still works if you put it in all of them. That just means any hot links from the body files to also appear in the body window, which is the behavior you expect.

The following customization will add the base element to all the HTML files:

<xsl:param name="target.window" select="'body'"/>
<xsl:template name="user.head.content">
  <base  target="{$target.window}"/>

Then when you open up the frameset file, you will find that all the links on the left show up on the right. But one problem with this setup is the Home link in the footer of the HTML files. That link takes you to the index.html table of contents file, but it will show up in the right frame. You will need to do an additional customization to remove that link. It is not needed, since the index.html file remains visible in the left frame. See the section “HTML headers and footers”.