The default title pages in HTML include the legalnotice
element in its entirety. Sometimes this element can be quite long, and it becomes intrusive when it appears between the document title and the table of contents in HTML output.
You can still include your legalnotice
but put it in a separate HTML file, with a link to it from the title page. You can do that by simply setting the generate.legalnotice.link
parameter to 1 instead of the default zero.
This works for both the chunking and nonchunking HTML
stylesheets.
In your customization layer, set this parameter:
<xsl:param name="generate.legalnotice.link" select="1"/>
When processed, the title
of the legalnotice
element will appear on the HTML title page, and it will link to a separate HTML file. If the legalnotice has no title, then the text Legal Notice
is used instead. This default link text is generated using the gentext machinery, so it will be in the appropriate language.
The name of the legalnotice chunk file is generated from a combination of the prefix ln-
, plus the id
attribute value of the legalnotice
element, plus the .html
filename extension. If the element has no id
attribute, then a unique id is generated for it. A generated id is different each time the document is processed. If you want a stable filename so you can cross reference to it, say from a copyright notice you add to your footer, be sure to add an id attribute to the legalnotice element.
If you want to customize the chunk filename for legalnotice, then customize the template that matches the element in mode="chunk-filename"
as follows. The example also adds a new stylesheet parameter so you could set the filename from the command line if necessary.
<xsl:param name="legalnotice.filename">legalnotice.html</xsl:param> <xsl:template match="legalnotice" mode="chunk-filename"> <xsl:value-of select="$legalnotice.filename"/> </xsl:template>
This mode is used to create legalnotice chunk file, as well as any references to it, such as from the titlepage.
In chunked HTML output, putting a copyright string in each page's footer is a common practice, as described in the section “Inserting a copyright”. With further customization, you could also turn the copyright string into an active link that connects to the separate legalnotice page:
<xsl:template name="user.footer.content">
<HR/>
<a>
<xsl:attribute name="href">
<xsl:apply-templates select="//legalnotice[1]" mode="chunk-filename"/>
</xsl:attribute>
<xsl:apply-templates select="//copyright[1]" mode="titlepage.mode"/>
</a>
</xsl:template>
Processing the legalnotice element in mode="chunk-filename"
will generate its filename, which is used in the href
attribute of the link.
It is perfectly legal to have more than one legalnotice
in your document. You will find that they are processed in sequence, each generating a separate chunk file with its own link on the title page. You will probably want to give each one a different title
element so the reader knows from the link text what the different legal notices are for.
An HTML file's HEAD
element can contain one or more link
elements to identify relationships of the current file to other files. You can form a relationship to your separate legalnotice
chunk file using the stylesheet parameter html.head.legalnotice.link.types
. For example:
A stylesheet parameter setting like this: <xsl:param name="html.head.legalnotice.link.types">copyright</xsl:param> will generate the following in each HTML HEAD element: <link rel="copyright" href="ln-id234232.html" title="Legal Notice">
If you have more than one key word separated by spaces in the parameter, then a similar link
will be generated for each key word. If you have more than one legalnotice
element in your document, only the first one is referenced by a link
.
DocBook XSL: The Complete Guide - 4th Edition | PDF version available | Copyright © 2002-2007 Sagehill Enterprises |