User Tools

Site Tools


docbook

DocBook

sudo apt-get install xsltproc docbook-xsl fop

Generating

HTML

STYLESHEET_HTML = /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl
$(XSLTPROC) --xinclude -o $(BOOK_NAME).html $(STYLESHEET_HTML) $(BOOK_XML)

PDF

STYLESHEET_FO = /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl
$(XSLTPROC) --xinclude -o $(BOOK_NAME).fo $(STYLESHEET_FO) $(BOOK_XML)
$(FOP) -fo $(BOOK_NAME).fo -pdf $(BOOK_NAME).pdf

Custom stylesheet

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'
	xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<!--<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>-->
	<xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl"/>
 
	<xsl:import href="titlepage.xsl"/>
 
	<xsl:param name="paper.type">A4</xsl:param>
 
	<xsl:template match="productname">
		 <fo:inline font-weight="bold">
		 	<xsl:apply-templates/>
		 </fo:inline>
	</xsl:template>
 
	<xsl:template match="database">
		 <fo:inline font-family="monospace">
		 	<xsl:apply-templates/>
		 </fo:inline>
	</xsl:template>
 
	<xsl:template match="replaceable">
		 <fo:inline background-color="#DDD" font-style="italic">
		 	<xsl:apply-templates/>
		 </fo:inline>
	</xsl:template>
</xsl:stylesheet>

Custom titlepage

cp /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/titlepage.templates.xml titlepage.xml
# <customize titlepage.xml file>
xsltproc -o titlepage.xsl /usr/share/xml/docbook/stylesheet/docbook-xsl/template/titlepage.xsl titlepage.xml

DocBook on Windows

  • docbook-xsl-1.76.1-RC2
  • libxml2-2.7.7.win32
  • xsldbg-3.1.7.win32
  • libxmlsec-1.2.13.win32
  • zlib-1.2.5
  • fop-1.0
  • libxslt-1.1.26.win32
  • iconv-1.9.2.win32
  • openssl-0.9.8a.win32
env.bat
@echo off
 
SET BASE_DIR=C:\docbook
 
SET ICONV_BIN=%BASE_DIR%\iconv-1.9.2.win32\bin
SET LIBXML2_BIN=%BASE_DIR%\libxml2-2.7.7.win32\bin
SET LIBXMLSEC_BIN=%BASE_DIR%\libxmlsec-1.2.13.win32\bin
SET LIBXSLT_BIN=%BASE_DIR%\libxslt-1.1.26.win32\bin
SET OPENSSL_BIN=%BASE_DIR%\openssl-0.9.8a.win32\bin
SET XSLDBG_BIN=%BASE_DIR%\xsldbg-3.1.7.win32\bin
SET ZLIB_BIN=%BASE_DIR%\zlib-1.2.5\bin
SET FOP_BIN=%BASE_DIR%\fop-1.0
 
SET DOCBOOK_PATH=%BASE_DIR%\docbook-xsl-1.76.1-RC2
 
SET PATH=%ICONV_BIN%;%LIBXML2_BIN%;%LIBXMLSEC_BIN%;%LIBXSLT_BIN%;%OPENSSL_BIN%;%XSLDBG_BIN%;%ZLIB_BIN%;%FOP_BIN%;%PATH%
 
echo New path is %PATH%
docbook.txt · Last modified: 2012-02-08 21:40 CET by dominik