Docbook: Cover Image

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Peter2
Posts: 7
Joined: Tue Mar 08, 2011 7:32 pm

Docbook: Cover Image

Post by Peter2 »

Hi,
How can I create a cover image in a docbook project?
I use:

<book xmlns="http://docbook.org/ns/docbook" version="5.0">
<info>
<title>MyProject</title>
<cover>
<para role="tagline">Documentation for MyProject</para>
<mediaobject>
<imageobject>
<imagedata fileref="Images/MyProject.png" />
</imageobject>
</mediaobject>
</cover>
<author>
<orgname>Company</orgname>
</author>
</info>

After pdf transform I get 2 pages only with the title 'MyProject' then come the page with TOC. The image MyProject.png is not shown and also no error is reported.
But in Oxygen Author it is displayd in the 'Author' window.
What is wrong?

Regards,
Peter
Peter2
Posts: 7
Joined: Tue Mar 08, 2011 7:32 pm

Re: Docbook: Cover Image

Post by Peter2 »

My workaround is a image in subtitle
<info>
<title>MyProject</title>
<subtitle>
<inlinemediaobject>
<imageobject>
<imagedata fileref="Images/MyProject.png" />
</imageobject>
</inlinemediaobject>
</subtitle>

But why I get 2 title pages in the pdf transform?
In HTML Help not.

Peter
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Docbook: Cover Image

Post by sorin_ristache »

Hello,

The DocBook XSL stylesheets for FO output generates two pages with the document title information. I am not sure why the designers of these stylesheets decided that because that repeats the information including the cover image. Maybe more experienced users from the docbook-apps list know more details about that.

If you want to customize the stylesheets you can find them in [Oxygen-folder]/frameworks/docbook/xsl/fo.


Regards,
Sorin
Peter2
Posts: 7
Joined: Tue Mar 08, 2011 7:32 pm

Re: Docbook: Cover Image

Post by Peter2 »

Hi Sorin,
I assume the second title page is the back-side of the title page of a real book, which printed double sided. But $double.sided is set to 0.

I found at http://www.mail-archive.com/docbook-app ... 12196.html:
"The fo:page-sequence element for the cover needs to have this property: force-page-count="no-force"

And at the end of http://www.sagehill.net/docbookxsl/PrintHeaders.html I found how to check $double.sided.

But I'm know nothing of xsl - for this reason I use Oxygen Author to write a book and get fast good results (chm/pdf).

How can I set for title/cover the property force-page-count="no-force" if $double.sided=0"?
A small example would be great, for example a code snippet to append at your patch in ${frameworks}/docbook/xsl/fo/docbook_custom.xsl. Or how must be a additional stylesheet, which I can set in a modified pdf transformation scenario?



Best regards,
Peter
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Docbook: Cover Image

Post by sorin_ristache »

You can customize any Docbook XSL template by adding your custom version in the [Oxygen-folder]/frameworks/docbook/xsl/fo/docbook_custom.xsl stylesheet like this (I added a named template force.page.count at the end of docbook_custom.xsl as an example):

Code: Select all

<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d="http://docbook.org/ns/docbook"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">

...

<!-- end oXygen patch. -->

<xsl:template name="force.page.count">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>

<xsl:choose>
<!-- double-sided output -->
<xsl:when test="$double.sided != 0">end-on-even</xsl:when>
<!-- single-sided output -->
<xsl:otherwise>no-force</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
The force.page.count template will not help you even when setting the double.sided parameter to 0 because that controls only if the final page number of the PDF document is an even number or an odd number. It does not reduce the number of occurrences of cover images.


Regards,
Sorin
Post Reply