oXygen XML Editor

5. The customization stylesheet

The stylesheet is provided as part of a zip file, here

Description: The stylesheet has comments such as


  <-- Note 1 -->

Note 1 refers to the docbook namespace. Remember that this is docbook version 5, so the namespace is required

Note 2 refers to the import of the main docbook stylesheet. This cannot be indirected, so actually refers to the file on my hard drive. A weakness, maybe. definately something that will need changing on your setup. I'll also get caught out if I move this to another machine, or if I update the actual stylesheets, without changing this!

Note 3 is the start of the parameters. They are here if you want them at the current release. You should get used to these, since these are where the docbook team put in a lot of work to allow you to get out of the markup what you want in terms of presentation.

Note 4. This tells the XSLT processor where to find local (to the document) graphics. Recall that in Section 3 the xslt and ant build file collected all graphics and copied them to the html directory, within the graphics directory? Hence that is the correct place for the stylesheets to look for this type of graphic (as apposed to the docbook graphics, such as warnings and cautions). Note that it is a relative path, hence will appear relative to the html files; also that it is terminated with a slash ( / ), indicating it is a directory, hence the actual path might appear as graphics/pig.gif, when seen within the html

Note 5. (See also Section 2). This specifies that I want to use CSS, so the stylesheets add class attributes on many of the elements to make it easier. The stylesheet type is specified as being CSS and the stylesheet is named (either relative to the html, or an absolute pathname)

Note 6. Chunking. At the top of the customization file, you'll see

  <xsl:import href="/sgml/docbook/docbook-xsl-ns/html/chunk.xsl"/>

I have chosen to import (use) the 'chunked' version of the docbook stylesheets. This means that I want separate files for each 'chunk' of input XML. The other parameters indicate what level I want chunking. This is a personal choice, but for larger documents it makes it easier for the reader to manage. The documentation is comprehensive on chunking. There are many options and lots of choices to make.

Note 7. This is the stylesheet part of the docbook schema customization. I firstly added bits to the schema (markup for a poem), then for each element (also in the docbook namespace), I added a template in the html stylesheet, such that it is styled as I want it. I also added class attributes such that I could apply CSS styling.

That is it for the customization layer. In summary it is the first stylesheet called when a docbook file is styled (i.e.