Hi Glenn,
I looked at the epub/docbook.xsl stylesheet, and it does have a custom template for handling mediaobject. Unfortunately, it does not run the selection routine to pick one of several imageobjects, so you get them all.

To see how it should be handled, look in xhtml/graphic.xsl, at the template starting with:

   <xsl:template match="mediaobject|mediaobjectco">

you will see that the first steps are to call the template named 'select.mediaobject.index', which should return one imageobject. That's where the role attribute is used to select one of the imageobjects.

Out of the box, the supported values of role are 'html', 'xhtml', or 'fo', but you can easily add a new one like 'epub' by setting the 'preferred.mediaobject.role' stylesheet param. See this reference for more information.

http://www.sagehill.net/docbookxsl/GraphicSelection.html

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Glenn McDonald" <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 13, 2010 10:59 PM
Subject: [docbook-apps] OPF file for EPUB is linking to images with different 
roles


For Docbook 4.x, I was able to use the following to force PDF's to use SVG and HTML Books to use PNG's:

<mediaobject>
<imageobject role="fo">
<imagedata fileref="screenshots/wizard_step_1.svg" scale="70"/>
</imageobject>
<imageobject role="html">
<imagedata fileref="screenshots/wizard_step_1.png" scale="70"/>
</imageobject>
</mediaobject>

This still works for PDF and HTML documents, however, I am finding that the epub translation causes both of these images to be referenced in the OPF file:

<manifest>
...
<item id="d0e88" href="screenshots/wizard_step_1.svg" 
media-type="image/svg+xml"/>
<item id="d0e94" href="screenshots/wizard_step_1.png" media-type="image/png"/>
...
</manifest>

The raw html output of the translated epub is (correctly) only referencing the .png file

<div class="mediaobject"><img src="screenshots/wizard_step_1.png" width="378" alt="Step 1 Image Data"/>

Incidentally, what "role" should an epub document be? role="epub" does not seem to work. Is it "xhtml"?

Glenn

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to