D. Using XMLmind XSL Utility to convert a DocBook 4 document to HTML Help (.chm file)

  1. Conversion specification dbToHTMLHelp directly generates a .chm file.

  2. The XSLT stylesheet used to convert DocBook 4 documents is found in XSLUtility_install_dir/addon/config/docbook/xsl/htmlhelp/htmlhelp.xsl.

    Conversion specification dbToHTMLHelp generates intermediate HTML files in the temporary working directory (variable %W) and not in the directory containing your input file. That's why you have to specify all the following XSLT stylesheet parameters:

    NameValue
    admon.graphics.path%~px../images/
    base.dir%W%S
    callout.graphics.path%~px../images/callouts/
    img.src.path%~pi
    manifest.in.base.dir1

    Other XSLT stylesheet parameters such as callout.graphics=1 are optional.

    The reference documentation of these parameters is found in DocBook XSL Stylesheet Reference Documentation.

  3. Conversion specification dbToHTMLHelp needs to execute a sequence of commands in order to copy some graphics files to the output directory and to run the HTML help compiler, hhc.exe, on the output directory.

    This sequence of commands depends on:

    • the paths of the directories containing the image files referenced by your input document;

    • where hhc.exe (part of HTML Help Workshop) is installed on your computer.

    Let's suppose:

    • the image files referenced by your input document are found in the screenshots/ subdirectory (relative to your input document);

    • hhc.exe is installed in C:\Program Files\HTML Help Workshop\.

    mkdir screenshots1 &2
    copy "%~pI\screenshots\*.png" screenshots &3
    mkdir images &4
    mkdir images\callouts &
    copy "%~pX\..\images\*.png" images &5
    copy "%~pX\..\images\callouts\*.png" images\callouts &
    "C:\Program Files\HTML Help Workshop\hhc.exe" htmlhelp.hhp &6
    copy htmlhelp.chm "%O"7

    Note that the above sequence of commands works fine because a process command is always executed in the temporary working directory (variable %W).

    1

    Create a %W\screenshots\ subdirectory. All the images files referenced by your XML input file will be copied to this subdirectory.

    2

    '&' is the command separator on Windows.

    3

    Copy all the image files referenced by your XML input file to the %W\screenshots\ subdirectory.

    4

    Create an %W\images\ and %W\images\callouts\ subdirectories. All the images files referenced by the DocBook XSL stylesheets will be copied to these subdirectories.

    In the case of the DocBook XSL stylesheets, these images resources are actually found in an images\ directory, which is a sibling of the directories containing the stylesheets generating HTML Help.

    5

    Copy all the image resources referenced by the DocBook XSL stylesheets to the %W\images\ and %W\images\callouts\ subdirectories.

    6

    Run the HTML help compiler, hhc.exe, on htmlhelp.hhp, which is the file generated by the DocBook XSL stylesheets.

    7

    Doing so creates htmlhelp.chm. Copy this file to the desired output file.