The best way to customize the stylesheets is to write your own “driver” file; this is a document which contains your local modifications to the stylesheet and then includes the stylesheet from the standard distribution by reference. This allows you to make local changes and extensions without modifying the distributed files, which makes upgrading to the next release much, much simpler.
The basic driver file looks like this:
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ <!ENTITY dbstyle SYSTEM "docbook.dsl" CDATA DSSSL> ]> <style-sheet> <style-specification use="docbook"> <style-specification-body> ;; your stuff goes here... </style-specification-body> </style-specification> <external-specification id="docbook" document="dbstyle"> </style-sheet>
Make sure that you specify, in the system identifier, the full path to the docbook.dsl file that you want to customize; for example, \docbook\print\docbook.dsl.
Note: The next stylesheet release will probably use public identifiers to locate the stylesheets, which will simplify this problem a bit (at the cost, naturally, of a little more complexity elsewhere; sigh).
You can add your own definitions, or redefinitions, of stylesheet rules and parameters where
;; your stuff goes here...occurs in the example above.
The plain.dsl stylesheet in the docbook/print directory is a customization of the docbook.dsl print stylesheet. It turns off title page and TOC generation.
A DSSSL style-sheet
consists of one or more style-specification
s. This allows one to build a single stylesheet
that can format with either the print or HTML backends.
All you need is a customization skeleton that looks like this:
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ <!ENTITY % html "IGNORE"> <![%html;[ <!ENTITY % print "IGNORE"> <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl> ]]> <!ENTITY % print "INCLUDE"> <![%print;[ <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl> ]]> ]> <style-sheet> <style-specification id="print" use="docbook"> <style-specification-body> ;; customize the print stylesheet </style-specification-body> </style-specification> <style-specification id="html" use="docbook"> <style-specification-body> ;; customize the html stylesheet </style-specification-body> </style-specification> <external-specification id="docbook" document="docbook.dsl"> </style-sheet>
If this is both.dsl, I can format my document using the print stylesheet by running
jade -t rtf -d both.dsl#print file.sgmand using the HTML stylesheet by running
jade -t sgml -i html -d both.dsl#html file.sgmwhich is kindof neat. (I've built some additional machinery on top of this to make the selection automatic from within ADEPT and a shell script that I use.)
An alternative method for doing this is simply to use marked sections in the stylesheet, like this:
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ <!ENTITY % html "IGNORE"> <![%html;[ <!ENTITY % print "IGNORE"> <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl> ]]> <!ENTITY % print "INCLUDE"> <![%print;[ <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl> ]]> ]> <style-sheet> <style-specification use="docbook"> <style-specification-body> ;; common customization can go here <![%print;[ ;; customize the print stylesheet here ]]> <![%html;[ ;; customize the html stylesheet here ]]> </style-specification-body> </style-specification> <external-specification id="docbook" document="docbook.dsl"> </style-sheet>
Titlepages are controlled by several variables:
Controls whether or not a titlepage is generated. If, for
example, %generate-book-titlepage% is true, a titlepage
will be generated for Book
s.
Specifies the elements which should occur
on the titlepage recto. This variable is a list of GIs. For example, if book-titlepage-recto-elements is '("TITLE" "SUBTITLE" "AUTHOR"), then the Title
, SubTitle
,
and Author
elements in the division or component's *Info
element will appear on the Book
's titlepage
recto.
Specifies the elements which should occur on the titlepage verso.
The content of the titlepage is drawn from the *Info
element
at the beginning of a division or component. If %titlepage-in-info-order% is true, the elements on the titlepage will occur in the order
in which they appear in the *Info
element. Otherwise, the
elements occur in a fixed order given by the element-titlepage-side-elemnts.
For some elements, such as Part
s, it may make sense to place the TOC for that element (if it is
generated) on the same page sequence as the titlepage. If %generate-element-toc-on-titlepage% is true, that's what will
be done.
Part
s and Reference
s can begin
with a PartIntro
. If %generate-partintro-on-titlepage% is true, the content of the PartIntro
will occur
on the same page sequence as the titlepage.
The most common customization is probably setting %generate-element-titlepage% to true and changing the list of elements in element-titlepage-recto-elements and element-titlepage-verso-elements
There are a few other functions that you may wish to change:
This function is called before each new type
of element on the titlepage (before the first Title
, before
the first SubTitle
, etc.). The node
will contain the element that will appear on the titlepage next and side will be either 'recto or 'verso.
This function
is called for each element on the titlepage. For example, the Abstract
on a Book
titlepage is printed by the book-titlepage-abstract function.
This is just a placeholder. This needs to be written. Basically, you just need to use catalog files to make sure that the XML instances and the stylesheets get parsed with the correct declarations.