DocBook FO root element

Here should go questions about transforming XML with XSLT and FOP.
jenzed
Posts: 2
Joined: Fri Mar 02, 2007 10:04 pm

DocBook FO root element

Post by jenzed »

Hello. I'm using oXygen 7.2 to write a book in DocBook XML. I have created a XSL customization file containing the following:

Code: Select all

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ng="http://docbook.org/docbook-ng"
xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="db ng exsl"
version='1.0'>

<xsl:import
href="/Applications/oxygen/frameworks/docbook/xsl/fo/docbook.xsl"/>

<xsl:attribute-set name="xref.properties">
<xsl:attribute name="color">blue</xsl:attribute>
</xsl:attribute-set>

<xsl:template match="guilabel">
<xsl:call-template name="inline.boldseq"/>
</xsl:template>

</xsl:stylesheet>
I can transform chapters of my book in the shell using the following commands:

(CLASSPATH setting: /Applications/oxygen/lib/fop.jar:/Applications/oxygen/lib/batik.jar:/Applications/oxygen/lib/xalan.jar:/Applications/oxygen/lib/xercesImpl.jar:/Applications/oxygen/lib/avalon-framework-4.1.3.jar)

xsltproc --output test.fo --stringparam fop.extensions 1 /Users/me/Documents/book/custom_docbook.xsl chapter1.xml

java org.apache.fop.apps.Fop -fo test.fo -pdf test.pdf

I can transform chapters of my book in oXygen *unless* I specify my XSL customization file. If I specify my XSL customization file (via "Configure Transformation Scenario | Additional XSLT Stylesheets"), I get the following error:

SystemID: /Users/me/Documents/book/custom_docbook.xsl
Description: ERROR: Document root element for FO output must be one of the following elements: appendix article bibliography book chapter colophon dedication glossary index part preface qandaset refentry reference sect1 section set setindex

Suggestions are much appreciated. thx!


jennifer
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Jennifer,

A customisation layer is a stylesheet that imports the docbook stylesheet and adds some paratemetrs, templates, etc. Due to the import precedence then this stylesheet actually overwrites the docbook default processing.
Now all you need is to set your stylesheet instead of the docbook one in a transformation scenario (do not add it as additional XSLT stylesheet).

Best Regards,
George
George Cristian Bina
jenzed
Posts: 2
Joined: Fri Mar 02, 2007 10:04 pm

Post by jenzed »

Thanks George - it's working great!


Jennifer.
Post Reply