[yelp-xsl] Fixing cache and link issues



commit 60d27050e610d651f1b8fb1d261e216aa3136628
Author: Shaun McCance <shaunm gnome org>
Date:   Sat Jan 2 16:13:21 2010 -0600

    Fixing cache and link issues

 xslt/mallard/cache/mal-cache.xsl |    4 +-
 xslt/mallard/common/mal-link.xsl |   55 +++++++++++++++++--------------------
 2 files changed, 27 insertions(+), 32 deletions(-)
---
diff --git a/xslt/mallard/cache/mal-cache.xsl b/xslt/mallard/cache/mal-cache.xsl
index 488a517..3357909 100644
--- a/xslt/mallard/cache/mal-cache.xsl
+++ b/xslt/mallard/cache/mal-cache.xsl
@@ -130,13 +130,13 @@ mal.cache.info
 
 <!-- = /cache:cache = -->
 <xsl:template match='/cache:cache'>
-  <cache>
+  <cache:cache>
     <xsl:for-each select="mal:page">
       <xsl:apply-templates select="document(@cache:href)/*">
         <xsl:with-param name="node_in" select="."/>
       </xsl:apply-templates>
     </xsl:for-each>
-  </cache>
+  </cache:cache>
 </xsl:template>
 
 <!-- = mal:page = -->
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
index dd89cde..c082c16 100644
--- a/xslt/mallard/common/mal-link.xsl
+++ b/xslt/mallard/common/mal-link.xsl
@@ -17,8 +17,8 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
-                xmlns:mal="http://projectmallard.org/1.0/";
                 xmlns:cache="http://projectmallard.org/cache/1.0/";
+                xmlns:mal="http://projectmallard.org/1.0/";
                 xmlns:exsl="http://exslt.org/common";
                 xmlns:str="http://exslt.org/strings";
                 version="1.0">
@@ -158,32 +158,17 @@ page or section cannot be found, ${xref} is used as the text content.
   <xsl:param name="xref" select="$node/@xref"/>
   <xsl:param name="href" select="$node/@href"/>
   <xsl:param name="role" select="''"/>
-  <xsl:choose>
-    <xsl:when test="contains($xref, '/') or contains($xref, ':')">
-      <!--
-      This is a link to another document, which we don't handle in these
-      stylesheets.  Extensions such as library or yelp should override
-      this template to provide this functionality.
-      -->
-      <xsl:choose>
-        <xsl:when test="$href">
-          <xsl:value-of select="$href"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="$xref"/>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:variable name="linkid">
-        <xsl:call-template name="mal.link.xref.linkid">
-          <xsl:with-param name="node" select="$node"/>
-          <xsl:with-param name="xref" select="$xref"/>
-        </xsl:call-template>
-      </xsl:variable>
-      <xsl:for-each select="$mal.cache">
-        <xsl:variable name="titles" select="key('mal.cache.key', $linkid)
-                                           /mal:info/mal:title[ type = 'link']"/>
+  <xsl:variable name="linkid">
+    <xsl:call-template name="mal.link.xref.linkid">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="xref" select="$xref"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:for-each select="$mal.cache">
+    <xsl:variable name="target" select="key('mal.cache.key', $linkid)"/>
+    <xsl:choose>
+      <xsl:when test="$target">
+        <xsl:variable name="titles" select="$target/mal:info/mal:title[ type = 'link']"/>
         <xsl:choose>
           <xsl:when test="$role != '' and $titles[ role = $role]">
             <xsl:apply-templates mode="mal.link.content.mode"
@@ -194,9 +179,19 @@ page or section cannot be found, ${xref} is used as the text content.
                                  select="$titles[not(@role)][1]/node()"/>
           </xsl:otherwise>
         </xsl:choose>
-      </xsl:for-each>
-    </xsl:otherwise>
-  </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="$href">
+            <xsl:value-of select="$href"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$xref"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:for-each>
 </xsl:template>
 
 



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