[yelp-xsl] mal-link: Be more robust with non-functioning links



commit a2f5557e263636294543e43d8732bb8f62c7a179
Author: Shaun McCance <shaunm gnome org>
Date:   Tue Nov 27 10:24:01 2012 -0500

    mal-link: Be more robust with non-functioning links

 xslt/mallard/common/mal-link.xsl      |    7 +++++--
 xslt/mallard/html/mal2html-inline.xsl |   13 +++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
index 63cf424..73ef119 100644
--- a/xslt/mallard/common/mal-link.xsl
+++ b/xslt/mallard/common/mal-link.xsl
@@ -270,9 +270,12 @@ page or section cannot be found, ${xref} is used as the text content.
               <xsl:when test="$href">
                 <xsl:value-of select="$href"/>
               </xsl:when>
-              <xsl:otherwise>
+              <xsl:when test="$xref">
                 <xsl:value-of select="$xref"/>
-              </xsl:otherwise>
+              </xsl:when>
+              <xsl:when test="$action">
+                <xsl:value-of select="$action"/>
+              </xsl:when>
             </xsl:choose>
           </xsl:otherwise>
         </xsl:choose>
diff --git a/xslt/mallard/html/mal2html-inline.xsl b/xslt/mallard/html/mal2html-inline.xsl
index e5b28a0..e2256b0 100644
--- a/xslt/mallard/html/mal2html-inline.xsl
+++ b/xslt/mallard/html/mal2html-inline.xsl
@@ -99,13 +99,18 @@ an #{xref} or #{href} attribute.
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
+    <xsl:variable name="href">
+      <xsl:if test="$node/@action | $node/@xref | $node/@href">
+        <xsl:call-template name="mal.link.target">
+          <xsl:with-param name="node" select="$node"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
     <xsl:choose>
-      <xsl:when test="$node/@action | $node/@xref | $node/@href">
+      <xsl:when test="normalize-space($href) != ''">
         <a>
           <xsl:attribute name="href">
-            <xsl:call-template name="mal.link.target">
-              <xsl:with-param name="node" select="$node"/>
-            </xsl:call-template>
+            <xsl:value-of select="$href"/>
           </xsl:attribute>
           <xsl:attribute name="title">
             <xsl:call-template name="mal.link.tooltip">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]