Docbook cover images

Here should go questions about transforming XML with XSLT and FOP.
alendoxy
Posts: 5
Joined: Fri May 06, 2011 12:08 pm

Docbook cover images

Post by alendoxy »

I'm using oxygen 12.1 on my MAC OS 10.6.7.
I would like to insert a cover with images in my document and I used this

Code: Select all

<info>
<title>Tor Vergata</title>
<subtitle>Annuario 2011/2012</subtitle>
<authorgroup>
<author>
<personname>
<firstname>Prodotto da:</firstname>
<surname>Centro di Calcolo e Documentazione di Tor Vergata</surname>
</personname>
</author>
</authorgroup>
<publisher>
<publishername>Centro di Calcolo e Documentazione di Tor Vergata</publishername>
<address><city>Roma</city></address>
</publisher>
<copyright>
<year>2011</year>
<holder>Università degli Studi di Roma Tor Vergata, Tutti i diritti riservati.</holder>
</copyright>
<cover>
<para role="tagline">Annuario di Tor Vergata 2011/2012</para>
<mediaobject>
<imageobject>
<imagedata fileref="logo.jpg">
<info>
<othercredit>
<orgname>A. Donnini</orgname>
</othercredit>
<othercredit>
<orgname>S. Rossi</orgname>
</othercredit>
</info>
</imagedata>
</imageobject>
</mediaobject>
</cover>
</info>
I can see the image in the oxygen author window but when I transform the document the image is not available.
I think the xml is right because I don't get errors.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Docbook cover images

Post by sorin_ristache »

Hello,

If the transformation result file is saved in a location where the image path is not valid anymore (in your case the path specified in the fileref="logo.jpg" attribute) you have two options:

1. Copy the image file logo.jpg in the output file location for making the path valid in the result file too. The DocBook stylesheets do not copy images automatically to output location so you have to copy the images yourself. You do this only once at the first transformation, when you repeat the transformation the images are already there.

Or:

2. Set a prefix in the DocBook parameter img.src.path (in the Parameters dialog of the transformation scenario) which will be added in all image paths of the output file.


Regards,
Sorin
alendoxy
Posts: 5
Joined: Fri May 06, 2011 12:08 pm

Re: Docbook cover images

Post by alendoxy »

Hi sorin, the image file is in the result document path: I can see it in the author view. When I transform to pdf the image is not rendered and I cannot understand why.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Docbook cover images

Post by sorin_ristache »

Hello,

Cover images are not handled very well by the DocBook XSL stylesheets. You can add an image to a book cover if you add it inline in the title or subtitle element, something like the following example:

Code: Select all

    <subtitle>
Annuario 2011/2012
<orgname>A. Donnini</orgname>
<orgname>S. Rossi</orgname>
<inlinemediaobject>
<imageobject>
<imagedata fileref="lake.jpeg"/>
</imageobject>
</inlinemediaobject>
</subtitle>
Otherwise I think you have to customize the stylesheets for PDF output in order to insert the image in the needed position in the PDF layout. If you choose the path of customization you can start from the stylesheet ${frameworks}/docbook/xsl/fo/docbook_custom.xsl where ${frameworks} is the frameworks subfolder of the Oxygen installation folder.


Regards,
Sorin
Post Reply