Introduction

We assume you have some sources of DocBook XML documents, that you wish to process and convert into pdf or html output.

Basic usage

Put you DocBook sources into dir which "maven.sdocbook.src.dir" property points to.

Simply typing "maven sdocbook" will generate both html and pdf. The html is produced directly from the sources. The pdf output is done in a two-step process, first converting sources to FO using the DocBook stylesheets and then converting the FO output to pdf using the Apache FOP processor.

Parameterizing stylesheets

The stylesheets which this plugin uses can be controlled with parameters. For examle, they implement various extensions, which you need to enable if you want them in output.

Taking the stylesheets which convert into html as example, you could set the "draft" option by setting the property "maven.sdocbook.html.params=-param draft.mode yes" in your project.properties.

Using another version of stylesheets

The plugin includes a specific version of the DocBook stylesheets but these are developed in a separate project, and might very well be available in newer versions than included in this plugin.

You can use another version just adding a dependency to the project.xml with the version you want


   <dependency>
     <groupId>docbook</groupId>
     <artifactId>docbook-xsl</artifactId>
     <version>1.67.2</version>
     <url>http://docbook.sourceforge.net</url>
     <type>zip</type>
   </dependency>

        

Another way of doing this is to manually get a distribution of the stylesheets you want and point to the location where you unzip them setting the "maven.sdocbook.stylesheets.dir" property.

Using custom stylesheets

You can create this postGoal in maven.xml to use a custom stylesheet.


    <postGoal name="sdocbook:prepare-filesystem">

            <!-- use a custom fo stylesheet -->
            <copy todir="${maven.sdocbook.stylesheets.dir}/fo">
                <fileset dir="${maven.sdocbook.src.dir}/styles/fo"/>
            </copy>

            <!-- use a custom html stylesheet -->
            <copy todir="${maven.sdocbook.stylesheets.dir}/html">
                <fileset dir="${maven.sdocbook.src.dir}/styles/html"/>
            </copy>

            <!-- copy images -->
            <copy todir="${maven.sdocbook.stylesheets.dir}/images">
                <fileset dir="${maven.sdocbook.src.dir}/images"/>
            </copy>

    </postGoal>

        
You can take a look to a FO custom stylesheet and a HTML custom stylesheet from the Acegi Security System for Spring project.

Then change in project.properties the stylesheet to use instead of the default one


maven.sdocbook.html.xsl=${maven.sdocbook.stylesheets.dir}/html/acegi.xsl
maven.sdocbook.fo.xsl=${maven.sdocbook.stylesheets.dir}/fo/acegi.xsl