List:Commits« Previous MessageNext Message »
From:paul Date:October 6 2006 6:53pm
Subject:svn commit - mysqldoc@docsrva: r3566 - in trunk: . xsl.d
View as plain text  
Author: paul
Date: 2006-10-06 18:53:26 +0200 (Fri, 06 Oct 2006)
New Revision: 3566

Log:
 r10727@frost:  paul | 2006-10-06 11:52:54 -0500
 Refinement to URL-generation: Not all <section> elements have their own
 page, so don't generate links to those.  Instead, generate link to closest
 containing <section> that does have a page.


Modified:
   trunk/xsl.d/help-prep1.xsl
   trunk/xsl.d/mysqlweb-chunk.xsl

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


Modified: trunk/xsl.d/help-prep1.xsl
===================================================================
--- trunk/xsl.d/help-prep1.xsl	2006-10-06 15:55:15 UTC (rev 3565)
+++ trunk/xsl.d/help-prep1.xsl	2006-10-06 16:53:26 UTC (rev 3566)
Changed blocks: 4, Lines Added: 56, Lines Deleted: 6; 4199 bytes

@@ -92,10 +92,6 @@
     standalone="no"
 />
 
-<!--
-<xsl:preserve-space elements="*"/>
--->
-
 <!-- set to 1 to strip non-help-tag output (for debugging) -->
 <xsl:param name="non.help.output" select="1"/>
 

@@ -106,14 +102,29 @@
   Construct a key for TOC elements.
   This is used to look up xref targets and then find the <remark>
   elements under them that specify help topics.
+  <section> elements are included only if they actually correspond
+  to pages in the online manual (rather than being included inline in
+  a page). The $chunk.section.depth parameter of mysqlweb-chunk.xsl
+  determines how deep sections should be chunked. (Currently 3; if
+  that parameter changes, modify the depth in the toc-elt key.)
 -->
 
 <xsl:key
   name="toc-elt"
-  match="book|abstract|preface|chapter|appendix|section"
+  match="book|abstract|preface|chapter|appendix
+        |section[count(ancestor::section) &lt; 3]"
   use="@id"/>
 
 <!--
+  Construct a key for all elements with an @id attribute.
+  Used to look up ancestor elements when a pointed-to node isn't
+  in the TOC. In that case, we march up the ancestors to find one
+  that *is* in the TOC.
+-->
+
+<xsl:key name="id" match="*" use="@id"/>
+
+<!--
   Match paired <remark> elements that are tagged as help text
   with a @role attribute of 'help-XXX-begin' or 'help-XXX-end'.
   Write out a corresponding <help-XXX> begin tag or </help-XXX>

@@ -326,6 +337,10 @@
   cross-reference points to a section not represented in the help tables,
   so replace it with a URL for its online page. That way, the user can
   visit the referenced page using a web browser.
+  If @linkend points to a node that's not actually a page, it probably
+  points to a <para> or <example> or something similar.  In this case,
+  it's necessary to march up the chain of node ancestors until we find
+  a node that is a page and construct the URL based on the ancestor id.
 -->
 
 <xsl:template match="xref">

@@ -333,13 +348,48 @@
     select="key('toc-elt',@linkend)//remark[@role='help-topic']/@condition"/>
   <xsl:choose>
     <xsl:when test="$topic">
+      <!-- construct [HELP help-topic-value] -->
       <xsl:text>[HELP </xsl:text>
       <xsl:value-of select="$topic"/>
       <xsl:text>]</xsl:text>
     </xsl:when>
     <xsl:otherwise>
+      <!--
+        Construct URL for pointed-to node, or to its nearest ancestor that
+        is a TOC element.  If pointed-to node is a TOC element, use it.
+        Otherwise, check ancestors to find TOC element.
+      -->
+      <xsl:variable name="page-id">
+      <xsl:choose>
+        <xsl:when test="key('toc-elt',@linkend)">
+          <xsl:value-of select="@linkend"/>
+        </xsl:when>
+        <xsl:when test="key('toc-elt',key('id',@linkend)/../@id)">
+          <xsl:value-of select="key('id',@linkend)/../@id"/>
+        </xsl:when>
+        <xsl:when test="key('toc-elt',key('id',@linkend)/../../@id)">
+          <xsl:value-of select="key('id',@linkend)/../../@id"/>
+        </xsl:when>
+        <xsl:when test="key('toc-elt',key('id',@linkend)/../../../@id)">
+          <xsl:value-of select="key('id',@linkend)/../../../@id"/>
+        </xsl:when>
+        <xsl:when test="key('toc-elt',key('id',@linkend)/../../../../@id)">
+          <xsl:value-of select="key('id',@linkend)/../../../../@id"/>
+        </xsl:when>
+        <xsl:when test="key('toc-elt',key('id',@linkend)/../../../../../@id)">
+          <xsl:value-of select="key('id',@linkend)/../../../../../@id"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- if this message ever appears, add new levels above -->
+          <xsl:message terminate="yes">
+            <xsl:text>XREF: DID NOT FIND TOC-ABLE ANCESTOR FOR id=</xsl:text>
+            <xsl:value-of select="@linkend"/>
+          </xsl:message>
+        </xsl:otherwise>
+      </xsl:choose>
+      </xsl:variable>
       <xsl:value-of select="$doc.url.base"/>
-      <xsl:value-of select="@linkend"/>
+      <xsl:value-of select="$page-id"/>
       <xsl:text>.html</xsl:text>
     </xsl:otherwise>
   </xsl:choose>


Modified: trunk/xsl.d/mysqlweb-chunk.xsl
===================================================================
--- trunk/xsl.d/mysqlweb-chunk.xsl	2006-10-06 15:55:15 UTC (rev 3565)
+++ trunk/xsl.d/mysqlweb-chunk.xsl	2006-10-06 16:53:26 UTC (rev 3566)
Changed blocks: 1, Lines Added: 6, Lines Deleted: 0; 731 bytes

@@ -20,6 +20,12 @@
 <xsl:param name="use.id.as.filename" select="1"/>
 <xsl:param name="chunk.quietly" select="1"/>
 <xsl:param name="chunk.first.sections" select="1"/>
+
+<!--
+  How deep to chunk sections. Deeper sections are included inline
+  in the parent section page.  If this value changes, you MUST
+  also change the depth used for the toc-elt key of help-prep1.xsl.
+-->
 <xsl:param name="chunk.section.depth" select="3"/>
 
 <xsl:param name="chunker.output.doctype-public" select="''"/>


Thread
svn commit - mysqldoc@docsrva: r3566 - in trunk: . xsl.dpaul6 Oct