XML technologies / DocBook / Generating (X)HTML / Formatting (X)HTML with CSS / Adding a reference to a CSS file

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

To make your (X)HTML files use CSS, set the parameter html.stylesheet to your CSS file during transformation:

xsltproc --stringparam html.stylesheet css/book.css

This creates the following element in the HTML file:

<link rel="stylesheet" href="css/book.css" type="text/css"/>

You can pass more than one file to the parameter. Alternatively, use @import within the CSS file itself to reference other files. Enclose the file names in quotation marks, separated by spaces. For more specialized requirements, customize the template named output.html.stylesheets in the file docbook.xsl to suit your needs.

  

back to top