]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix bug #1337 Elements with olink role do not behave as olink
authorBob Stayton <bobs@sagehill.net>
Thu, 28 Aug 2014 19:28:52 +0000 (19:28 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 28 Aug 2014 19:28:52 +0000 (19:28 +0000)
elements.

xsl/fo/xref.xsl

index 75b5a8907bdcbe5b25bf09606aa0eb40bc3629f8..defe710a649e399d61acdfc2e0663632faaa27a9 100644 (file)
   <xsl:copy>
     <xsl:for-each select="@*">
       <xsl:choose>
-        <xsl:when test="name(.) != 'id'">
+        <xsl:when test="local-name(.) != 'id'">
           <xsl:copy/>
         </xsl:when>
         <xsl:otherwise>
   </xsl:param>
 
   <xsl:variable name="content">
-    <fo:inline xsl:use-attribute-sets="xref.properties">
-      <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>
-        <!-- Use the xlink:href if no other text -->
-        <xsl:when test="@xlink:href">
+    <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>
+      <!-- Use the xlink:href if no other text -->
+      <xsl:when test="@xlink:href">
          <fo:inline hyphenate="false">
            <xsl:call-template name="hyphenate-url">
              <xsl:with-param name="url" select="@xlink:href"/>
            </xsl:call-template>
          </fo:inline>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:message>
-            <xsl:text>Link element has no content and no Endterm. </xsl:text>
-            <xsl:text>Nothing to show in the link to </xsl:text>
-            <xsl:value-of select="$target"/>
-          </xsl:message>
-          <xsl:text>???</xsl:text>
-        </xsl:otherwise>
-      </xsl:choose>
-    </fo:inline>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+          <xsl:text>Link element has no content and no Endterm. </xsl:text>
+          <xsl:text>Nothing to show in the link to </xsl:text>
+          <xsl:value-of select="$target"/>
+        </xsl:message>
+        <xsl:text>???</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="styled.content">
+    <xsl:choose>
+      <xsl:when test="@xlink:role = $xolink.role">
+        <!-- olink styling handled by simple.xlink -->
+        <xsl:copy-of select="$content"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <fo:inline xsl:use-attribute-sets="xref.properties">
+          <xsl:copy-of select="$content"/>
+        </fo:inline>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
   <xsl:call-template name="simple.xlink">
     <xsl:with-param name="node" select="."/>
     <xsl:with-param name="linkend" select="$linkend"/>
-    <xsl:with-param name="content" select="$content"/>
+    <xsl:with-param name="content" select="$styled.content"/>
   </xsl:call-template>
 
   <!-- Add standard page reference? -->
   <xsl:choose>
     <!-- page numbering on link only enabled for @linkend -->
-    <!-- There is no link element in DB5 with xlink:href -->
     <xsl:when test="not($linkend)">
     </xsl:when>
     <!-- negative xrefstyle in instance turns it off -->