]> granicus.if.org Git - docbook-dsssl/commitdiff
If a link or xref has an @id or @xml:id, then add a span to
authorBob Stayton <bobs@sagehill.net>
Thu, 16 Oct 2014 01:01:39 +0000 (01:01 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 16 Oct 2014 01:01:39 +0000 (01:01 +0000)
include the id because simple.xlink no longer generates the
id attribute.

xsl/html/xref.xsl

index de33ae5a9c037bf290a8234e26cf453dac5b6602..2289c855aa2f13290ba45b26f5ab5df408f11940 100644 (file)
     </xsl:choose>
   </xsl:variable>
 
-  <xsl:call-template name="simple.xlink">
-    <xsl:with-param name="content" select="$content"/>
-  </xsl:call-template>
+  <xsl:variable name="id" select="(@id | @xml:id)[1]"/> 
+
+  <xsl:choose>
+    <xsl:when test="$id">
+      <span id="{$id}">
+        <xsl:call-template name="simple.xlink">
+          <xsl:with-param name="content" select="$content"/>
+        </xsl:call-template>
+      </span>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="simple.xlink">
+        <xsl:with-param name="content" select="$content"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
 
 </xsl:template>
 
     </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="a.target" select="$a.target"/>
-    <xsl:with-param name="xhref" select="$xhref"/>
-  </xsl:call-template>
+  <xsl:variable name="id" select="(@id | @xml:id)[1]"/> 
+
+  <xsl:choose>
+    <xsl:when test="$id">
+      <span id="{$id}">
+        <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="a.target" select="$a.target"/>
+          <xsl:with-param name="xhref" select="$xhref"/>
+        </xsl:call-template>
+      </span>
+    </xsl:when>
+    <xsl:otherwise>
+      <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="a.target" select="$a.target"/>
+        <xsl:with-param name="xhref" select="$xhref"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
 
 </xsl:template>