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] Alt text not appearing in inlinemediaobject


Thanks Thomas. I tried that solution, but I'm still not seeing the alt attribute in the output. Below is what I added to my customization (I marked the change from the original stylesheet--it's just 3 additional lines).

<xsl:template match="d:imagedata">
        <xsl:variable name="filename">
            <xsl:call-template name="mediaobject.filename">
                <xsl:with-param name="object" select=".."/>
            </xsl:call-template>
        </xsl:variable>
       
        <xsl:choose>
            <!-- Handle MathML and SVG markup in imagedata -->
            <xsl:when test="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
                <xsl:apply-templates/>
            </xsl:when>
           
            <xsl:when test="svg:*" xmlns:svg="http://www.w3.org/2000/svg">
                <xsl:apply-templates/>
            </xsl:when>
           
            <xsl:when test="@format='linespecific'">
                <xsl:choose>
                    <xsl:when test="$use.extensions != '0'
                        and $textinsert.extension != '0'">
                        <xsl:choose>
                            <xsl:when test="element-available('stext:insertfile')">
                                <stext:insertfile href="" encoding="{$textdata.default.encoding}"/>
                            </xsl:when>
                            <xsl:when test="element-available('xtext:insertfile')">
                                <xtext:insertfile href=""/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:message terminate="yes">
                                    <xsl:text>No insertfile extension available.</xsl:text>
                                </xsl:message>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>
                        <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"
                            href=""/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
                <xsl:variable name="longdesc.uri">
                    <xsl:call-template name="longdesc.uri">
                        <xsl:with-param name="mediaobject"
                            select="ancestor::d:imageobject/parent::*"/>
                    </xsl:call-template>
                </xsl:variable>
               
                <xsl:variable name="phrases"
                    select="ancestor::d:mediaobject/d:textobject[d:phrase]
                    |ancestor::d:inlinemediaobject/d:textobject[d:phrase]
                    |ancestor::d:mediaobjectco/d:textobject[d:phrase]"/>
               
                <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>
<!-- Added when statement below -->
                            <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>
               
                <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0
                    and ancestor::d:imageobject/parent::*/d:textobject[not(d:phrase)]">
                    <xsl:call-template name="longdesc.link">
                        <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
                    </xsl:call-template>
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>



---
David Goss, M.A.
Technical Writer, Laboratory Division
Frontier Science & Technology Research Foundation
4033 Maple Road
Amherst, NY 14226
(716) 834-0900 x7218


From: "Thomas Schraitle" <tom_schr@web.de>
To: docbook-apps@lists.oasis-open.org
Sent: Tuesday, October 29, 2013 12:20:08 PM
Subject: Re: [docbook-apps] Alt text not appearing in inlinemediaobject

Hi David,

Am Dienstag, 29. Oktober 2013, 11:52:20 schrieb David Goss:
> I have the the following docbook 5 markup:
> <para>Click the
> <guibutton><inlinemediaobject><alt>Execute</alt><imageobject><imagedata
> fileref="img/ldms/ldms_button_execute.png"
> depth="1em"/></imageobject></inlinemediaobject> button.</guibutton></para>
>
> It is outputting the following HTML :
> <p>Click the <span class="guibutton"><span class="inlinemediaobject"><img
> src="" height="13"></span></span>
> button.</p>
>
> I'm not sure why the alt text is not carrying over. Am I using the alt tag
> incorrectly or is this a bug? I'm using webhelp docbook-xsl-ns-1.78.1 .
 
Your DocBook markup is perfectly correct. But it seems, there is a deficiancy
about the handling of inlinemediaobject in the DocBook stylesheets.

I suspect the html/graphics.xsl file in the "imagedata" template (lines 1250 -
1331). In this template rule, the "process.image" template is called and the
"alt" parameter is passed. However, it is not checked against an
inlinemediaobject with a possible alt element.

I would propose this change:

 <xsl:call-template name="process.image">
   <xsl:with-param name="alt">
     <xsl:choose>
       <xsl:when test="ancestor::mediaobject/alt">
          <xsl:apply-templates select="ancestor::mediaobject/alt"/>
       </xsl:when>
       <xsl:when test="ancestor::inlinemediaobject/alt">
          <xsl:apply-templates select="ancestor::inlinemediaobject/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::imageobject/parent::*"/>
     </xsl:call-template>
   </xsl:with-param>
 </xsl:call-template>


If you would like to give it a try, do the following:

1. Create a customization layer if you haven't done yet. If you don't know
   how, read one of the following URLs:
   http://www.sagehill.net/docbookxsl/CustomMethods.html#CustomizationLayer
   http://doccookbook.sf.net/html/en/dbc.common.dbcustomize.html

2. Copy the "imagedata" template from the original html/graphics.xsl template
   into your customization layer.

3. Search for the xsl:call-template line and apply the above "patch" (add the
   2nd xsl:when test).

4. Transform your DocBook document and use your customization layer.


> I did see this page in the XSL Guide:
> http://www.sagehill.net/docbookxsl/AltText.html
> But it looks to be for Docbook4.

You can use this also in DocBook 5 as long as it is valid.


--
Gruß/Regards
  Thomas Schraitle


---------------------------------------------------------------------
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]