gnome-doc-utils r1076 - in trunk: . xslt/docbook/common



Author: shaunm
Date: Tue Feb 12 17:07:24 2008
New Revision: 1076
URL: http://svn.gnome.org/viewvc/gnome-doc-utils?rev=1076&view=rev

Log:
* xslt/docbook/common/db-chunk.xsl:
* xslt/docbook/common/db-xref.xsl:
- Made chunks without id attributes work


Modified:
   trunk/ChangeLog
   trunk/xslt/docbook/common/db-chunk.xsl
   trunk/xslt/docbook/common/db-xref.xsl

Modified: trunk/xslt/docbook/common/db-chunk.xsl
==============================================================================
--- trunk/xslt/docbook/common/db-chunk.xsl	(original)
+++ trunk/xslt/docbook/common/db-chunk.xsl	Tue Feb 12 17:07:24 2008
@@ -141,11 +141,12 @@
       <xsl:when test="$template = 'info'">
         <xsl:value-of select="$db.chunk.info_basename"/>
       </xsl:when>
-      <xsl:when test="set:has-same-node($node, /*)">
-        <xsl:value-of select="$db.chunk.basename"/>
-      </xsl:when>
       <xsl:otherwise>
-        <xsl:value-of select="$node/@id"/>
+        <xsl:call-template name="db.chunk.chunk-id">
+          <xsl:with-param name="node" select="$node"/>
+          <xsl:with-param name="depth_in_chunk" select="0"/>
+          <xsl:with-param name="chunk" select="$node"/>
+        </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:value-of select="$db.chunk.extension"/>
@@ -340,7 +341,18 @@
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
   </xsl:param>
-  <xsl:value-of select="string($node/ancestor-or-self::*[$depth_in_chunk + 1]/@id)"/>
+  <xsl:param name="chunk" select="$node/ancestor-or-self::*[$depth_in_chunk + 1]"/>
+  <xsl:choose>
+    <xsl:when test="set:has-same-node($chunk, /*)">
+      <xsl:value-of select="$db.chunk.basename"/>
+    </xsl:when>
+    <xsl:when test="$chunk/@id">
+      <xsl:value-of select="string($chunk/@id)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="generate-id($chunk)"/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 
@@ -384,7 +396,11 @@
                                 concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="$divs">
-          <xsl:value-of select="string($divs[1]/@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$divs[1]"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$divs[1]"/>
+          </xsl:call-template>
         </xsl:when>
         <xsl:when test="$node/..">
           <xsl:call-template name="db.chunk.chunk-id.axis">
@@ -403,10 +419,18 @@
                                       concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="($depth_of_chunk &gt;= $db.chunk.max_depth)">
-          <xsl:value-of select="string($node/@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$node"/>
+          </xsl:call-template>
         </xsl:when>
         <xsl:when test="($depth_of_chunk + 1 = $db.chunk.max_depth) and $divs">
-          <xsl:value-of select="string($divs[last()]/@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$divs[last()]"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$divs[last()]"/>
+          </xsl:call-template>
         </xsl:when>
         <xsl:when test="$divs">
           <xsl:call-template name="db.chunk.chunk-id.axis">
@@ -417,7 +441,11 @@
           </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:value-of select="string($node/@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$node"/>
+          </xsl:call-template>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:when>
@@ -428,7 +456,11 @@
                                       concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="($depth_of_chunk &lt; $db.chunk.max_depth) and $divs">
-          <xsl:value-of select="string($divs[1]/@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$divs[1]"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$divs[1]"/>
+          </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
           <xsl:call-template name="db.chunk.chunk-id.axis">
@@ -456,10 +488,18 @@
           </xsl:call-template>
         </xsl:when>
         <xsl:when test="$divs">
-          <xsl:value-of select="string($divs[last()]/@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$divs[last()]"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$divs[last()]"/>
+          </xsl:call-template>
         </xsl:when>
         <xsl:when test="$node/..">
-          <xsl:value-of select="string($node/../@id)"/>
+          <xsl:call-template name="db.chunk.chunk-id">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="depth_in_chunk" select="0"/>
+            <xsl:with-param name="chunk" select="$node"/>
+          </xsl:call-template>
         </xsl:when>
       </xsl:choose>
     </xsl:when>

Modified: trunk/xslt/docbook/common/db-xref.xsl
==============================================================================
--- trunk/xslt/docbook/common/db-xref.xsl	(original)
+++ trunk/xslt/docbook/common/db-xref.xsl	Tue Feb 12 17:07:24 2008
@@ -375,16 +375,8 @@
           <xsl:with-param name="node" select="$target"/>
         </xsl:call-template>
       </xsl:variable>
-      <xsl:choose>
-        <xsl:when test="not($db.chunk.chunk_top) and
-                        string($target_chunk_id) = string(/*/@id)">
-          <xsl:value-of select="concat($db.chunk.basename, $db.chunk.extension)"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="concat($target_chunk_id, $db.chunk.extension)"/>
-        </xsl:otherwise>
-      </xsl:choose>
-      <xsl:if test="string($target_chunk_id) != string($linkend)">
+      <xsl:value-of select="concat($target_chunk_id, $db.chunk.extension)"/>
+      <xsl:if test="string($linkend) != '' and string($target_chunk_id) != string($linkend)">
         <xsl:value-of select="concat('#', $linkend)"/>
       </xsl:if>
     </xsl:otherwise>



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