Menu

#1317 Alt tag not being processed in inlinmediaobject for HTML output

output: HTML
pending-fixed
nobody
None
5
2014-01-09
2013-10-29
David Goss
No

Using docbook-xsl-ns-1.78.1, alt tags are not being correctly processed into HTML for inlinemediaobject. The img tag appears in HTML output, but it does not have an alt attribute assigned to it.

To fix this, add the template below to html/graphics.xsl (this template is defined for mediaobject but not inlinemediaobject)

<xsl:template match="d:inlinemediaobject/d:alt">
    <xsl:apply-templates/>
</xsl:template>

Also, modify the call to process.image in the imagedata template to also include pulling the alt tag from inlinemediaobject

<xsl:call-template name="process.image">
    <xsl:with-param name="alt">
        <xsl:choose>
            <xsl:when test="ancestor::d:mediaobject/d:alt">
                <xsl:apply-templates select="ancestor::d:mediaobject/d:alt"/>
            </xsl:when>
            <!-- Add next 3 lines -->
            <xsl:when test="ancestor::d:inlinemediaobject/d:alt">
                <xsl:apply-templates select="ancestor::d:inlinemediaobject/d:alt"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="$phrases[not(@role) or @role!='tex'][1]"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:with-param>
    <xsl:with-param name="longdesc">
        <xsl:call-template name="write.longdesc">
            <xsl:with-param name="mediaobject" select="ancestor::d:imageobject/parent::*"/>
        </xsl:call-template>
    </xsl:with-param>
</xsl:call-template>

Discussion

  • Thomas Schraitle

    Fixed in [r9827].

    The namespace-aware stylesheets are generated.

     

    Related

    Commit: [r9827]

  • Robert Stayton

    Robert Stayton - 2014-01-07
    • status: open --> pending-fixed