Page 1 of 1

adding 2 css stylesheets in DocBook to EPUB

Posted: Sun Jan 20, 2013 2:19 am
by jbzech
In order to keep my files simple, I'd like to add 2 stylesheets to my epub (generated from DocBook via the ANT transform). One stylesheet will override a few lines in the much larger second (this keeps me from having to maintain 2 complete stylesheets).

I know how to get my custom stylesheet into the epub in the parameters. Is there a simple way to get a second stylesheet in there as well? Or would this require customizing the build.xml file.

Thanks for any help.

jz

Re: adding 2 css stylesheets in DocBook to EPUB

Posted: Mon Jan 21, 2013 1:01 pm
by sorin_ristache
Hi,

Adding a second CSS stylesheet requires the modification of both the build.xml file and an XSLT stylesheet that declares the CSS stylesheet in the manifest.opf file. You can add a custom transformation parameter in the DocBook EPUB scenario called for example html.stylesheet.custom and modify the template called "opf.manifest" in [Oxygen-install-dir]/frameworks/docbook/xsl/epub/docbook.xsl and also add this parameter in [Oxygen-install-dir]/frameworks/docbook/xsl/epub/bin/build.xml.

I suggest keeping the two CSSs in the same directory, importing the first CSS in the second one (using @import), setting the second one in the html.stylesheet parameter and just adding in build.xml an instruction for copying the first one to the output directory of the EPUB transformation (the ${outputDir} variable). The build.xml instruction which you add for copying the CSS stylesheet should copy it in the same sub-directory of ${outputDir} as the other CSS (from the html.stylesheet parameter): if the CSS is located outside the directory of the source XML file the build.xml instruction should copy it in the ${outputDir}/css directory, otherwise the build.xml instruction should keep the relative path of the other CSS stylesheet (for example ${outputDir}/myDir if the other CSS is located in [directory-of-input-XML/myDir).


Regards,
Sorin