]> granicus.if.org Git - docbook-dsssl/commitdiff
Make endterm on xref higher priority than xreflabel on the target
authorNorman Walsh <ndw@nwalsh.com>
Sat, 28 Dec 2002 21:07:29 +0000 (21:07 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 28 Dec 2002 21:07:29 +0000 (21:07 +0000)
xsl/fo/xref.xsl
xsl/html/xref.xsl

index 740ab47289bdbdd6d26551436204be10d88286e6..c4bdaeef4faf025500f9818a074a6f45bfb39743 100644 (file)
       <xsl:text>???</xsl:text>
     </xsl:when>
 
+    <xsl:when test="@endterm">
+      <fo:basic-link internal-destination="{@linkend}"
+                     xsl:use-attribute-sets="xref.properties">
+        <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>
+      </fo:basic-link>
+    </xsl:when>
+
     <xsl:when test="$target/@xreflabel">
       <fo:basic-link internal-destination="{@linkend}"
                      xsl:use-attribute-sets="xref.properties">
     <xsl:otherwise>
       <fo:basic-link internal-destination="{@linkend}"
                      xsl:use-attribute-sets="xref.properties">
-        <xsl:choose>
-         <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 select="$target" mode="xref-to">
-              <xsl:with-param name="referrer" select="."/>
-              <xsl:with-param name="xrefstyle">
-                <xsl:choose>
-                  <xsl:when test="$use.role.as.xrefstyle != 0">
-                    <xsl:value-of select="@role"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:value-of select="@xrefstyle"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:otherwise>
-        </xsl:choose>
+        <xsl:apply-templates select="$target" mode="xref-to">
+          <xsl:with-param name="referrer" select="."/>
+          <xsl:with-param name="xrefstyle">
+            <xsl:choose>
+              <xsl:when test="$use.role.as.xrefstyle != 0">
+                <xsl:value-of select="@role"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@xrefstyle"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:apply-templates>
       </fo:basic-link>
     </xsl:otherwise>
   </xsl:choose>
index 7292da7379aa3b3264a7f84bd965a8ef00fb1652..868631b22bf7947ee3bc556bf7f91c25e7d15773 100644 (file)
       <xsl:text>???</xsl:text>
     </xsl:when>
 
+    <xsl:when test="@endterm">
+      <xsl:variable name="href">
+        <xsl:call-template name="href.target">
+          <xsl:with-param name="object" select="$target"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <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>
+          <a href="{$href}">
+            <xsl:text>???</xsl:text>
+          </a>
+        </xsl:when>
+        <xsl:otherwise>
+          <a href="{$href}">
+            <xsl:apply-templates select="$etarget" mode="endterm"/>
+          </a>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
     <xsl:when test="$target/@xreflabel">
       <a>
         <xsl:attribute name="href">
         </xsl:call-template>
       </xsl:variable>
 
-      <xsl:choose>
-        <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>
-              <a href="{$href}">
-                <xsl:text>???</xsl:text>
-              </a>
-            </xsl:when>
-            <xsl:otherwise>
-              <a href="{$href}">
-                <xsl:apply-templates select="$etarget" mode="endterm"/>
-              </a>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:when>
-
-        <xsl:otherwise>
-          <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
+      <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
 
-          <a href="{$href}">
-            <xsl:if test="$target/title or $target/*/title">
-              <xsl:attribute name="title">
-                <xsl:apply-templates select="$target" mode="xref-title"/>
-              </xsl:attribute>
-            </xsl:if>
-            <xsl:apply-templates select="$target" mode="xref-to">
-              <xsl:with-param name="referrer" select="."/>
-              <xsl:with-param name="xrefstyle">
-                <xsl:choose>
-                  <xsl:when test="$use.role.as.xrefstyle != 0">
-                    <xsl:value-of select="@role"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:value-of select="@xrefstyle"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </a>
+      <a href="{$href}">
+        <xsl:if test="$target/title or $target/*/title">
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="$target" mode="xref-title"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="$target" mode="xref-to">
+          <xsl:with-param name="referrer" select="."/>
+          <xsl:with-param name="xrefstyle">
+            <xsl:choose>
+              <xsl:when test="$use.role.as.xrefstyle != 0">
+                <xsl:value-of select="@role"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@xrefstyle"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:apply-templates>
+      </a>
 
-          <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>