Revision: 9660
http://docbook.svn.sourceforge.net/docbook/?rev=9660&view=rev
Author: bobstayton
Date: 2012-11-02 17:44:31 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------
Add support for mediaobject/alt, with precedence over
mediaobject/textobject/phrase.
Modified Paths:
--------------
trunk/xsl/html/graphics.xsl
Modified: trunk/xsl/html/graphics.xsl
===================================================================
--- trunk/xsl/html/graphics.xsl 2012-10-29 23:18:22 UTC (rev 9659)
+++ trunk/xsl/html/graphics.xsl 2012-11-02 17:44:31 UTC (rev 9660)
@@ -664,7 +664,10 @@
<xsl:copy-of select="$alt"/>
</xsl:when>
<xsl:when test="ancestor::figure">
- <xsl:value-of select="normalize-space(ancestor::figure/title)"/>
+ <xsl:variable name="fig.title">
+ <xsl:apply-templates select="ancestor::figure/title/node()"/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($fig.title)"/>
</xsl:when>
</xsl:choose>
</xsl:with-param>
@@ -1284,7 +1287,14 @@
<xsl:call-template name="process.image">
<xsl:with-param name="alt">
- <xsl:apply-templates select="$phrases[not(@role) or @role!='tex'][1]"/>
+ <xsl:choose>
+ <xsl:when test="ancestor::mediaobject/alt">
+ <xsl:apply-templates select="ancestor::mediaobject/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">
@@ -1427,6 +1437,10 @@
<!-- ==================================================================== -->
+<xsl:template match="mediaobject/alt">
+ <xsl:apply-templates/>
+</xsl:template>
+
<xsl:template match="videoobject">
<xsl:apply-templates select="videodata"/>
</xsl:template>
@@ -1435,7 +1449,14 @@
<xsl:call-template name="process.image">
<xsl:with-param name="tag" select="'embed'"/>
<xsl:with-param name="alt">
- <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
+ <xsl:choose>
+ <xsl:when test="ancestor::mediaobject/alt">
+ <xsl:apply-templates select="ancestor::mediaobject/alt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="(ancestor::mediaobject/textobject/phrase)[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
@@ -1450,7 +1471,14 @@
<xsl:call-template name="process.image">
<xsl:with-param name="tag" select="'embed'"/>
<xsl:with-param name="alt">
- <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
+ <xsl:choose>
+ <xsl:when test="ancestor::mediaobject/alt">
+ <xsl:apply-templates select="ancestor::mediaobject/alt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="(ancestor::mediaobject/textobject/phrase)[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|