cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriele Domenichini <>
Subject Cocoon 2, Docbook and Norman Walsh's Stylesheets
Date Sat, 28 Sep 2002 08:34:36 GMT
I have succeded in transforming Docbook to pdf and to html on cocoon 2.0.3 
using the stylesheet by Norman Walsh on the official docbook repository 
Cocoon has some weakness in doing this and I spent 15 days to make it work 
properly, so if you want save some time and you want to do something similar 
you are interested in this mail.
What I learned is that:

1. While xalan can do docbook transformation to xslfo correctly from the 
command line, on cocoon it can't.

2. If you use Saxon instead of xalan the transformation is almost successful 
but not completly: ie. I lost all the sect1/title.

3. If you use Saxon you loose all the xsp capabilities in cocoon (I want to 
make sql transformation with as400 and Oracle)

4. Incremental processing is not suggested for docbook to pdf transformation

The solutions I have found to this problems thanks to all I have read on the 
mailing lists and on the official site is:
1. Setting up cocoon to use xalan and saxon in alternative (defult: xalan) and 
set incremental processing to false in Saxon

2. Renaming saxon.jar to z-saxon.jar (I am not sure if is necessary but in 
this way works)

3. Modifying Saxon to make it use the parser xerces instead of aelfred 

Let'see theese points in detail

1. Setting up cocoon to use xalan and saxon in alternative (defult: xalan) and 
set incremental processing to false in Saxon.
To do this:
1.1 Put saxon652.jar WEB-INF/lib ( in the cocoon directory of course)

1.2 Here are extracts of  what you have to add in cocoon.xconf and 

# cocoon.xconf 
  <parameter name="use-store" value="true"/>
  <parameter name="incremental-processing" value="false"/>
  <parameter name="transformer-factory"

# sitemap.xmap
<map:transformer name="xslt-saxon" pool-grow="2" pool-max="32" pool-min="8"




in yor pipeline when you do a transformation from docbook to pdf you will use 
something similar:

<map:match pattern="*.pdf">
	<map:generate src="{1}.docbook"/>
	<map:tranform type="xslt-saxon" src="WhereverYouPutIt/fo/docbook.xsl"/>
	<map:serialize type="fo2pdf"/>
<map:match pattern="*.html">
	<map:generate src="{1}.docbook"/>
	<map:tranform type="xslt-saxon" src="WhereverYouPutIt/html/docbook.xsl"/>
	<map:serialize type="fo2pdf"/>

In this way if you will leave xslt as the default type of transformation, you 
will use use xalan and all his xsp capabilities for all the the other cocoon 

2. Renaming saxon.jar z-saxon.jar (I am not sure that is necessary but in this 
way works)

3. Modifying Saxon to make it use xerces instead of aelfred as parser

Change the content of
META-INF/services/javax.xml.parsers.SAXParserFactory from
com.icl.saxon.aelfred.SAXParserFactoryImpl to
org.apache.xerces.jaxp.SAXParserFactoryImpl. That tells
Saxon to use xerces instead of aelfred as parser.

Don't be worried it is not so complicated: you have to extract the file 
(javax.xml.parsers.SAXParserFactory) from saxon.jar edit it (is a text file) 
and to put it again in the same place in saxon.jar

I must say that the Saxon and xalan problems in using Norman Walsh's 
stylesheets should be addressed inside cocoon developing activity. It 
shouldn't be so hard to make docbook to pdf transformation work.
Comments are welcome.

Gabriele Domenichini

To use different xslt processors or different behaviour of the same:

To use saxon in alternative the mail from which I took the solution is: 
( which 
tell exactly what to do:

To change the behavior of saxon there's a mail 
( which 
explain three workaround. I have choosen the third

Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message