MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:paul Date:November 2 2006 7:51pm
Subject:svn commit - mysqldoc@docsrva: r3833 - in trunk: . xsl.d
View as plain text  
Author: paul
Date: 2006-11-02 20:51:47 +0100 (Thu, 02 Nov 2006)
New Revision: 3833

Log:
 r15175@polar:  paul | 2006-11-02 13:50:23 -0600
 Tweaks to xref resolution


Modified:
   trunk/xsl.d/resolve-xref.xsl

Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:15165
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:11508
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:11301
   + 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:15175
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:11508
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:11301


Modified: trunk/xsl.d/resolve-xref.xsl
===================================================================
--- trunk/xsl.d/resolve-xref.xsl	2006-11-02 17:52:16 UTC (rev 3832)
+++ trunk/xsl.d/resolve-xref.xsl	2006-11-02 19:51:47 UTC (rev 3833)
Changed blocks: 3, Lines Added: 30, Lines Deleted: 12; 3496 bytes

@@ -12,10 +12,13 @@
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 <!-- process specific <toc-entry> on demand, substituting contents -->
-<!-- this template is used to resolve cross-references -->
+<!-- these templates are used to resolve cross-references -->
 
 <xsl:template match="toc-entry/toc-section-type">
-  <xsl:copy-of select="node()"/>
+  <xsl:if test="normalize-space(node())">
+    <xsl:copy-of select="node()"/>
+    <xsl:text> </xsl:text>
+  </xsl:if>
 </xsl:template>
 
 <xsl:template match="toc-entry/toc-number">

@@ -23,7 +26,7 @@
 </xsl:template>
 
 <xsl:template match="toc-entry/toc-title">
-  <xsl:apply-templates select="node()"/>
+  <xsl:apply-templates/>
 </xsl:template>
 
 <!--

@@ -34,37 +37,52 @@
 cross-reference couldn't be resolved. If the linkend is found
 multiple times, warn about that, too.
 
+The template prefers the linkend attribute (<xref linkend="xxx"/>), as
+used in DocBook.  However, the DTD for Study Guide 4.0/4.1 used the id
+attribute (<xref id="xxx"/>).  To accommodate documents written using
+either DTD, the template handles either attribute.
+
 This template can either retain the <xref> tags and attributes, or not.
 Any stylesheet that includes this one and uses the xref template
 must set the $retain-link-tag variable.
 -->
 
 <xsl:template match="xref">
-  <xsl:variable name="id" select="@linkend"/>
+  <xsl:variable name="id">
+    <xsl:choose>
+      <xsl:when test="@linkend">
+        <xsl:value-of select="@linkend"/> <!-- DocBook <xref> -->
+      </xsl:when>
+      <xsl:when test="@id">
+        <xsl:value-of select="@id"/>      <!-- studyguide-DTD <xref> -->
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+        <xsl:text>WARNING: bad xref: no @id or @linkend attribute found</xsl:text>
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
   <xsl:variable name="toc-entry" select="$toc-entries/*/toc-entry[@id=$id]"/>
   <xsl:variable name="count" select="count($toc-entry)"/>
   <xsl:variable name="link-content">
     <xsl:choose>
       <xsl:when test="$count=1">
-        <!-- get number for section. if not empty, display it preceded
+        <!-- Get number for section. If not empty, display it preceded
              by the type of thing is it (Chapter, Appendix, Section)
              and followed by a comma and a space.
              (preface sections have no numbers) -->
         <xsl:variable name="toc-number">
-          <xsl:apply-templates
-            select="$toc-entry/toc-number"/>
+          <xsl:apply-templates select="$toc-entry/toc-number"/>
         </xsl:variable>
         <xsl:if test="$toc-number != ''">
-          <xsl:apply-templates
-            select="$toc-entry/toc-section-type"/>
-          <xsl:text> </xsl:text>
+          <xsl:apply-templates select="$toc-entry/toc-section-type"/>
           <xsl:value-of select="$toc-number"/>
           <xsl:text>, </xsl:text>
         </xsl:if>
         <!-- display section title within quotes -->
         <xsl:text>"</xsl:text>
-        <xsl:apply-templates
-          select="$toc-entry/toc-title"/>
+        <xsl:apply-templates select="$toc-entry/toc-title"/>
         <!--
           Check whether next character is a punctuation character
           that should go inside the closing quote. Note: text processing


Thread
svn commit - mysqldoc@docsrva: r3833 - in trunk: . xsl.dpaul2 Nov