BODY attributes

By default, the HTML stylesheets add several attributes to the generated HTML BODY element. These attributes are added with the following named template in html/docbook.xsl:

<xsl:template name="body.attributes">
  <xsl:attribute name="bgcolor">white</xsl:attribute>
  <xsl:attribute name="text">black</xsl:attribute>
  <xsl:attribute name="link">#0000FF</xsl:attribute>
  <xsl:attribute name="vlink">#840084</xsl:attribute>
  <xsl:attribute name="alink">#0000FF</xsl:attribute>
</xsl:template>

This results in a body element in the HTML output like the following:

<body bgcolor="white" text="black" link="#0000FF"
vlink="#840084" alink="#0000FF">

If you want to add, change or remove any of these attributes, you should copy this template to your customization layer and make your changes there. For example, you could remove all of the default attributes to allow your CSS stylesheet to handle the styling, and you could add an event handler attribute as in this example.

<xsl:template name="body.attributes">
  <xsl:attribute name="onLoad">alert('Thanks for visiting')</xsl:attribute>
</xsl:template>

This will result in the following HTML body element, which triggers a Javascript alert message each time the document is opened:

<body onLoad="alert('Thanks for visiting')">