alt text dropped in FO/PDF output of DocBook XML

Having trouble installing Oxygen? Got a bug to report? Post it all here.
amsimms
Posts: 4
Joined: Wed Jul 26, 2017 6:48 pm

alt text dropped in FO/PDF output of DocBook XML

Post by amsimms »

We include alt-text whenever we include images via "mediaobject"--this is a requirement for 508 compliance. Here is an example:

<mediaobject>
<alt>Department of Veteran's Affairs Logo</alt>
<imageobject>
<imagedata contentwidth="2in"
align="center"
fileref="images/va-logo.png"
format="png"/>
</imageobject>
</mediaobject>


However, the alt text entries are stripped in the resulting FO output despite running with <accessibility>true</accessibility> set in fo.conf. I doubt we're the first ones to encounter this issue--is there a parameter that needs to be set in order for alt text to be inserted into the resulting FO output?
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: alt text dropped in FO/PDF output of DocBook XML

Post by Radu »

Hi,

It seems that the default XSLT stylesheet provided by the Docbook project to convert Docbook to PDF does not use the <alt> element for anything.
I added an issue for it here:

https://github.com/docbook/xslt10-stylesheets/issues/62

if you want to try a manual XSLT fix, in the XSLT stylesheet:

OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\fo\graphics.xsl

there is an xsl:if like:

Code: Select all


    <xsl:if test="$align != ''">
<xsl:attribute name="text-align">
<xsl:value-of select="$align"/>
</xsl:attribute>
</xsl:if>
After it you can add a:

Code: Select all

    <xsl:if test="parent::d:imageobject/preceding-sibling::d:alt">
<xsl:attribute name="alt-text" namespace="http://xmlgraphics.apache.org/fop/extensions">
<xsl:value-of select="parent::d:imageobject/preceding-sibling::d:alt"/>
</xsl:attribute>
</xsl:if>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply