General DSSSL stylesheet Questions

1 How do I customize the default stylesheets?
2 How do I include images?
3 How do I center images in print output?
4 Which tools are best for converting graphic files to other formats?
5 How do I generate an index?

1 How do I customize the default stylesheets?

In chapter 4 of DocBook; TDG you'll find a section covering this topic.

In short: write your own driver file, e.g.:



<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY html-ss
  PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
<!ENTITY print-ss
  PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl>
]>

<style-sheet>
<style-specification id="print" use="print-stylesheet">
<style-specification-body> 

;; customize the print stylesheet

</style-specification-body>
</style-specification>
<style-specification id="html" use="html-stylesheet">
<style-specification-body> 

;; customize the html stylesheet

</style-specification-body>
</style-specification>
<external-specification id="print-stylesheet" document="print-ss">
<external-specification id="html-stylesheet" document="html-ss">
</style-sheet>

and use this stylesheet file for processing your source file with (open)jade (providing the stylesheet pathname as a command line option like -d ./mystyle.dsl). Choose the corresponding part for HTML or print output by setting the variable print or html using the command line option -i (e.g. -i print).

2 How do I include images?

tbd.

3 How do I center images in print output?

Add the following to your customization stylesheet:

(element imagedata
  (if (have-ancestor? (normalize "mediaobject"))
    ($img$ (current-node) #t)                 
    ($img$ (current-node) #f)))

(This is a bug in the default stylesheets which will be resolved in the near future)

4 Which tools are best for converting graphic files to other formats?

There are for sure many possible solutions, but most people would like to try convert from the ImageMagick package.

5 How do I generate an index?

Very short description:

  • Mark your entries for the index using the DocBook tags <indexterm>, <primary>, etc.

  • Generate an empty index file using collateindex.pl -N.

  • Generate the raw index data using (open)jade with the option -V html-index.

  • Process the raw index data usaing a command like collateindex.pl -o index.sgml HTML.index.

  • Include this generated index file in your SGML source file, e.g. using an external entity:

    
    <!DOCTYPE article ....
     <!entity index SYSTEM "index.sgml">
    ]>
    

    and put the following line at the place you want the index to appear in your document:

    &index;
  • Generate the desired output format as usual.