]> granicus.if.org Git - docbook-dsssl/commitdiff
Modified match="co" template to use its linkends attribute
authorBob Stayton <bobs@sagehill.net>
Tue, 12 Mar 2002 19:35:30 +0000 (19:35 +0000)
committerBob Stayton <bobs@sagehill.net>
Tue, 12 Mar 2002 19:35:30 +0000 (19:35 +0000)
to form a hotlink to the callout element, forming the
two-ways links as described in
The Definitive Guide.  At this time, only a single linkend
value is supported, since HTML doesn't handle multiply-targeted
links.

xsl/html/callout.xsl

index 431e2588f01f7010682b7487e60708d6f3aecd8f..eadd8031dda878f658b5e49cd4b91aff8b17bb46 100644 (file)
 </xsl:template>
 
 <xsl:template match="co">
-  <xsl:call-template name="anchor"/>
-  <xsl:apply-templates select="." mode="callout-bug"/>
+  <!-- Support a single linkend in HTML -->
+  <xsl:variable name="targets" select="key('id', @linkends)"/>
+  <xsl:variable name="target" select="$targets[1]"/>
+  <xsl:choose>
+    <xsl:when test="$target">
+      <a>
+        <xsl:if test="@id">
+          <xsl:attribute name="name">
+            <xsl:value-of select="@id"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="." mode="callout-bug"/>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="anchor"/>
+      <xsl:apply-templates select="." mode="callout-bug"/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
+
+
+
 <xsl:template match="co" mode="callout-bug">
   <xsl:call-template name="callout-bug">
     <xsl:with-param name="conum">