source: stylesheets/lfs-xsl/xhtml/lfs-navigational.xsl@ ccded7e

11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since ccded7e was ccded7e, checked in by Xi Ruoyao <xry111@…>, 3 years ago

clean up unused SVN prop entries

  • Property mode set to 100644
File size: 14.6 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 <!-- This stylesheet controls how page header and navigational links
8 are generated. -->
9
10 <!-- html.head:
11 Drop all navigational links from inside head xhtml output. -->
12 <!-- The original template is in {docbook-xsl}/xhtml/chunk-common.xsl -->
13 <xsl:template name="html.head">
14 <head>
15 <xsl:call-template name="system.head.content"/>
16 <xsl:call-template name="head.content"/>
17 <xsl:call-template name="user.head.content"/>
18 </head>
19 </xsl:template>
20
21 <!-- header.navigation:
22 Self-made template that full replaces the original one -->
23 <!-- The original template is in {docbook-xsl}/xhtml/chunk-common.xsl -->
24 <xsl:template name="header.navigation">
25 <xsl:param name="prev" select="/foo"/>
26 <xsl:param name="next" select="/foo"/>
27 <xsl:variable name="up" select="parent::*"/>
28 <xsl:variable name="home" select="/*[1]"/>
29 <!-- Don't generate the header in index.html -->
30 <xsl:if test="$home != .">
31 <div class="navheader">
32 <!-- Book title and version -->
33 <h4>
34 <xsl:apply-templates select="$home" mode="object.title.markup"/>
35 <xsl:text> - </xsl:text>
36 <xsl:apply-templates select="$home" mode="object.subtitle.markup"/>
37 </h4>
38 <!-- Except for preface, part, and index, add the title of the parent -->
39 <xsl:if test="$up != $home">
40 <h3>
41 <xsl:apply-templates select="$up" mode="object.title.markup"/>
42 </h3>
43 </xsl:if>
44 <!-- Create header navigational links -->
45 <xsl:call-template name="navigational.links">
46 <xsl:with-param name="prev" select="$prev"/>
47 <xsl:with-param name="next" select="$next"/>
48 <xsl:with-param name="up" select="$up"/>
49 <xsl:with-param name="home" select="$home"/>
50 </xsl:call-template>
51 </div>
52 </xsl:if>
53 </xsl:template>
54
55 <!-- footer.navigation:
56 Self-made template that full replaces the original one -->
57 <!-- The original template is in {docbook-xsl}/xhtml/chunk-common.xsl -->
58 <xsl:template name="footer.navigation">
59 <xsl:param name="prev" select="/foo"/>
60 <xsl:param name="next" select="/foo"/>
61 <xsl:variable name="up" select="parent::*"/>
62 <xsl:variable name="home" select="/*[1]"/>
63 <!-- Create footer navigational links -->
64 <div class="navfooter">
65 <xsl:call-template name="navigational.links">
66 <xsl:with-param name="prev" select="$prev"/>
67 <xsl:with-param name="next" select="$next"/>
68 <xsl:with-param name="up" select="$up"/>
69 <xsl:with-param name="home" select="$home"/>
70 </xsl:call-template>
71 </div>
72 <!-- In HLFS, add the features.js call -->
73 <xsl:if test="$book-type = 'hlfs'">
74 <script type="text/javascript">
75 <xsl:attribute name="src">
76 <xsl:choose>
77 <xsl:when test="local-name(.)='book' or local-name(.)='part' or
78 local-name(.)='index'">../features.js</xsl:when>
79 <xsl:otherwise>../../features.js</xsl:otherwise>
80 </xsl:choose>
81 </xsl:attribute>
82 </script>
83 </xsl:if>
84 </xsl:template>
85
86 <!-- navigational.links:
87 Self-made template to generate navigational links.
88 Most of the code come from the original header.navigation and
89 footer.navigation templates, with this changes:
90 Changed the output format from table to ul.
91 Placed the same links on both header and footer.
92 Added a title attribute to the link containing the target title
93 (it content is displayed when placing the mouse over the link)
94 For "Prev" and "Next" links, added the target title under it.
95 When "Next" target is the Index, added gentext support for the
96 Index title.
97 Skip links to dummy sect1. -->
98 <xsl:template name="navigational.links">
99 <xsl:param name="prev"/>
100 <xsl:param name="next"/>
101 <xsl:param name="up"/>
102 <xsl:param name="home"/>
103 <ul>
104 <!-- No prev link when prev is home -->
105 <xsl:if test="count($prev)&gt;0 and $prev != $home">
106 <li class="prev">
107 <xsl:choose>
108
109 <!-- If prev is a dummy sect1 that is the first one in a chapter,
110 links to the parent chapter.-->
111 <xsl:when test="$prev[@role='dummy'] and
112 count(preceding-sibling::sect1)=1">
113 <a accesskey="p">
114 <xsl:attribute name="href">
115 <xsl:call-template name="href.target">
116 <xsl:with-param name="object" select=".."/>
117 </xsl:call-template>
118 </xsl:attribute>
119 <xsl:attribute name="title">
120 <xsl:value-of select="../title"/>
121 </xsl:attribute>
122 <xsl:call-template name="navig.content">
123 <xsl:with-param name="direction" select="'prev'"/>
124 </xsl:call-template>
125 </a>
126 <p>
127 <xsl:value-of select="../title"/>
128 </p>
129 </xsl:when>
130
131 <!-- If prev is a dummy sect1 that is not the first one in a chapter,
132 links to the previous sect1.-->
133 <xsl:when test="$prev[@role='dummy'] and
134 count(preceding-sibling::sect1)&gt;1">
135 <a accesskey="p">
136 <xsl:attribute name="href">
137 <xsl:call-template name="href.target">
138 <xsl:with-param name="object" select="preceding-sibling::sect1[position()=2]"/>
139 </xsl:call-template>
140 </xsl:attribute>
141 <xsl:attribute name="title">
142 <xsl:value-of select="preceding-sibling::sect1[position()=2]/title"/>
143 </xsl:attribute>
144 <xsl:call-template name="navig.content">
145 <xsl:with-param name="direction" select="'prev'"/>
146 </xsl:call-template>
147 </a>
148 <p>
149 <xsl:value-of select="preceding-sibling::sect1[position()=2]/title"/>
150 </p>
151 </xsl:when>
152
153 <!-- Code for the "To Boot or To Chroot" CLFS links jumps. -->
154 <xsl:when test="$prev[@id='ch-chroot-devices'] or $prev[@id='ch-boot-whatnext']">
155 <a accesskey="p">
156 <xsl:attribute name="href">
157 <xsl:call-template name="href.target">
158 <xsl:with-param name="object" select="//sect1[@id='ch-temp-system-choose']"/>
159 </xsl:call-template>
160 </xsl:attribute>
161 <xsl:attribute name="title">
162 <xsl:value-of select="//sect1[@id='ch-temp-system-choose']/title"/>
163 </xsl:attribute>
164 <xsl:call-template name="navig.content">
165 <xsl:with-param name="direction" select="'prev'"/>
166 </xsl:call-template>
167 </a>
168 <p>
169 <xsl:value-of select="//sect1[@id='ch-temp-system-choose']/title"/>
170 </p>
171 </xsl:when>
172
173 <!-- Normal prev links -->
174 <xsl:otherwise>
175 <a accesskey="p">
176 <xsl:attribute name="href">
177 <xsl:call-template name="href.target">
178 <xsl:with-param name="object" select="$prev"/>
179 </xsl:call-template>
180 </xsl:attribute>
181 <xsl:attribute name="title">
182 <xsl:value-of select="$prev/title"/>
183 </xsl:attribute>
184 <xsl:call-template name="navig.content">
185 <xsl:with-param name="direction" select="'prev'"/>
186 </xsl:call-template>
187 </a>
188 <p>
189 <xsl:value-of select="$prev/title"/>
190 </p>
191 </xsl:otherwise>
192 </xsl:choose>
193 </li>
194 </xsl:if>
195
196
197 <!-- Next link except in the last page and in the CLFS "choose" page -->
198 <xsl:if test="count($next)&gt;0 and (not(@id) or @id!='ch-temp-system-choose')">
199 <li class="next">
200 <xsl:choose>
201
202 <!-- Current page is sect1 a next is a dummy sect1, link to the next one -->
203 <xsl:when test="$next[@role='dummy'] and local-name(.) = 'sect1'">
204 <a accesskey="n">
205 <xsl:attribute name="href">
206 <xsl:call-template name="href.target">
207 <xsl:with-param name="object" select="following-sibling::sect1[position()=2]"/>
208 </xsl:call-template>
209 </xsl:attribute>
210 <xsl:attribute name="title">
211 <xsl:value-of select="following-sibling::sect1[position()=2]/title"/>
212 </xsl:attribute>
213 <xsl:call-template name="navig.content">
214 <xsl:with-param name="direction" select="'next'"/>
215 </xsl:call-template>
216 </a>
217 <p>
218 <xsl:value-of select="following-sibling::sect1[position()=2]/title"/>
219 </p>
220 </xsl:when>
221
222 <!-- Current page is chapter and next is a dummy sect1, link to the next one -->
223 <xsl:when test="$next[@role='dummy'] and local-name(.) = 'chapter'">
224 <a accesskey="n">
225 <xsl:attribute name="href">
226 <xsl:call-template name="href.target">
227 <xsl:with-param name="object" select="descendant::sect1[position()=2]"/>
228 </xsl:call-template>
229 </xsl:attribute>
230 <xsl:attribute name="title">
231 <xsl:value-of select="descendant::sect1[position()=2]/title"/>
232 </xsl:attribute>
233 <xsl:call-template name="navig.content">
234 <xsl:with-param name="direction" select="'next'"/>
235 </xsl:call-template>
236 </a>
237 <p>
238 <xsl:value-of select="descendant::sect1[position()=2]/title"/>
239 </p>
240 </xsl:when>
241
242 <!-- Code for the "To Boot or To Chroot" CLFS links jumps. -->
243 <xsl:when test="$next[@id='chapter-chroot'] or $next[@id='chapter-boot']">
244 <a accesskey="n">
245 <xsl:attribute name="href">
246 <xsl:call-template name="href.target">
247 <xsl:with-param name="object" select="//part[@id='part5']"/>
248 </xsl:call-template>
249 </xsl:attribute>
250 <xsl:attribute name="title">
251 <xsl:value-of select="//part[@id='part5']/title"/>
252 </xsl:attribute>
253 <xsl:call-template name="navig.content">
254 <xsl:with-param name="direction" select="'next'"/>
255 </xsl:call-template>
256 </a>
257 <p>
258 <xsl:value-of select="//part[@id='part5']/title"/>
259 </p>
260 </xsl:when>
261
262 <!-- Normal next links. Take care of Index gentext support. -->
263 <xsl:otherwise>
264 <a accesskey="n">
265 <xsl:attribute name="href">
266 <xsl:call-template name="href.target">
267 <xsl:with-param name="object" select="$next"/>
268 </xsl:call-template>
269 </xsl:attribute>
270 <xsl:attribute name="title">
271 <xsl:choose>
272 <xsl:when test="local-name($next)='index'">
273 <xsl:call-template name="gentext">
274 <xsl:with-param name="key">Index</xsl:with-param>
275 </xsl:call-template>
276 </xsl:when>
277 <xsl:otherwise>
278 <xsl:value-of select="$next/title"/>
279 </xsl:otherwise>
280 </xsl:choose>
281 </xsl:attribute>
282 <xsl:call-template name="navig.content">
283 <xsl:with-param name="direction" select="'next'"/>
284 </xsl:call-template>
285 </a>
286 <p>
287 <xsl:choose>
288 <xsl:when test="local-name($next)='index'">
289 <xsl:call-template name="gentext">
290 <xsl:with-param name="key">Index</xsl:with-param>
291 </xsl:call-template>
292 </xsl:when>
293 <xsl:otherwise>
294 <xsl:value-of select="$next/title"/>
295 </xsl:otherwise>
296 </xsl:choose>
297 </p>
298 </xsl:otherwise>
299 </xsl:choose>
300 </li>
301 </xsl:if>
302
303
304 <li class="up">
305 <xsl:choose>
306 <!-- Up link except if up is home -->
307 <xsl:when test="count($up)&gt;0 and $up != $home">
308 <a accesskey="u">
309 <xsl:attribute name="href">
310 <xsl:call-template name="href.target">
311 <xsl:with-param name="object" select="$up"/>
312 </xsl:call-template>
313 </xsl:attribute>
314 <xsl:attribute name="title">
315 <xsl:apply-templates select="$up" mode="object.title.markup"/>
316 </xsl:attribute>
317 <xsl:call-template name="navig.content">
318 <xsl:with-param name="direction" select="'up'"/>
319 </xsl:call-template>
320 </a>
321 </xsl:when>
322 <!-- Hack to let the CSS code do its work when there is no up link -->
323 <xsl:otherwise>
324 <xsl:text>.</xsl:text>
325 </xsl:otherwise>
326 </xsl:choose>
327 </li>
328
329
330 <li class="home">
331 <xsl:choose>
332 <!-- No home link in home page -->
333 <xsl:when test="$home != .">
334 <a accesskey="h">
335 <xsl:attribute name="href">
336 <xsl:call-template name="href.target">
337 <xsl:with-param name="object" select="$home"/>
338 </xsl:call-template>
339 </xsl:attribute>
340 <xsl:attribute name="title">
341 <xsl:value-of select="$home/bookinfo/title"/>
342 <xsl:text> - </xsl:text>
343 <xsl:value-of select="$home/bookinfo/subtitle"/>
344 </xsl:attribute>
345 <xsl:call-template name="navig.content">
346 <xsl:with-param name="direction" select="'home'"/>
347 </xsl:call-template>
348 </a>
349 </xsl:when>
350 <!-- Hack to let the CSS code do its work when there is no home link -->
351 <xsl:otherwise>
352 <xsl:text>.</xsl:text>
353 </xsl:otherwise>
354 </xsl:choose>
355 </li>
356 </ul>
357 </xsl:template>
358
359</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.