Skip to content

Commit b7b3c7c

Browse files
committed
Add glossseealso template rule and support @linkend
I run into the problem of useing <glossseealso linkend="..."/> instead of <glossseealso otherterm="..."/>. As we are so get used to linkend in xref, I think it is natural to support this in <glossseealso> too. Although the commit contains several lines, the only change in comparison to the original template rule is this: <xsl:variable name="otherterm" select="(@otherterm|@linkend)[1]"/> The rest is like the original template rule.
1 parent e7af36d commit b7b3c7c

1 file changed

Lines changed: 52 additions & 1 deletion

File tree

suse2013/xhtml/glossary.xsl

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
xmlns="http://www.w3.org/1999/xhtml"
1212
xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0"
1313
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
14-
exclude-result-prefixes="exsl l t">
14+
xmlns:xlink="http://www.w3.org/1999/xlink"
15+
exclude-result-prefixes="exsl l t xlink">
1516

1617
<xsl:template match="glossary">
1718
<xsl:variable name="language">
@@ -143,4 +144,54 @@
143144
<xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
144145
</xsl:template>
145146

147+
148+
<xsl:template match="glossseealso">
149+
<xsl:variable name="otherterm" select="(@otherterm|@linkend)[1]"/><!-- SUSE -->
150+
<xsl:variable name="targets" select="key('id', $otherterm)"/>
151+
<xsl:variable name="target" select="$targets[1]"/>
152+
<xsl:variable name="xlink" select="@xlink:href"/>
153+
154+
<xsl:choose>
155+
<xsl:when test="$target">
156+
<a>
157+
<xsl:apply-templates select="." mode="common.html.attributes"/>
158+
<xsl:call-template name="id.attribute"/>
159+
<xsl:attribute name="href">
160+
<xsl:call-template name="href.target">
161+
<xsl:with-param name="object" select="$target"/>
162+
</xsl:call-template>
163+
</xsl:attribute>
164+
<xsl:apply-templates select="$target" mode="xref-to"/>
165+
</a>
166+
</xsl:when>
167+
<xsl:when test="$xlink">
168+
<xsl:call-template name="simple.xlink">
169+
<xsl:with-param name="content">
170+
<xsl:apply-templates/>
171+
</xsl:with-param>
172+
</xsl:call-template>
173+
</xsl:when>
174+
<xsl:when test="$otherterm != '' and not($target)">
175+
<xsl:message>
176+
<xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
177+
<xsl:value-of select="$otherterm"/>
178+
</xsl:message>
179+
<xsl:apply-templates/>
180+
</xsl:when>
181+
<xsl:otherwise>
182+
<xsl:apply-templates/>
183+
</xsl:otherwise>
184+
</xsl:choose>
185+
186+
<xsl:choose>
187+
<xsl:when test="position() = last()"/>
188+
<xsl:otherwise>
189+
<xsl:call-template name="gentext.template">
190+
<xsl:with-param name="context" select="'glossary'"/>
191+
<xsl:with-param name="name" select="'seealso-separator'"/>
192+
</xsl:call-template>
193+
</xsl:otherwise>
194+
</xsl:choose>
195+
</xsl:template>
196+
146197
</xsl:stylesheet>

0 commit comments

Comments
 (0)