source: stylesheets/xhtml/lfs-toc.xsl@ f7bd105

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since f7bd105 was f7bd105, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Updated the stylesheets and Makefile.
Removed contrib/, index-pdf.xml and goTidy.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4428 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 5.3 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns="http://www.w3.org/1999/xhtml"
5 version="1.0">
6
7 <!-- General settings -->
8 <xsl:param name="generate.toc">
9 appendix nop
10 book toc,title,figure,table,example,equation
11 chapter nop
12 part toc
13 preface nop
14 qandadiv nop
15 qandaset nop
16 reference nop
17 sect1 nop
18 sect2 nop
19 sect3 nop
20 sect4 nop
21 sect5 nop
22 section nop
23 set nop
24 </xsl:param>
25
26 <xsl:param name="toc.section.depth">1</xsl:param>
27
28 <xsl:param name="toc.max.depth">3</xsl:param>
29
30 <!-- Making the TOC -->
31 <xsl:template name="make.toc">
32 <xsl:param name="toc-context" select="."/>
33 <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
34 <xsl:if test="$nodes">
35 <div class="toc">
36 <h3>
37 <xsl:call-template name="gentext">
38 <xsl:with-param name="key">TableofContents</xsl:with-param>
39 </xsl:call-template>
40 </h3>
41 <ul>
42 <xsl:apply-templates select="$nodes" mode="toc">
43 <xsl:with-param name="toc-context" select="$toc-context"/>
44 </xsl:apply-templates>
45 </ul>
46 </div>
47 </xsl:if>
48 </xsl:template>
49
50 <!-- Making the subtocs -->
51 <xsl:template name="subtoc">
52 <xsl:param name="toc-context" select="."/>
53 <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
54 <xsl:variable name="subtoc">
55 <ul>
56 <xsl:apply-templates mode="toc" select="$nodes">
57 <xsl:with-param name="toc-context" select="$toc-context"/>
58 </xsl:apply-templates>
59 </ul>
60 </xsl:variable>
61 <xsl:variable name="depth">
62 <xsl:choose>
63 <xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
64 <xsl:otherwise>0</xsl:otherwise>
65 </xsl:choose>
66 </xsl:variable>
67 <xsl:variable name="depth.from.context"
68 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
69 <li class="{name(.)}">
70 <xsl:call-template name="toc.line">
71 <xsl:with-param name="toc-context" select="$toc-context"/>
72 </xsl:call-template>
73 <xsl:if test="$toc.section.depth &gt; $depth and count($nodes)&gt;0
74 and $toc.max.depth &gt; $depth.from.context">
75 <xsl:copy-of select="$subtoc"/>
76 </xsl:if>
77 </li>
78 </xsl:template>
79
80 <!--Adding the h* tags and dropping redundats links-->
81 <xsl:template name="toc.line">
82 <xsl:param name="toc-context" select="."/>
83 <xsl:param name="depth" select="1"/>
84 <xsl:param name="depth.from.context" select="8"/>
85 <xsl:choose>
86 <xsl:when test="local-name(.) = 'sect1'">
87 <a>
88 <xsl:attribute name="href">
89 <xsl:call-template name="href.target">
90 <xsl:with-param name="context" select="$toc-context"/>
91 </xsl:call-template>
92 </xsl:attribute>
93 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
94 </a>
95 </xsl:when>
96 <xsl:when test="local-name(.) = 'appendix'">
97 <a>
98 <xsl:attribute name="href">
99 <xsl:call-template name="href.target">
100 <xsl:with-param name="context" select="$toc-context"/>
101 </xsl:call-template>
102 </xsl:attribute>
103 <xsl:variable name="label">
104 <xsl:apply-templates select="." mode="label.markup"/>
105 </xsl:variable>
106 <xsl:copy-of select="$label"/>
107 <xsl:if test="$label != ''">
108 <xsl:value-of select="$autotoc.label.separator"/>
109 </xsl:if>
110 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
111 </a>
112 </xsl:when>
113 <xsl:when test="local-name(.) = 'chapter' or local-name(.) = 'preface'">
114 <h4>
115 <xsl:variable name="label">
116 <xsl:apply-templates select="." mode="label.markup"/>
117 </xsl:variable>
118 <xsl:copy-of select="$label"/>
119 <xsl:if test="$label != ''">
120 <xsl:value-of select="$autotoc.label.separator"/>
121 </xsl:if>
122 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
123 </h4>
124 </xsl:when>
125 <xsl:when test="local-name(.) = 'part'">
126 <h3>
127 <xsl:variable name="label">
128 <xsl:apply-templates select="." mode="label.markup"/>
129 </xsl:variable>
130 <xsl:copy-of select="$label"/>
131 <xsl:if test="$label != ''">
132 <xsl:value-of select="$autotoc.label.separator"/>
133 </xsl:if>
134 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
135 </h3>
136 </xsl:when>
137 <xsl:otherwise>
138 <h3>
139 <a>
140 <xsl:attribute name="href">
141 <xsl:call-template name="href.target">
142 <xsl:with-param name="context" select="$toc-context"/>
143 </xsl:call-template>
144 </xsl:attribute>
145 <xsl:variable name="label">
146 <xsl:apply-templates select="." mode="label.markup"/>
147 </xsl:variable>
148 <xsl:copy-of select="$label"/>
149 <xsl:if test="$label != ''">
150 <xsl:value-of select="$autotoc.label.separator"/>
151 </xsl:if>
152 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
153 </a>
154 </h3>
155 </xsl:otherwise>
156 </xsl:choose>
157 </xsl:template>
158
159</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.