[yelp] [db2html.xsl.in] Check chunk IDs when constructing xref URIs



commit 362e38c41ed2576c6c8bbd0e036e30724f22d573
Author: Shaun McCance <shaunm gnome org>
Date:   Thu Aug 5 16:18:37 2010 -0400

    [db2html.xsl.in] Check chunk IDs when constructing xref URIs
    
    I wasn't doing this before, because the doc transformations handle it just
    fine, but it turns out it's useful to have more correct page ID information
    in the URI before it ever goes to a YelpDocument.

 stylesheets/db2html.xsl.in |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/stylesheets/db2html.xsl.in b/stylesheets/db2html.xsl.in
index 4a2d48b..5a87e22 100644
--- a/stylesheets/db2html.xsl.in
+++ b/stylesheets/db2html.xsl.in
@@ -17,7 +17,24 @@
 <!-- == db.xref.target == -->
 <xsl:template name="db.xref.target">
   <xsl:param name="linkend"/>
-  <xsl:value-of select="concat('xref:', $linkend, '#', $linkend)"/>
+  <xsl:param name="target" select="key('idkey', $linkend)"/>
+  <xsl:param name="is_chunk" select="false()"/>
+  <xsl:choose>
+    <xsl:when test="$is_chunk">
+      <xsl:value-of select="concat('xref:', $linkend)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="target_chunk_id">
+        <xsl:call-template name="db.chunk.chunk-id">
+          <xsl:with-param name="node" select="$target"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:value-of select="concat('xref:', $target_chunk_id)"/>
+      <xsl:if test="$target_chunk_id != $linkend">
+        <xsl:value-of select="concat('#', $linkend)"/>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <!-- == db2html.division.head.extra == -->



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