]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for @xlink:show in the simple.xlink template. The "new" and "replace"
authorMauritz Jeanson <mj@johanneberg.com>
Fri, 14 Dec 2007 17:48:38 +0000 (17:48 +0000)
committerMauritz Jeanson <mj@johanneberg.com>
Fri, 14 Dec 2007 17:48:38 +0000 (17:48 +0000)
values are supported (corresponding to values of "_blank" and "_top" for the
ulink.target parameter). I have assumed that @xlink:show should override ulink.target
for external URI links. This closes bugs #1762023 and #1727498.

xsl/html/inline.xsl

index e2c18ff186749c614824bb0de74a763617f68769..b166feba3668d93c9fd8d100c6e918aedf117973 100644 (file)
   <xsl:param name="content">
     <xsl:apply-templates/>
   </xsl:param>
-  <xsl:param name="a.target"/>
   <xsl:param name="linkend" select="$node/@linkend"/>
   <xsl:param name="xhref" select="$node/@xlink:href"/>
 
+  <!-- Support for @xlink:show -->
+  <xsl:variable name="target.show">
+    <xsl:choose>
+      <xsl:when test="$node/@xlink:show = 'new'">_blank</xsl:when>
+      <xsl:when test="$node/@xlink:show = 'replace'">_top</xsl:when>
+      <xsl:otherwise></xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:variable name="link">
     <xsl:choose>
       <xsl:when test="$xhref and 
                     </xsl:otherwise>
                   </xsl:choose>
 
-                  <xsl:if test="$a.target">
+                  <xsl:if test="$target.show !=''">
                     <xsl:attribute name="target">
-                      <xsl:value-of select="$a.target"/>
+                      <xsl:value-of select="$target.show"/>
                     </xsl:attribute>
                   </xsl:if>
 
                   <xsl:value-of select="$node/@xlink:title"/>
                 </xsl:attribute>
               </xsl:if>
+
+             <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
+             <xsl:attribute name="target">
+               <xsl:choose>
+                 <xsl:when test="$target.show !=''">
+                   <xsl:value-of select="$target.show"/>
+                 </xsl:when>
+                 <xsl:otherwise>
+                 <xsl:value-of select="$ulink.target"/>
+                 </xsl:otherwise>
+               </xsl:choose>
+             </xsl:attribute>
+             
               <xsl:copy-of select="$content"/>
             </a>
           </xsl:otherwise>