OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] OPF file for EPUB is linking to images with differentroles


  Thanks Bob,

I had a play around with the epub/docbook.xsl and managed to get it 
working.

I am not sure if it's 100% correct, but below is my modified custom 
template for handling mediaobject:

<xsl:template match="d:mediaobject|d:mediaobjectco|d:inlinemediaobject" 
mode="opf.manifest">
<xsl:variable name="olist" select="d:imageobject|d:imageobjectco"/>

<!-- Glenn McDonald: Limit the mediaobject to the one that matches our 
role -->

<xsl:variable name="object.index">
<xsl:call-template name="select.mediaobject.index">
<xsl:with-param name="olist" select="$olist"/>
<xsl:with-param name="count" select="1"/>
</xsl:call-template>
</xsl:variable>

<xsl:variable name="object" select="$olist[position() = $object.index]"/>

<!-- Glenn McDonald: replaced d:imageobject with $object as defined 
above -->

<xsl:choose>
<xsl:when test="$object/d:imagedata[@format = 'GIF' or
                                             @format = 'GIF87a' or
                                             @format = 'GIF89a' or
                                             @format = 'JPEG' or
                                             @format = 'JPG' or
                                             @format = 'PNG' or
                                             @format = 'SVG']">
<xsl:apply-templates select="$object[d:imagedata[@format = 'GIF' or
                                                          @format = 
'GIF87a' or
                                                          @format = 
'GIF89a' or
                                                          @format = 
'JPEG' or
                                                          @format = 'JPG' or
                                                          @format = 'PNG' or
                                                          @format = 
'SVG']][1]/d:imagedata"
                              mode="opf.manifest"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$object/d:imagedata[1]" mode="opf.manifest"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Cheers,

Glenn

On 15/07/2010 2:47 AM, Bob Stayton wrote:
> 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
> bobs@sagehill.net
>
>
> ----- Original Message ----- From: "Glenn McDonald" 
> <gmcdonald@vividas.com>
> To: <docbook-apps@lists.oasis-open.org>
> 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: docbook-apps-unsubscribe@lists.oasis-open.org
>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>
>>
>>
>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]