Getting images to work in DB epub ANT transformation

Posts: 37

Getting images to work in DB epub ANT transformation

Tue Aug 14, 2012 10:40 pm


I'm working with the Docbook to ePub transform you guys built in ANT. I'm doing very heavy customization of the underlying DocBook XSL to get the output I want. One problem I've been running into is that the ANT transform fails when I try to insert an image via XSLT. For example, I've customized my titlepage to output an image file.

Code: Select all

<div class="titlepage-logo">
            <xsl:element name="img">
              <xsl:attribute name="alt">My Logo</xsl:attribute>
              <xsl:attribute name="src">
                <xsl:value-of select="$ebook.titlepage.logo.filename"/>

The correct img tag with the correct path to the image is inserted, but your image.xsl stylesheet chokes because it can't find the image to copy. I think it is looking for the image in the XML directory, but I store my epub image files elsewhere. Is it possible to redirect where the ANT process locates images?
Posts: 5931

Re: Getting images to work in DB epub ANT transformation

Wed Aug 15, 2012 9:48 am


We will try to improve on the Docbook to EPUB transformation and add a parameter to specify where the images folder is located.
In the meantime you could make some modifications to the ANT build file:


it contains a target called:

Code: Select all

 <target name="images">....

which sends a couple of parameters to the images.xsl called:

Code: Select all

<param name="inputDir" expression="${xmlFileDir}"/>
<param name="imagesDir" expression="images"/>

In your case you should probably change the xmlFileDir to be the place where the images folder is located and imagesDir to be the name of the images directory.

You can also add some xsl:messages in the images.xsl to see how the templates are called.

Radu Coravu
<oXygen/> XML Editor

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests