</xsl:attribute>
</xsl:when>
</xsl:choose>
+</xsl:template>
+
+<xsl:template match="qandaentry" mode="html.title.attribute">
+ <xsl:apply-templates select="question" mode="html.title.attribute"/>
+</xsl:template>
+
+<xsl:template match="question" mode="html.title.attribute">
+ <xsl:variable name="label.text">
+ <xsl:apply-templates select="." mode="qanda.label"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($label.text) != 0">
+ <xsl:attribute name="title">
+ <xsl:value-of select="$label.text"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- Fall back to alt if available -->
+ <xsl:when test="alt">
+ <xsl:attribute name="title">
+ <xsl:value-of select="normalize-space(alt)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
</xsl:template>
<xsl:template name="dir">
<xsl:template match="question">
<xsl:variable name="deflabel">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::*[@defaultlabel]">
- <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
- /@defaultlabel"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$qanda.defaultlabel"/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<tr>
</xsl:call-template>
<xsl:variable name="label.content">
- <xsl:apply-templates select="." mode="label.markup"/>
- <xsl:if test="$deflabel = 'number' and not(label)">
- <xsl:apply-templates select="." mode="intralabel.punctuation"/>
- </xsl:if>
+ <xsl:apply-templates select="." mode="qanda.label"/>
</xsl:variable>
<xsl:if test="string-length($label.content) > 0">
</tr>
</xsl:template>
+<xsl:template match="*" mode="qanda.defaultlabel">
+ <xsl:choose>
+ <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+ <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+ /@defaultlabel"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$qanda.defaultlabel"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="question" mode="qanda.label">
+ <xsl:variable name="deflabel">
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
+ </xsl:variable>
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:if test="$deflabel = 'number' and not(label)">
+ <xsl:apply-templates select="." mode="intralabel.punctuation"/>
+ </xsl:if>
+</xsl:template>
+
<xsl:template match="answer">
<xsl:variable name="deflabel">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::*[@defaultlabel]">
- <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
- /@defaultlabel"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$qanda.defaultlabel"/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<tr class="{local-name(.)}">
</tr>
</xsl:template>
+<xsl:template match="answer" mode="qanda.label">
+ <xsl:apply-templates select="." mode="label.markup"/>
+</xsl:template>
+
<xsl:template match="label">
<xsl:apply-templates/>
</xsl:template>