[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

New [PATCH] Re: Suggestion for book TOC: one level deeper

From: Brian Denny <brian_at_briandenny.net>
Date: 2003-11-14 07:28:49 CET

On Tue, Nov 11, 2003 at 07:34:28PM -0800, Brian Denny wrote:
> My patch merely sets an XSL customization property that is already
> defined by the existing docbook-xsl stylesheets. However, it is
> possible to define an XSL customization layer that overrides entire
> XSL templates. I am 99% sure that it is possible to get what we want
> this way, without touching the XML. It's just a question of how (and
> how much work). If I knew more XSL I probably would have done it
> already. Maybe I'll look into it some more.

Okay, I looked into it some more. Revision 7740 paved the way for the
following patch, which I think does exactly what we want. (If we added
refentrys elsewhere that we *didn't* want to appear in the TOC, then we
would have to rethink this approach.) Opinions?

Log:
Customize the book's HTML stylesheets so that <refentry> elements
which are children of <sect1> or <sect2> elements are represented
in the Table of Contents.

Index: doc/book/tools/html-stylesheet.xsl
===================================================================
--- doc/book/tools/html-stylesheet.xsl (revision 7740)
+++ doc/book/tools/html-stylesheet.xsl (working copy)
@@ -3,5 +3,26 @@
   <xsl:import href="xsl/html/docbook.xsl"/>
 
   <xsl:param name="html.stylesheet">styles.css</xsl:param>
+ <xsl:param name="toc.section.depth">3</xsl:param>
+ <xsl:param name="annotate.toc">0</xsl:param>
 
+ <xsl:template match="sect1" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ <xsl:with-param name="nodes"
+ select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="sect2" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ <xsl:with-param name="nodes"
+ select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
+ </xsl:call-template>
+ </xsl:template>
+
 </xsl:stylesheet>
Index: doc/book/tools/chunk-stylesheet.xsl
===================================================================
--- doc/book/tools/chunk-stylesheet.xsl (revision 7740)
+++ doc/book/tools/chunk-stylesheet.xsl (working copy)
@@ -3,5 +3,26 @@
   <xsl:import href="xsl/html/chunk.xsl"/>
 
   <xsl:param name="html.stylesheet">styles.css</xsl:param>
+ <xsl:param name="toc.section.depth">3</xsl:param>
+ <xsl:param name="annotate.toc">0</xsl:param>
 
+ <xsl:template match="sect1" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ <xsl:with-param name="nodes"
+ select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="sect2" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ <xsl:with-param name="nodes"
+ select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
+ </xsl:call-template>
+ </xsl:template>
+
 </xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 14 07:20:12 2003

This is an archived mail posted to the Subversion Dev mailing list.