Forum How do I...?

Using prince with DocBook?

jean
Hi all

I'm writing some software manuals using DocBook, and I want to use Prince to format them for print. I aim to generate HTML from the DocBook XML, so that the DocBook XSL can fill in the TOCs, generate the index, etc etc, and my CSS can just take care of the looks. I need to deliver print-ready PDF to the printers.

Is anyone else doing similar things? Are there best practices for this kind of job? E.g. a set of parameters for the DocBook XSL which makes things easier?
jean
Can it really be that no-one is using Prince with DocBook?
mikeday
That's an interesting question, as you could use Prince to print DocBook directly, but as you point out using the XSLT to generate the table of contents and indices first and transform the content into HTML will probably make it easier. I don't know if anyone has done that; I haven't had much experience with the DocBook XSLT myself, but a good place to start would be to convert the DocBook to HTML, run Prince on it, and see what it looks like. If you can generate one big HTML file instead of multiple files it might be easier to process, after that it shouldn't be too hard to customise the styling with CSS.
jean
Hi Mike

Thanks for the reply!

> as you could use Prince to print DocBook directly, but as you point
> out using the XSLT to generate the table of contents and indices first
> and transform the content into HTML will probably make it easier.

Yes, I think printing directly would be tricky. I use XIncludes a lot,
does Prince resolve those? Also the DocBook stylesheets turn e.g. <xref
linkend="someid"> into a link to the <title> or similar of the
referenced element, I don't think CSS will let me do that?

> but a good place to start would be to convert the DocBook to HTML, run
> Prince on it, and see what it looks like.

It's serviceable, but the DocBook-generated HTML is not exactly a thing
of beauty -- there's plenty of stuff like this::

<span><a name="operator"></a>Operator</span>

And plenty of duplicate id attributes (side-effect of the XInclude
processing).

> If you can generate one big HTML file instead of multiple files it
> might be easier to process,

Absolutely.

> after that it shouldn't be too hard to customise the styling with CSS.

I hope so! But I'm no CSS guru .. :-/ That's why I hoped there's a head
start out there somewhere ..
mikeday
Yes, Prince supports XInclude. You can also do cross-references with CSS3, although it may require some tweaks since DocBook is using IDREFs instead of #id URLs.