Author: manuel
Date: 2007-03-31 13:23:02 -0600 (Sat, 31 Mar 2007)
New Revision: 7996
Modified:
branches/new-xsl/xhtml/lfs-sections.xsl
branches/new-xsl/xhtml/lfs-titles.xsl
branches/new-xsl/xhtml/lfs-toc.xsl
Log:
Revised xhtml/lfs-toc.xsl.
Activated chapters TOC generation.
Modified: branches/new-xsl/xhtml/lfs-sections.xsl
===================================================================
--- branches/new-xsl/xhtml/lfs-sections.xsl 2007-03-31 17:54:58 UTC (rev
7995)
+++ branches/new-xsl/xhtml/lfs-sections.xsl 2007-03-31 19:23:02 UTC (rev
7996)
@@ -8,6 +8,11 @@
<!-- This stylesheet controls how sections are handled -->
+ <!-- Chunk the first top-level section? 1 = yes, 0 = no
+ If chapters TOC are generated, this must be 1.
+ See also sect1.titlepage template in lfs-titles.xsl -->
+ <xsl:param name="chunk.first.sections" select="1"></xsl:param>
+
<!-- sect1:
When there is a role attibute, use it as the class value.
Removed unused code. -->
Modified: branches/new-xsl/xhtml/lfs-titles.xsl
===================================================================
--- branches/new-xsl/xhtml/lfs-titles.xsl 2007-03-31 17:54:58 UTC (rev
7995)
+++ branches/new-xsl/xhtml/lfs-titles.xsl 2007-03-31 19:23:02 UTC (rev
7996)
@@ -60,12 +60,14 @@
</xsl:template>
<!-- sect1.titlepage:
+ Select the proper template depending on if chapters TOC are
+ generated or not. -->
+ <!-- The original template is in
{docbook-xsl}/xhtml/titlepage.templates.xsl -->
+ <!-- Version for when there is no chapters TOC:
Uses h1 except for the first section, and removed a lot of unneeded
code. -->
- <!-- The original template is in
{docbook-xsl}/xhtml/titlepage.templates.xsl -->
+ <!--
<xsl:template name="sect1.titlepage">
<xsl:choose>
- <!-- I should find a better test, but if chapter TOC is readded
- h1 will be used always, thus no need to worry for now. -->
<xsl:when test="position() = 4">
<div class="titlepage">
<xsl:if test="@id">
@@ -89,6 +91,18 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+ -->
+ <!-- Version for when chapters TOC are generated:
+ Uses h1 and removed a lot of unneeded code. -->
+ <xsl:template name="sect1.titlepage">
+ <div class="titlepage">
+ <h1 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
+ <xsl:value-of select="title"/>
+ </h1>
+ </div>
+ </xsl:template>
<!-- sect2.titlepage:
Uses h2 and removed a lot of unneeded code.
Modified: branches/new-xsl/xhtml/lfs-toc.xsl
===================================================================
--- branches/new-xsl/xhtml/lfs-toc.xsl 2007-03-31 17:54:58 UTC (rev 7995)
+++ branches/new-xsl/xhtml/lfs-toc.xsl 2007-03-31 19:23:02 UTC (rev 7996)
@@ -4,30 +4,34 @@
xmlns="http://www.w3.org/1999/xhtml"
version="1.0">
- <!-- General settings -->
+ <!-- This stylesheet controls how the TOC are generated -->
+
+ <!-- Control generation of ToCs and LoTs -->
<xsl:param name="generate.toc">
- appendix nop
book toc,title
- chapter nop
+ preface toc
part toc
- preface nop
- qandadiv nop
- qandaset nop
- reference nop
+ chapter toc
+ appendix nop
sect1 nop
sect2 nop
sect3 nop
sect4 nop
sect5 nop
section nop
- set nop
</xsl:param>
+ <!-- How deep should recursive sections appear in the TOC? -->
<xsl:param name="toc.section.depth">1</xsl:param>
+ <!-- How maximaly deep should be each TOC? -->
<xsl:param name="toc.max.depth">3</xsl:param>
- <!-- Making the TOC -->
+ <!-- make.toc:
+ Using h3 for TOC title.
+ Using ul for TOC list style.
+ Removed code for $manual.toc and $qanda.in.toc -->
+ <!-- The original template is in {docbook-xsl}/xhtml/autotoc.xsl -->
<xsl:template name="make.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
@@ -47,7 +51,11 @@
</xsl:if>
</xsl:template>
- <!-- Making the subtocs -->
+ <!-- subtoc:
+ Using ul for TOC list style.
+ Removed code for $qanda.in.toc
+ Removed code for sect* others than sect1 -->
+ <!-- The original template is in {docbook-xsl}/xhtml/autotoc.xsl -->
<xsl:template name="subtoc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
@@ -65,24 +73,28 @@
</xsl:choose>
</xsl:variable>
<xsl:variable name="depth.from.context"
- select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+ select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
<li class="{name(.)}">
<xsl:call-template name="toc.line">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
<xsl:if test="$toc.section.depth > $depth and count($nodes)>0
- and $toc.max.depth > $depth.from.context">
+ and $toc.max.depth > $depth.from.context">
<xsl:copy-of select="$subtoc"/>
</xsl:if>
</li>
</xsl:template>
- <!--Adding the h* tags and dropping redundats links-->
+ <!-- toc.line:
+ Adding the h* tags and dropping redundats links.
+ This template is a full re-made version of the original one. -->
+ <!-- The original template is in {docbook-xsl}/xhtml/autotoc.xsl -->
<xsl:template name="toc.line">
<xsl:param name="toc-context" select="."/>
<xsl:param name="depth" select="1"/>
<xsl:param name="depth.from.context" select="8"/>
<xsl:choose>
+ <!-- For sect1 targets, create a link -->
<xsl:when test="local-name(.) = 'sect1'">
<a>
<xsl:attribute name="href">
@@ -93,6 +105,7 @@
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</xsl:when>
+ <!-- For appendix target, create a link and add the label -->
<xsl:when test="local-name(.) = 'appendix'">
<a>
<xsl:attribute name="href">
@@ -110,6 +123,7 @@
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</xsl:when>
+ <!-- For chapter and preface, use h4 and add the label -->
<xsl:when test="local-name(.) = 'chapter' or local-name(.) = 'preface'">
<h4>
<xsl:variable name="label">
@@ -122,6 +136,7 @@
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</h4>
</xsl:when>
+ <!-- for part, use h3 and add the label -->
<xsl:when test="local-name(.) = 'part'">
<h3>
<xsl:variable name="label">
@@ -134,6 +149,7 @@
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</h3>
</xsl:when>
+ <!-- For other targets like Index, create a link inside h3 plus label
it -->
<xsl:otherwise>
<h3>
<a>
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page