Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Authoring Eclipse Help Using DocBook

Introduction to DocBook

This page contains information about how to use DocBook for authoring Eclipse Help. If you are using DocBook in Eclipse and have questions, comments, etc., about integration, send a note to the WTP Incubator Dev List or contact me, David Carver.

DocBook is an XML format designed for technical documentation. This includes books, articles, and help. XSL Tools uses docbook for it's user documentation format. It allows the writer to focus on the content of the book, and not how it looks. This seperation of content from presentation allows the information to be presented in a wide variety of formats, including the Eclipse Help system.

More information about DocBook can be found at the following sites:

The DocBook Project

The DocBook Project provides a very popular and highly customizable set of DSSL and XSLT stylesheets for working with and generating DocBook content into a wide variety of formats. The project has been on going since 1999 and the most current version of the XSL Stylesheet are 1.74, June 2008. This project is continually being improved and patches applied. The stylesheets are free available for download. Note that it does make use of several other open source releated projects, so it may be necessary to check all licensing terms to make sure they meet your specific needs.

This HowTo will assume that the XSL Stylesheets are being used.

Getting Started

You'll need the following in your workspace:

  • The XSL Stylesheets from the DocBook Project. Create a Project for these and then import the ZIP file.
  • A plugin that will hold the end use documentation.
  • An ANT build script that will publish the documentation.
  • Xalan 2.7.1 or Saxon 6.5 installed for processing the XSL Stylesheets. Note: XSL Tools 0.5 includes Xalan 2.7.1.


  • XSL Tools 0.5 or greater installed to allow for easy Launching and Testing of the process. XSL Tools also includes an XInclude ant task for helping to merge multiple docbook files into one complete package.

Creating the DocBook Files

It is recommended that Chapter 23: Modular DocBook Files be followed when creating eclipse help. There are several benefits for doing this:

  • Allows content to be re-arranged.
  • Allows for easier maintenance
  • Individual chapters can be previewed and worked on seperately from the main content.
  • Allows more than one person to work on a document.

The XSL Tools org.eclipse.wst.xsl.doc plugin can be viewed as an example.

Eclipse XSL Stylesheet

The Eclipse Platform Help System section in Chapter 25, outlines the basics of generating Eclipse Help with DocBook files. The stylesheet included with Docbook is designed for pre-eclipse 3.0. It uses some deprecated ways of generating the appropriate plugin.xml and toc.xml files need. The stylesheet below can be used with the one included by the DocBook Project to add eclipse 3.0 and greater support.

<?xml version="1.0"?>
 * Copyright (c) 2008 Standards for Technology in Automotive Retail and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * Contributors:
 *     David Carver - STAR - Extended existing eclipse.xsl file to produce valid
 *                           eclipse 3.3 plugin.xml with a manifest file.
<xsl:stylesheet xmlns:xsl=""
	xmlns:ng="" xmlns:db=""
	xmlns:exsl="" version="1.0"
	exclude-result-prefixes="exsl db ng">
	<xsl:import href="eclipse.xsl"/>
	<xsl:param name="manifest">1</xsl:param>
	<xsl:param name="create.plugin.xml">1</xsl:param>

	<xsl:template name="plugin.xml">
	    <xsl:if test="$create.plugin.xml = '1'">
			<xsl:call-template name="write.chunk">
				<xsl:with-param name="filename">
					<xsl:if test="$ != 0">
						<xsl:value-of select="$base.dir" />
					<xsl:value-of select="'plugin.xml'" />
				<xsl:with-param name="method" select="'xml'" />
				<xsl:with-param name="encoding" select="'utf-8'" />
				<xsl:with-param name="indent" select="'yes'" />
				<xsl:with-param name="content">
						<xsl:when test="$manifest = '1'">
								<extension point="">
									<toc file="toc.xml" primary="true" />
							<plugin name="{$}" id="{$}"
								version="1.0" provider-name="{$eclipse.plugin.provider}">
								<extension point="">
									<toc file="toc.xml" primary="true" />

This stylesheet accepts two additional parameters:

  • manifest - The default value for this is 1, which means that it should generate a Manifest file for the documentation plugin. Set this to 0 to turn this feature off.
  • create.plugin.xml - The default value for this is 1, which means that the plugin.xml file should be generated and the appropriate toc.xml information added to it.

If you have created a plugin project already, and set up the initial toc.xml entry in the plugin.xml file, then you can turn this option off, and it will generate only the Toc.xml file that contains a link to the appropriate html entries.

ANT Build Script

As mentioned, you can use XSL Tools to help test individual chapters and see what they will look like. Do this by using the HTML stylesheets: docbook.xsl or chunk.xsl. It is recommended that the chunk.xsl stylesheets be used, and the base eclipse.xsl stylesheet imports this already. This splits the content into multiple html output files.

For generating the eclipse help plugin files, it is recommended to setup an ANT build script, and also use the XSL Tools xsl.xinclude ant task for merging the contents. The XSL Tools documentation generator build.xml looks like the following:

<?xml version="1.0"?>
<project default="create-doc" basedir=".">

	<property name="current-loc" location="." />
	<property name="workspace" location=".." />
	<property name="htmldir" value="${current-loc}/html" />
	<property name="docbookdir" value="${workspace}/CommonUtilities/docbook-xsl/eclipse" />
	<property name="docbooksource" value="${current-loc}/docbook"/>
	<property name="xalan" value="org.apache.xalan.processor.TransformerFactoryImpl" />

	<!-- XSLT Chunking Properties -->
	<property name="base.dir" value="${htmldir}"/>
	<target name="merge">
		<xsl.xinclude in="${docbooksource}/xslhelp.dbk"

	<target name="create-doc" depends="merge">

		<xslt force="true" style="${docbookdir}/eclipse33.xsl" in="${docbooksource}/xslhelpcombined.dbk" out="test.xml">
			<factory name="${xalan}" />
			<param name="manifest" expression="1"/>
			<param name="base.dir" expression="${htmldir}/"/>
			<param name="create.plugin.xml" expression="0"/>
			<param name="chunker.output.indent" expression="yes"/>
			<param name="navig.showtitles" expression="0"/>
			<param name="suppress.navigation" expression="1"/>
            <param name="generate.toc" expression="book      toc,title,figure
chapter   toc,title
section   title" />
		<replace file="${current-loc}/toc.xml" token="${current-loc}/" value=""/>


This script can be run independent of the workspace it was created and should be able to be run without change in a headless build. No system environment variables are used to gather information. The build script will output it's information into a directory called HTML in the current plugin. The only variables that may need to be updated are the $docbookdir and $docbooksource to indicate where the docbook files are stored.

The main processing is done in the create-doc, the xinclude resolutions are done in the merge target. It will generate table of contents for Book, Chapter, and Section elements. Running the build script will update the toc.xml in the plugin's root directory, and link automatically to the generated html documentation.

For more information about available parameters to be passed see:

CSS Doesn't Match Eclipse Style

The default stylesheet and formatting for the Eclipse Help generated by Docbook doesn't integrate well with the eclipse help system. Review Using CSS for more information on how to customize the look and feel.

Back to the top