]> granicus.if.org Git - docbook-dsssl/commitdiff
Added fixes for bugs #2112656 and #1759205:
authorMauritz Jeanson <mj@johanneberg.com>
Sun, 15 Mar 2009 09:03:49 +0000 (09:03 +0000)
committerMauritz Jeanson <mj@johanneberg.com>
Sun, 15 Mar 2009 09:03:49 +0000 (09:03 +0000)
1. Reverted mistaken commits r7485 and r7523.
2. Updated the template with match="link" and mode="no.anchor.mode" so that
@endterm is used if it exists and if the link has no content.

xsl/common/titles.xsl

index 4be93ae128772c634c21be60bdb7a1e90f24c6d8..2d87a9498ea5484185812a1e32f5294396199772 100644 (file)
@@ -675,6 +675,36 @@ title of the element. This does not include the label.
   <xsl:apply-templates/>
 </xsl:template>
 
+<xsl:template match="link" mode="no.anchor.mode">
+  <xsl:choose>
+    <xsl:when test="count(child::node()) &gt; 0">
+      <!-- If it has content, use it -->
+      <xsl:apply-templates/>
+    </xsl:when>
+       <!-- look for an endterm -->
+    <xsl:when test="@endterm">
+      <xsl:variable name="etargets" select="key('id',@endterm)"/>
+      <xsl:variable name="etarget" select="$etargets[1]"/>
+      <xsl:choose>
+       <xsl:when test="count($etarget) = 0">
+          <xsl:message>
+           <xsl:value-of select="count($etargets)"/>
+           <xsl:text>Endterm points to nonexistent ID: </xsl:text>
+           <xsl:value-of select="@endterm"/>
+          </xsl:message>
+         <xsl:text>???</xsl:text>
+       </xsl:when>
+        <xsl:otherwise>
+         <xsl:apply-templates select="$etarget" mode="endterm"/>
+       </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template match="olink" mode="no.anchor.mode">
   <xsl:apply-templates/>
 </xsl:template>
@@ -683,7 +713,7 @@ title of the element. This does not include the label.
   <!-- nop, suppressed -->
 </xsl:template>
 
-<xsl:template match="xref|link" mode="no.anchor.mode">
+<xsl:template match="xref" mode="no.anchor.mode">
   <xsl:variable name="targets" select="key('id',@linkend)"/>
   <xsl:variable name="target" select="$targets[1]"/>
   <xsl:variable name="refelem" select="local-name($target)"/>