Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: third_party/docbook-xsl-1.78.0/html/chunk-common.xsl

Issue 1394993002: Doing some cleanup. (Closed) Base URL: https://github.com/dart-lang/www.dartlang.org.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:exsl="http://exslt.org/common"
3 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
4 xmlns:ng="http://docbook.org/docbook-ng"
5 xmlns:db="http://docbook.org/ns/docbook"
6 version="1.0"
7 exclude-result-prefixes="exsl cf ng db">
8
9 <!-- ********************************************************************
10 $Id: chunk-common.xsl 9665 2012-11-08 14:26:20Z kosek $
11 ********************************************************************
12
13 This file is part of the XSL DocBook Stylesheet distribution.
14 See ../README or http://docbook.sf.net/release/xsl/current/ for
15 copyright and other information.
16
17 ******************************************************************** -->
18
19 <!-- ==================================================================== -->
20
21 <xsl:param name="onechunk" select="0"/>
22 <xsl:param name="refentry.separator" select="0"/>
23 <xsl:param name="chunk.fast" select="0"/>
24
25 <xsl:key name="genid" match="*" use="generate-id()"/>
26
27 <!-- ==================================================================== -->
28
29 <xsl:variable name="chunk.hierarchy">
30 <xsl:if test="$chunk.fast != 0">
31 <xsl:choose>
32 <!-- Are we handling a docbook5 document? -->
33 <xsl:when test="$exsl.node.set.available != 0
34 and (*/self::ng:* or */self::db:*)">
35 <xsl:if test="$chunk.quietly = 0">
36 <xsl:message>Computing stripped namespace chunks...</xsl:message>
37 </xsl:if>
38 <xsl:apply-templates mode="find.chunks" select="exsl:node-set($no.namesp ace)"/>
39 </xsl:when>
40 <xsl:when test="$exsl.node.set.available != 0">
41 <xsl:if test="$chunk.quietly = 0">
42 <xsl:message>Computing chunks...</xsl:message>
43 </xsl:if>
44
45 <xsl:apply-templates select="/*" mode="find.chunks"/>
46 </xsl:when>
47 <xsl:otherwise>
48 <xsl:if test="$chunk.quietly = 0">
49 <xsl:message>
50 <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
51 <xsl:text>Using "slow" chunking.</xsl:text>
52 </xsl:message>
53 </xsl:if>
54 </xsl:otherwise>
55 </xsl:choose>
56 </xsl:if>
57 </xsl:variable>
58
59 <!-- ==================================================================== -->
60
61 <xsl:template name="process-chunk-element">
62 <xsl:param name="content">
63 <xsl:apply-imports/>
64 </xsl:param>
65
66 <xsl:choose>
67 <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
68 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:di v"/>
69 <xsl:variable name="genid" select="generate-id()"/>
70
71 <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
72
73 <xsl:variable name="prevdiv"
74 select="($div/preceding-sibling::cf:div|$div/preceding::cf:d iv|$div/parent::cf:div)[last()]"/>
75 <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml :id)[1])"/>
76
77 <xsl:variable name="nextdiv"
78 select="($div/following-sibling::cf:div|$div/following::cf:d iv|$div/cf:div)[1]"/>
79 <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml :id)[1])"/>
80
81 <xsl:choose>
82 <xsl:when test="$onechunk != 0 and parent::*">
83 <xsl:copy-of select="$content"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:call-template name="process-chunk">
87 <xsl:with-param name="prev" select="$prev"/>
88 <xsl:with-param name="next" select="$next"/>
89 <xsl:with-param name="content" select="$content"/>
90 </xsl:call-template>
91 </xsl:otherwise>
92 </xsl:choose>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:choose>
96 <xsl:when test="$onechunk != 0 and not(parent::*)">
97 <xsl:call-template name="chunk-all-sections">
98 <xsl:with-param name="content" select="$content"/>
99 </xsl:call-template>
100 </xsl:when>
101 <xsl:when test="$onechunk != 0">
102 <xsl:copy-of select="$content"/>
103 </xsl:when>
104 <xsl:when test="$chunk.first.sections = 0">
105 <xsl:call-template name="chunk-first-section-with-parent">
106 <xsl:with-param name="content" select="$content"/>
107 </xsl:call-template>
108 </xsl:when>
109 <xsl:otherwise>
110 <xsl:call-template name="chunk-all-sections">
111 <xsl:with-param name="content" select="$content"/>
112 </xsl:call-template>
113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:otherwise>
116 </xsl:choose>
117 </xsl:template>
118
119 <xsl:template name="process-chunk">
120 <xsl:param name="prev" select="."/>
121 <xsl:param name="next" select="."/>
122 <xsl:param name="content">
123 <xsl:apply-imports/>
124 </xsl:param>
125
126 <xsl:variable name="ischunk">
127 <xsl:call-template name="chunk"/>
128 </xsl:variable>
129
130 <xsl:variable name="chunkfn">
131 <xsl:if test="$ischunk='1'">
132 <xsl:apply-templates mode="chunk-filename" select="."/>
133 </xsl:if>
134 </xsl:variable>
135
136 <xsl:if test="$ischunk='0'">
137 <xsl:message>
138 <xsl:text>Error </xsl:text>
139 <xsl:value-of select="name(.)"/>
140 <xsl:text> is not a chunk!</xsl:text>
141 </xsl:message>
142 </xsl:if>
143
144 <xsl:variable name="filename">
145 <xsl:call-template name="make-relative-filename">
146 <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
147 <xsl:with-param name="base.name" select="$chunkfn"/>
148 </xsl:call-template>
149 </xsl:variable>
150
151 <xsl:call-template name="write.chunk">
152 <xsl:with-param name="filename" select="$filename"/>
153 <xsl:with-param name="content">
154 <xsl:call-template name="chunk-element-content">
155 <xsl:with-param name="prev" select="$prev"/>
156 <xsl:with-param name="next" select="$next"/>
157 <xsl:with-param name="content" select="$content"/>
158 </xsl:call-template>
159 </xsl:with-param>
160 <xsl:with-param name="quiet" select="$chunk.quietly"/>
161 </xsl:call-template>
162 </xsl:template>
163
164 <xsl:template name="chunk-first-section-with-parent">
165 <xsl:param name="content">
166 <xsl:apply-imports/>
167 </xsl:param>
168
169 <!-- These xpath expressions are really hairy. The trick is to pick sections - ->
170 <!-- that are not first children and are not the children of first children -- >
171
172 <!-- Break these variables into pieces to work around
173 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
174
175 <xsl:variable name="prev-v1"
176 select="(ancestor::sect1[$chunk.section.depth &gt; 0
177 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
178 and preceding-sibling::sect1][1]
179
180 |ancestor::sect2[$chunk.section.depth &gt; 1
181 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
182 and preceding-sibling::sect2
183 and parent::sect1[preceding-sibling::sect1]][1]
184
185 |ancestor::sect3[$chunk.section.depth &gt; 2
186 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
187 and preceding-sibling::sect3
188 and parent::sect2[preceding-sibling::sect2]
189 and ancestor::sect1[preceding-sibling::sect1]][1]
190
191 |ancestor::sect4[$chunk.section.depth &gt; 3
192 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
193 and preceding-sibling::sect4
194 and parent::sect3[preceding-sibling::sect3]
195 and ancestor::sect2[preceding-sibling::sect2]
196 and ancestor::sect1[preceding-sibling::sect1]][1]
197
198 |ancestor::sect5[$chunk.section.depth &gt; 4
199 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
200 and preceding-sibling::sect5
201 and parent::sect4[preceding-sibling::sect4]
202 and ancestor::sect3[preceding-sibling::sect3]
203 and ancestor::sect2[preceding-sibling::sect2]
204 and ancestor::sect1[preceding-sibling::sect1]][1]
205
206 |ancestor::section[$chunk.section.depth &gt; count(ancestor::sectio n)
207 and not(ancestor::*/processing-instruction(' dbhtml')[normalize-space(.) ='stop-chunking'])
208 and not(ancestor::section[not(preceding-sibling: :section)])][1])[last()]"/>
209
210 <xsl:variable name="prev-v2"
211 select="(preceding::sect1[$chunk.section.depth &gt; 0
212 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
213 and preceding-sibling::sect1][1]
214
215 |preceding::sect2[$chunk.section.depth &gt; 1
216 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
217 and preceding-sibling::sect2
218 and parent::sect1[preceding-sibling::sect1]][1]
219
220 |preceding::sect3[$chunk.section.depth &gt; 2
221 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
222 and preceding-sibling::sect3
223 and parent::sect2[preceding-sibling::sect2]
224 and ancestor::sect1[preceding-sibling::sect1]][1]
225
226 |preceding::sect4[$chunk.section.depth &gt; 3
227 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
228 and preceding-sibling::sect4
229 and parent::sect3[preceding-sibling::sect3]
230 and ancestor::sect2[preceding-sibling::sect2]
231 and ancestor::sect1[preceding-sibling::sect1]][1]
232
233 |preceding::sect5[$chunk.section.depth &gt; 4
234 and not(ancestor::*/processing-instruction('dbhtm l')[normalize-space(.) ='stop-chunking'])
235 and preceding-sibling::sect5
236 and parent::sect4[preceding-sibling::sect4]
237 and ancestor::sect3[preceding-sibling::sect3]
238 and ancestor::sect2[preceding-sibling::sect2]
239 and ancestor::sect1[preceding-sibling::sect1]][1]
240
241 |preceding::section[$chunk.section.depth &gt; count(ancestor::secti on)
242 and not(ancestor::*/processing-instruction( 'dbhtml')[normalize-space(.) ='stop-chunking'])
243 and preceding-sibling::section
244 and not(ancestor::section[not(preceding-sibling ::section)])][1])[last()]"/>
245
246 <xsl:variable name="prev"
247 select="(preceding::book[1]
248 |preceding::preface[1]
249 |preceding::chapter[1]
250 |preceding::appendix[1]
251 |preceding::part[1]
252 |preceding::reference[1]
253 |preceding::refentry[1]
254 |preceding::colophon[1]
255 |preceding::article[1]
256 |preceding::topic[1]
257 |preceding::bibliography[parent::article or parent::book or parent: :part][1]
258 |preceding::glossary[parent::article or parent::book or parent::par t][1]
259 |preceding::index[$generate.index != 0]
260 [parent::article or parent::book or parent::part] [1]
261 |preceding::setindex[$generate.index != 0][1]
262 |ancestor::set
263 |ancestor::book[1]
264 |ancestor::preface[1]
265 |ancestor::chapter[1]
266 |ancestor::appendix[1]
267 |ancestor::part[1]
268 |ancestor::reference[1]
269 |ancestor::article[1]
270 |ancestor::topic[1]
271 |$prev-v1
272 |$prev-v2)[last()]"/>
273
274 <xsl:variable name="next-v1"
275 select="(following::sect1[$chunk.section.depth &gt; 0
276 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
277 and preceding-sibling::sect1][1]
278
279 |following::sect2[$chunk.section.depth &gt; 1
280 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
281 and preceding-sibling::sect2
282 and parent::sect1[preceding-sibling::sect1]][1]
283
284 |following::sect3[$chunk.section.depth &gt; 2
285 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
286 and preceding-sibling::sect3
287 and parent::sect2[preceding-sibling::sect2]
288 and ancestor::sect1[preceding-sibling::sect1]][1]
289
290 |following::sect4[$chunk.section.depth &gt; 3
291 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
292 and preceding-sibling::sect4
293 and parent::sect3[preceding-sibling::sect3]
294 and ancestor::sect2[preceding-sibling::sect2]
295 and ancestor::sect1[preceding-sibling::sect1]][1]
296
297 |following::sect5[$chunk.section.depth &gt; 4
298 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
299 and preceding-sibling::sect5
300 and parent::sect4[preceding-sibling::sect4]
301 and ancestor::sect3[preceding-sibling::sect3]
302 and ancestor::sect2[preceding-sibling::sect2]
303 and ancestor::sect1[preceding-sibling::sect1]][1]
304
305 |following::section[$chunk.section.depth &gt; count(ancestor::secti on)
306 and not(ancestor::*/processing-instruction( 'dbhtml')[normalize-space(.) ='stop-chunking'])
307 and preceding-sibling::section
308 and not(ancestor::section[not(preceding-sibling ::section)])][1])[1]"/>
309
310 <xsl:variable name="next-v2"
311 select="(descendant::sect1[$chunk.section.depth &gt; 0
312 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
313 and preceding-sibling::sect1][1]
314
315 |descendant::sect2[$chunk.section.depth &gt; 1
316 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
317 and preceding-sibling::sect2
318 and parent::sect1[preceding-sibling::sect1]][1]
319
320 |descendant::sect3[$chunk.section.depth &gt; 2
321 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
322 and preceding-sibling::sect3
323 and parent::sect2[preceding-sibling::sect2]
324 and ancestor::sect1[preceding-sibling::sect1]][1]
325
326 |descendant::sect4[$chunk.section.depth &gt; 3
327 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
328 and preceding-sibling::sect4
329 and parent::sect3[preceding-sibling::sect3]
330 and ancestor::sect2[preceding-sibling::sect2]
331 and ancestor::sect1[preceding-sibling::sect1]][1]
332
333 |descendant::sect5[$chunk.section.depth &gt; 4
334 and not(ancestor::*/processing-instruction('d bhtml')[normalize-space(.) ='stop-chunking'])
335 and preceding-sibling::sect5
336 and parent::sect4[preceding-sibling::sect4]
337 and ancestor::sect3[preceding-sibling::sect3]
338 and ancestor::sect2[preceding-sibling::sect2]
339 and ancestor::sect1[preceding-sibling::sect1]][1]
340
341 |descendant::section[$chunk.section.depth &gt; count(ancestor::sect ion)
342 and not(ancestor::*/processing-instruction( 'dbhtml')[normalize-space(.) ='stop-chunking'])
343 and preceding-sibling::section
344 and not(ancestor::section[not(preceding-sibling ::section)])])[1]"/>
345
346 <xsl:variable name="next"
347 select="(following::book[1]
348 |following::preface[1]
349 |following::chapter[1]
350 |following::appendix[1]
351 |following::part[1]
352 |following::reference[1]
353 |following::refentry[1]
354 |following::colophon[1]
355 |following::bibliography[parent::article or parent::book or parent: :part][1]
356 |following::glossary[parent::article or parent::book or parent::par t][1]
357 |following::index[$generate.index != 0]
358 [parent::article or parent::book or parent::part] [1]
359 |following::article[1]
360 |following::topic[1]
361 |following::setindex[$generate.index != 0][1]
362 |descendant::book[1]
363 |descendant::preface[1]
364 |descendant::chapter[1]
365 |descendant::appendix[1]
366 |descendant::article[1]
367 |descendant::topic[1]
368 |descendant::bibliography[parent::article or parent::book or parent ::part][1]
369 |descendant::glossary[parent::article or parent::book or parent::pa rt][1]
370 |descendant::index[$generate.index != 0]
371 [parent::article or parent::book or parent::part] [1]
372 |descendant::colophon[1]
373 |descendant::setindex[$generate.index != 0][1]
374 |descendant::part[1]
375 |descendant::reference[1]
376 |descendant::refentry[1]
377 |$next-v1
378 |$next-v2)[1]"/>
379
380 <xsl:call-template name="process-chunk">
381 <xsl:with-param name="prev" select="$prev"/>
382 <xsl:with-param name="next" select="$next"/>
383 <xsl:with-param name="content" select="$content"/>
384 </xsl:call-template>
385 </xsl:template>
386
387 <xsl:template name="chunk-all-sections">
388 <xsl:param name="content">
389 <xsl:apply-imports/>
390 </xsl:param>
391
392 <xsl:variable name="prev-v1"
393 select="(preceding::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/pr ocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
394 |preceding::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
395 |preceding::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
396 |preceding::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
397 |preceding::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
398 |preceding::section[$chunk.section.depth &gt; count(ancestor::secti on) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='st op-chunking'])][1])[last()]"/>
399
400 <xsl:variable name="prev-v2"
401 select="(ancestor::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/pro cessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
402 |ancestor::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/pr ocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
403 |ancestor::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/pr ocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
404 |ancestor::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/pr ocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
405 |ancestor::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/pr ocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
406 |ancestor::section[$chunk.section.depth &gt; count(ancestor::sectio n) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='sto p-chunking'])][1])[last()]"/>
407
408 <xsl:variable name="prev"
409 select="(preceding::book[1]
410 |preceding::preface[1]
411 |preceding::chapter[1]
412 |preceding::appendix[1]
413 |preceding::part[1]
414 |preceding::reference[1]
415 |preceding::refentry[1]
416 |preceding::colophon[1]
417 |preceding::article[1]
418 |preceding::topic[1]
419 |preceding::bibliography[parent::article or parent::book or parent: :part][1]
420 |preceding::glossary[parent::article or parent::book or parent::par t][1]
421 |preceding::index[$generate.index != 0]
422 [parent::article or parent::book or parent::part] [1]
423 |preceding::setindex[$generate.index != 0][1]
424 |ancestor::set
425 |ancestor::book[1]
426 |ancestor::preface[1]
427 |ancestor::chapter[1]
428 |ancestor::appendix[1]
429 |ancestor::part[1]
430 |ancestor::reference[1]
431 |ancestor::article[1]
432 |ancestor::topic[1]
433 |$prev-v1
434 |$prev-v2)[last()]"/>
435
436 <xsl:variable name="next-v1"
437 select="(following::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/pr ocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
438 |following::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
439 |following::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
440 |following::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
441 |following::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
442 |following::section[$chunk.section.depth &gt; count(ancestor::secti on) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='st op-chunking'])][1])[1]"/>
443
444 <xsl:variable name="next-v2"
445 select="(descendant::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/p rocessing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
446 |descendant::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/ processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
447 |descendant::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/ processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
448 |descendant::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/ processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
449 |descendant::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/ processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
450 |descendant::section[$chunk.section.depth
451 &gt; count(ancestor::section) and not(ancestor ::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[ 1]"/>
452
453 <xsl:variable name="next"
454 select="(following::book[1]
455 |following::preface[1]
456 |following::chapter[1]
457 |following::appendix[1]
458 |following::part[1]
459 |following::reference[1]
460 |following::refentry[1]
461 |following::colophon[1]
462 |following::bibliography[parent::article or parent::book or parent: :part][1]
463 |following::glossary[parent::article or parent::book or parent::par t][1]
464 |following::index[$generate.index != 0]
465 [parent::article or parent::book][1]
466 |following::article[1]
467 |following::topic[1]
468 |following::setindex[$generate.index != 0][1]
469 |descendant::book[1]
470 |descendant::preface[1]
471 |descendant::chapter[1]
472 |descendant::appendix[1]
473 |descendant::article[1]
474 |descendant::topic[1]
475 |descendant::bibliography[parent::article or parent::book][1]
476 |descendant::glossary[parent::article or parent::book or parent::pa rt][1]
477 |descendant::index[$generate.index != 0]
478 [parent::article or parent::book][1]
479 |descendant::colophon[1]
480 |descendant::setindex[$generate.index != 0][1]
481 |descendant::part[1]
482 |descendant::reference[1]
483 |descendant::refentry[1]
484 |$next-v1
485 |$next-v2)[1]"/>
486
487 <xsl:call-template name="process-chunk">
488 <xsl:with-param name="prev" select="$prev"/>
489 <xsl:with-param name="next" select="$next"/>
490 <xsl:with-param name="content" select="$content"/>
491 </xsl:call-template>
492 </xsl:template>
493
494 <!-- ==================================================================== -->
495
496 <!-- ==================================================================== -->
497
498 <xsl:template name="make.lots">
499 <xsl:param name="toc.params" select="''"/>
500 <xsl:param name="toc"/>
501
502 <xsl:variable name="lots">
503 <xsl:if test="contains($toc.params, 'toc')">
504 <xsl:copy-of select="$toc"/>
505 </xsl:if>
506
507 <xsl:if test="contains($toc.params, 'figure')">
508 <xsl:choose>
509 <xsl:when test="$chunk.separate.lots != '0'">
510 <xsl:call-template name="make.lot.chunk">
511 <xsl:with-param name="type" select="'figure'"/>
512 <xsl:with-param name="lot">
513 <xsl:call-template name="list.of.titles">
514 <xsl:with-param name="titles" select="'figure'"/>
515 <xsl:with-param name="nodes" select=".//figure"/>
516 </xsl:call-template>
517 </xsl:with-param>
518 </xsl:call-template>
519 </xsl:when>
520 <xsl:otherwise>
521 <xsl:call-template name="list.of.titles">
522 <xsl:with-param name="titles" select="'figure'"/>
523 <xsl:with-param name="nodes" select=".//figure"/>
524 </xsl:call-template>
525 </xsl:otherwise>
526 </xsl:choose>
527 </xsl:if>
528
529 <xsl:if test="contains($toc.params, 'table')">
530 <xsl:choose>
531 <xsl:when test="$chunk.separate.lots != '0'">
532 <xsl:call-template name="make.lot.chunk">
533 <xsl:with-param name="type" select="'table'"/>
534 <xsl:with-param name="lot">
535 <xsl:call-template name="list.of.titles">
536 <xsl:with-param name="titles" select="'table'"/>
537 <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0) ]"/>
538 </xsl:call-template>
539 </xsl:with-param>
540 </xsl:call-template>
541 </xsl:when>
542 <xsl:otherwise>
543 <xsl:call-template name="list.of.titles">
544 <xsl:with-param name="titles" select="'table'"/>
545 <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
546 </xsl:call-template>
547 </xsl:otherwise>
548 </xsl:choose>
549 </xsl:if>
550
551 <xsl:if test="contains($toc.params, 'example')">
552 <xsl:choose>
553 <xsl:when test="$chunk.separate.lots != '0'">
554 <xsl:call-template name="make.lot.chunk">
555 <xsl:with-param name="type" select="'example'"/>
556 <xsl:with-param name="lot">
557 <xsl:call-template name="list.of.titles">
558 <xsl:with-param name="titles" select="'example'"/>
559 <xsl:with-param name="nodes" select=".//example"/>
560 </xsl:call-template>
561 </xsl:with-param>
562 </xsl:call-template>
563 </xsl:when>
564 <xsl:otherwise>
565 <xsl:call-template name="list.of.titles">
566 <xsl:with-param name="titles" select="'example'"/>
567 <xsl:with-param name="nodes" select=".//example"/>
568 </xsl:call-template>
569 </xsl:otherwise>
570 </xsl:choose>
571 </xsl:if>
572
573 <xsl:if test="contains($toc.params, 'equation')">
574 <xsl:choose>
575 <xsl:when test="$chunk.separate.lots != '0'">
576 <xsl:call-template name="make.lot.chunk">
577 <xsl:with-param name="type" select="'equation'"/>
578 <xsl:with-param name="lot">
579 <xsl:call-template name="list.of.titles">
580 <xsl:with-param name="titles" select="'equation'"/>
581 <xsl:with-param name="nodes" select=".//equation[title or info/t itle]"/>
582 </xsl:call-template>
583 </xsl:with-param>
584 </xsl:call-template>
585 </xsl:when>
586 <xsl:otherwise>
587 <xsl:call-template name="list.of.titles">
588 <xsl:with-param name="titles" select="'equation'"/>
589 <xsl:with-param name="nodes" select=".//equation[title or info/title ]"/>
590 </xsl:call-template>
591 </xsl:otherwise>
592 </xsl:choose>
593 </xsl:if>
594
595 <xsl:if test="contains($toc.params, 'procedure')">
596 <xsl:choose>
597 <xsl:when test="$chunk.separate.lots != '0'">
598 <xsl:call-template name="make.lot.chunk">
599 <xsl:with-param name="type" select="'procedure'"/>
600 <xsl:with-param name="lot">
601 <xsl:call-template name="list.of.titles">
602 <xsl:with-param name="titles" select="'procedure'"/>
603 <xsl:with-param name="nodes" select=".//procedure[title]"/>
604 </xsl:call-template>
605 </xsl:with-param>
606 </xsl:call-template>
607 </xsl:when>
608 <xsl:otherwise>
609 <xsl:call-template name="list.of.titles">
610 <xsl:with-param name="titles" select="'procedure'"/>
611 <xsl:with-param name="nodes" select=".//procedure[title]"/>
612 </xsl:call-template>
613 </xsl:otherwise>
614 </xsl:choose>
615 </xsl:if>
616 </xsl:variable>
617
618 <xsl:if test="string($lots) != ''">
619 <xsl:choose>
620 <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
621 <xsl:call-template name="write.chunk">
622 <xsl:with-param name="filename">
623 <xsl:call-template name="make-relative-filename">
624 <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
625 <xsl:with-param name="base.name">
626 <xsl:call-template name="dbhtml-dir"/>
627 <xsl:value-of select="$chunked.filename.prefix"/>
628 <xsl:apply-templates select="." mode="recursive-chunk-filename">
629 <xsl:with-param name="recursive" select="true()"/>
630 </xsl:apply-templates>
631 <xsl:text>-toc</xsl:text>
632 <xsl:value-of select="$html.ext"/>
633 </xsl:with-param>
634 </xsl:call-template>
635 </xsl:with-param>
636 <xsl:with-param name="content">
637 <xsl:call-template name="chunk-element-content">
638 <xsl:with-param name="prev" select="/foo"/>
639 <xsl:with-param name="next" select="/foo"/>
640 <xsl:with-param name="nav.context" select="'toc'"/>
641 <xsl:with-param name="content">
642 <xsl:if test="$chunk.tocs.and.lots.has.title != 0">
643 <h1>
644 <xsl:apply-templates select="." mode="object.title.markup"/>
645 </h1>
646 </xsl:if>
647 <xsl:copy-of select="$lots"/>
648 </xsl:with-param>
649 </xsl:call-template>
650 </xsl:with-param>
651 <xsl:with-param name="quiet" select="$chunk.quietly"/>
652 </xsl:call-template>
653 </xsl:when>
654 <xsl:otherwise>
655 <xsl:copy-of select="$lots"/>
656 </xsl:otherwise>
657 </xsl:choose>
658 </xsl:if>
659 </xsl:template>
660
661 <xsl:template name="make.lot.chunk">
662 <xsl:param name="type" select="''"/>
663 <xsl:param name="lot"/>
664
665 <xsl:if test="string($lot) != ''">
666 <xsl:variable name="filename">
667 <xsl:call-template name="make-relative-filename">
668 <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
669 <xsl:with-param name="base.name">
670 <xsl:call-template name="dbhtml-dir"/>
671 <xsl:value-of select="$type"/>
672 <xsl:text>-toc</xsl:text>
673 <xsl:value-of select="$html.ext"/>
674 </xsl:with-param>
675 </xsl:call-template>
676 </xsl:variable>
677
678 <xsl:variable name="href">
679 <xsl:call-template name="make-relative-filename">
680 <xsl:with-param name="base.dir" select="''"/>
681 <xsl:with-param name="base.name">
682 <xsl:call-template name="dbhtml-dir"/>
683 <xsl:value-of select="$type"/>
684 <xsl:text>-toc</xsl:text>
685 <xsl:value-of select="$html.ext"/>
686 </xsl:with-param>
687 </xsl:call-template>
688 </xsl:variable>
689
690 <xsl:call-template name="write.chunk">
691 <xsl:with-param name="filename" select="$filename"/>
692 <xsl:with-param name="content">
693 <xsl:call-template name="chunk-element-content">
694 <xsl:with-param name="prev" select="/foo"/>
695 <xsl:with-param name="next" select="/foo"/>
696 <xsl:with-param name="nav.context" select="'toc'"/>
697 <xsl:with-param name="content">
698 <xsl:copy-of select="$lot"/>
699 </xsl:with-param>
700 </xsl:call-template>
701 </xsl:with-param>
702 <xsl:with-param name="quiet" select="$chunk.quietly"/>
703 </xsl:call-template>
704 <!-- And output a link to this file -->
705 <div>
706 <xsl:attribute name="class">
707 <xsl:text>ListofTitles</xsl:text>
708 </xsl:attribute>
709 <a href="{$href}">
710 <xsl:call-template name="gentext">
711 <xsl:with-param name="key">
712 <xsl:choose>
713 <xsl:when test="$type='table'">ListofTables</xsl:when>
714 <xsl:when test="$type='figure'">ListofFigures</xsl:when>
715 <xsl:when test="$type='equation'">ListofEquations</xsl:when>
716 <xsl:when test="$type='example'">ListofExamples</xsl:when>
717 <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
718 <xsl:otherwise>ListofUnknown</xsl:otherwise>
719 </xsl:choose>
720 </xsl:with-param>
721 </xsl:call-template>
722 </a>
723 </div>
724 </xsl:if>
725 </xsl:template>
726
727 <!-- ==================================================================== -->
728
729 <xsl:template name="in.other.chunk">
730 <xsl:param name="chunk" select="."/>
731 <xsl:param name="node" select="."/>
732
733 <xsl:variable name="is.chunk">
734 <xsl:call-template name="chunk">
735 <xsl:with-param name="node" select="$node"/>
736 </xsl:call-template>
737 </xsl:variable>
738
739 <!--
740 <xsl:message>
741 <xsl:text>in.other.chunk: </xsl:text>
742 <xsl:value-of select="name($chunk)"/>
743 <xsl:text> </xsl:text>
744 <xsl:value-of select="name($node)"/>
745 <xsl:text> </xsl:text>
746 <xsl:value-of select="$chunk = $node"/>
747 <xsl:text> </xsl:text>
748 <xsl:value-of select="$is.chunk"/>
749 </xsl:message>
750 -->
751
752 <xsl:choose>
753 <xsl:when test="$chunk = $node">0</xsl:when>
754 <xsl:when test="$is.chunk = 1">1</xsl:when>
755 <xsl:when test="count($node) = 0">0</xsl:when>
756 <xsl:otherwise>
757 <xsl:call-template name="in.other.chunk">
758 <xsl:with-param name="chunk" select="$chunk"/>
759 <xsl:with-param name="node" select="$node/parent::*"/>
760 </xsl:call-template>
761 </xsl:otherwise>
762 </xsl:choose>
763 </xsl:template>
764
765 <xsl:template name="count.footnotes.in.this.chunk">
766 <xsl:param name="node" select="."/>
767 <xsl:param name="footnotes" select="$node//footnote"/>
768 <xsl:param name="count" select="0"/>
769
770 <!--
771 <xsl:message>
772 <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
773 <xsl:value-of select="name($node)"/>
774 </xsl:message>
775 -->
776
777 <xsl:variable name="in.other.chunk">
778 <xsl:call-template name="in.other.chunk">
779 <xsl:with-param name="chunk" select="$node"/>
780 <xsl:with-param name="node" select="$footnotes[1]"/>
781 </xsl:call-template>
782 </xsl:variable>
783
784 <xsl:choose>
785 <xsl:when test="count($footnotes) = 0">
786 <xsl:value-of select="$count"/>
787 </xsl:when>
788 <xsl:otherwise>
789 <xsl:choose>
790 <xsl:when test="$in.other.chunk != 0">
791 <xsl:call-template name="count.footnotes.in.this.chunk">
792 <xsl:with-param name="node" select="$node"/>
793 <xsl:with-param name="footnotes"
794 select="$footnotes[position() &gt; 1]"/>
795 <xsl:with-param name="count" select="$count"/>
796 </xsl:call-template>
797 </xsl:when>
798 <xsl:when test="$footnotes[1]/ancestor::table
799 |$footnotes[1]/ancestor::informaltable">
800 <xsl:call-template name="count.footnotes.in.this.chunk">
801 <xsl:with-param name="node" select="$node"/>
802 <xsl:with-param name="footnotes"
803 select="$footnotes[position() &gt; 1]"/>
804 <xsl:with-param name="count" select="$count"/>
805 </xsl:call-template>
806 </xsl:when>
807 <xsl:otherwise>
808 <xsl:call-template name="count.footnotes.in.this.chunk">
809 <xsl:with-param name="node" select="$node"/>
810 <xsl:with-param name="footnotes"
811 select="$footnotes[position() &gt; 1]"/>
812 <xsl:with-param name="count" select="$count + 1"/>
813 </xsl:call-template>
814 </xsl:otherwise>
815 </xsl:choose>
816 </xsl:otherwise>
817 </xsl:choose>
818 </xsl:template>
819
820 <xsl:template name="process.footnotes.in.this.chunk">
821 <xsl:param name="node" select="."/>
822 <xsl:param name="footnotes" select="$node//footnote"/>
823
824 <!--
825 <xsl:message>process.footnotes.in.this.chunk</xsl:message>
826 -->
827
828 <xsl:variable name="in.other.chunk">
829 <xsl:call-template name="in.other.chunk">
830 <xsl:with-param name="chunk" select="$node"/>
831 <xsl:with-param name="node" select="$footnotes[1]"/>
832 </xsl:call-template>
833 </xsl:variable>
834
835 <xsl:choose>
836 <xsl:when test="count($footnotes) = 0">
837 <!-- nop -->
838 </xsl:when>
839 <xsl:otherwise>
840 <xsl:choose>
841 <xsl:when test="$in.other.chunk != 0">
842 <xsl:call-template name="process.footnotes.in.this.chunk">
843 <xsl:with-param name="node" select="$node"/>
844 <xsl:with-param name="footnotes"
845 select="$footnotes[position() &gt; 1]"/>
846 </xsl:call-template>
847 </xsl:when>
848 <xsl:when test="$footnotes[1]/ancestor::table
849 |$footnotes[1]/ancestor::informaltable">
850 <xsl:call-template name="process.footnotes.in.this.chunk">
851 <xsl:with-param name="node" select="$node"/>
852 <xsl:with-param name="footnotes"
853 select="$footnotes[position() &gt; 1]"/>
854 </xsl:call-template>
855 </xsl:when>
856 <xsl:otherwise>
857 <xsl:apply-templates select="$footnotes[1]"
858 mode="process.footnote.mode"/>
859 <xsl:call-template name="process.footnotes.in.this.chunk">
860 <xsl:with-param name="node" select="$node"/>
861 <xsl:with-param name="footnotes"
862 select="$footnotes[position() &gt; 1]"/>
863 </xsl:call-template>
864 </xsl:otherwise>
865 </xsl:choose>
866 </xsl:otherwise>
867 </xsl:choose>
868 </xsl:template>
869
870 <xsl:template name="process.footnotes">
871 <xsl:variable name="footnotes" select=".//footnote"/>
872 <xsl:variable name="fcount">
873 <xsl:call-template name="count.footnotes.in.this.chunk">
874 <xsl:with-param name="node" select="."/>
875 <xsl:with-param name="footnotes" select="$footnotes"/>
876 </xsl:call-template>
877 </xsl:variable>
878
879 <!--
880 <xsl:message>
881 <xsl:value-of select="name(.)"/>
882 <xsl:text> fcount: </xsl:text>
883 <xsl:value-of select="$fcount"/>
884 </xsl:message>
885 -->
886
887 <!-- Only bother to do this if there's at least one non-table footnote -->
888 <xsl:if test="$fcount &gt; 0">
889 <div class="footnotes">
890 <xsl:call-template name="footnotes.attributes"/>
891 <br/>
892 <hr>
893 <xsl:choose>
894 <xsl:when test="$make.clean.html != 0">
895 <xsl:attribute name="class">footnote-hr</xsl:attribute>
896 </xsl:when>
897 <xsl:when test="$css.decoration != 0">
898 <xsl:attribute name="style">
899 <xsl:value-of select="concat('width:100; text-align:',
900 $direction.align.start,
901 ';',
902 'margin-', $direction.align.start, ' : 0')"/>
903 </xsl:attribute>
904 </xsl:when>
905 <xsl:otherwise>
906 <xsl:attribute name="width">100</xsl:attribute>
907 <xsl:attribute name="align"><xsl:value-of
908 select="$direction.align.start"/></xsl:attribute>
909 </xsl:otherwise>
910 </xsl:choose>
911 </hr>
912 <xsl:call-template name="process.footnotes.in.this.chunk">
913 <xsl:with-param name="node" select="."/>
914 <xsl:with-param name="footnotes" select="$footnotes"/>
915 </xsl:call-template>
916 </div>
917 </xsl:if>
918
919 <!-- FIXME: When chunking, only the annotations actually used
920 in this chunk should be referenced. I don't think it
921 does any harm to reference them all, but it adds
922 unnecessary bloat to each chunk. -->
923 <xsl:if test="$annotation.support != 0 and //annotation">
924 <div class="annotation-list">
925 <div class="annotation-nocss">
926 <p>The following annotations are from this essay. You are seeing
927 them here because your browser doesn’t support the user-interface
928 techniques used to make them appear as ‘popups’ on modern browsers.</p>
929 </div>
930
931 <xsl:apply-templates select="//annotation"
932 mode="annotation-popup"/>
933 </div>
934 </xsl:if>
935 </xsl:template>
936
937 <xsl:template name="process.chunk.footnotes">
938 <xsl:variable name="is.chunk">
939 <xsl:call-template name="chunk"/>
940 </xsl:variable>
941 <xsl:if test="$is.chunk = 1">
942 <xsl:call-template name="process.footnotes"/>
943 </xsl:if>
944 </xsl:template>
945
946 <!-- ====================================================================== -->
947
948 <xsl:template name="chunk">
949 <xsl:param name="node" select="."/>
950 <!-- returns 1 if $node is a chunk -->
951
952 <!-- ==================================================================== -->
953 <!-- What's a chunk?
954
955 The root element
956 appendix
957 article
958 bibliography in article or part or book
959 book
960 chapter
961 colophon
962 glossary in article or part or book
963 index in article or part or book
964 part
965 preface
966 refentry
967 reference
968 sect{1,2,3,4,5} if position()>1 && depth < chunk.section.depth
969 section if position()>1 && depth < chunk.section.depth
970 set
971 setindex
972 topic
973 -->
974 <!-- ==================================================================== -->
975
976 <!--
977 <xsl:message>
978 <xsl:text>chunk: </xsl:text>
979 <xsl:value-of select="name($node)"/>
980 <xsl:text>(</xsl:text>
981 <xsl:value-of select="$node/@id"/>
982 <xsl:text>)</xsl:text>
983 <xsl:text> csd: </xsl:text>
984 <xsl:value-of select="$chunk.section.depth"/>
985 <xsl:text> cfs: </xsl:text>
986 <xsl:value-of select="$chunk.first.sections"/>
987 <xsl:text> ps: </xsl:text>
988 <xsl:value-of select="count($node/parent::section)"/>
989 <xsl:text> prs: </xsl:text>
990 <xsl:value-of select="count($node/preceding-sibling::section)"/>
991 </xsl:message>
992 -->
993
994 <xsl:choose>
995 <xsl:when test="$node/parent::*/processing-instruction('dbhtml')[norma lize-space(.) = 'stop-chunking']">0</xsl:when>
996 <xsl:when test="not($node/parent::*)">1</xsl:when>
997
998 <xsl:when test="local-name($node) = 'sect1'
999 and $chunk.section.depth &gt;= 1
1000 and ($chunk.first.sections != 0
1001 or count($node/preceding-sibling::sect1) &gt; 0)">
1002 <xsl:text>1</xsl:text>
1003 </xsl:when>
1004 <xsl:when test="local-name($node) = 'sect2'
1005 and $chunk.section.depth &gt;= 2
1006 and ($chunk.first.sections != 0
1007 or count($node/preceding-sibling::sect2) &gt; 0)">
1008 <xsl:call-template name="chunk">
1009 <xsl:with-param name="node" select="$node/parent::*"/>
1010 </xsl:call-template>
1011 </xsl:when>
1012 <xsl:when test="local-name($node) = 'sect3'
1013 and $chunk.section.depth &gt;= 3
1014 and ($chunk.first.sections != 0
1015 or count($node/preceding-sibling::sect3) &gt; 0)">
1016 <xsl:call-template name="chunk">
1017 <xsl:with-param name="node" select="$node/parent::*"/>
1018 </xsl:call-template>
1019 </xsl:when>
1020 <xsl:when test="local-name($node) = 'sect4'
1021 and $chunk.section.depth &gt;= 4
1022 and ($chunk.first.sections != 0
1023 or count($node/preceding-sibling::sect4) &gt; 0)">
1024 <xsl:call-template name="chunk">
1025 <xsl:with-param name="node" select="$node/parent::*"/>
1026 </xsl:call-template>
1027 </xsl:when>
1028 <xsl:when test="local-name($node) = 'sect5'
1029 and $chunk.section.depth &gt;= 5
1030 and ($chunk.first.sections != 0
1031 or count($node/preceding-sibling::sect5) &gt; 0)">
1032 <xsl:call-template name="chunk">
1033 <xsl:with-param name="node" select="$node/parent::*"/>
1034 </xsl:call-template>
1035 </xsl:when>
1036 <xsl:when test="local-name($node) = 'section'
1037 and $chunk.section.depth &gt;= count($node/ancestor::section )+1
1038 and ($chunk.first.sections != 0
1039 or count($node/preceding-sibling::section) &gt; 0)">
1040 <xsl:call-template name="chunk">
1041 <xsl:with-param name="node" select="$node/parent::*"/>
1042 </xsl:call-template>
1043 </xsl:when>
1044
1045 <xsl:when test="local-name($node)='preface'">1</xsl:when>
1046 <xsl:when test="local-name($node)='chapter'">1</xsl:when>
1047 <xsl:when test="local-name($node)='appendix'">1</xsl:when>
1048 <xsl:when test="local-name($node)='article'">1</xsl:when>
1049 <xsl:when test="local-name($node)='topic'">1</xsl:when>
1050 <xsl:when test="local-name($node)='part'">1</xsl:when>
1051 <xsl:when test="local-name($node)='reference'">1</xsl:when>
1052 <xsl:when test="local-name($node)='refentry'">1</xsl:when>
1053 <xsl:when test="local-name($node)='index' and ($generate.index != 0 or count ($node/*) > 0)
1054 and (local-name($node/parent::*) = 'article'
1055 or local-name($node/parent::*) = 'book'
1056 or local-name($node/parent::*) = 'part'
1057 )">1</xsl:when>
1058 <xsl:when test="local-name($node)='bibliography'
1059 and (local-name($node/parent::*) = 'article'
1060 or local-name($node/parent::*) = 'book'
1061 or local-name($node/parent::*) = 'part'
1062 )">1</xsl:when>
1063 <xsl:when test="local-name($node)='glossary'
1064 and (local-name($node/parent::*) = 'article'
1065 or local-name($node/parent::*) = 'book'
1066 or local-name($node/parent::*) = 'part'
1067 )">1</xsl:when>
1068 <xsl:when test="local-name($node)='colophon'">1</xsl:when>
1069 <xsl:when test="local-name($node)='book'">1</xsl:when>
1070 <xsl:when test="local-name($node)='set'">1</xsl:when>
1071 <xsl:when test="local-name($node)='setindex'">1</xsl:when>
1072 <xsl:when test="local-name($node)='legalnotice'
1073 and $generate.legalnotice.link != 0">1</xsl:when>
1074 <xsl:otherwise>0</xsl:otherwise>
1075 </xsl:choose>
1076 </xsl:template>
1077
1078 <!-- ==================================================================== -->
1079 <xsl:template name="href.target.uri">
1080 <xsl:param name="object" select="."/>
1081 <xsl:variable name="ischunk">
1082 <xsl:call-template name="chunk">
1083 <xsl:with-param name="node" select="$object"/>
1084 </xsl:call-template>
1085 </xsl:variable>
1086
1087 <xsl:apply-templates mode="chunk-filename" select="$object"/>
1088
1089 <xsl:if test="$ischunk='0'">
1090 <xsl:text>#</xsl:text>
1091 <xsl:call-template name="object.id">
1092 <xsl:with-param name="object" select="$object"/>
1093 </xsl:call-template>
1094 </xsl:if>
1095 </xsl:template>
1096
1097 <xsl:template name="href.target">
1098 <xsl:param name="context" select="."/>
1099 <xsl:param name="object" select="."/>
1100 <xsl:param name="toc-context" select="."/>
1101 <!-- * If $toc-context contains some node other than the current node, -->
1102 <!-- * it means we're processing a link in a TOC. In that case, to -->
1103 <!-- * ensure the link will work correctly, we need to take a look at -->
1104 <!-- * where the file containing the TOC will get written, and where -->
1105 <!-- * the file that's being linked to will get written. -->
1106 <xsl:variable name="toc-output-dir">
1107 <xsl:if test="not($toc-context = .)">
1108 <!-- * Get the $toc-context node and all its ancestors, look down -->
1109 <!-- * through them to find the last/closest node to the -->
1110 <!-- * toc-context node that has a "dbhtml dir" PI, and get the -->
1111 <!-- * directory name from that. That's the name of the directory -->
1112 <!-- * to which the current toc output file will get written. -->
1113 <xsl:call-template name="dbhtml-dir">
1114 <xsl:with-param name="context"
1115 select="$toc-context/ancestor-or-self::*[processing-instruction('dbhtm l')[contains(.,'dir')]][last()]"/>
1116 </xsl:call-template>
1117 </xsl:if>
1118 </xsl:variable>
1119 <xsl:variable name="linked-file-output-dir">
1120 <xsl:if test="not($toc-context = .)">
1121 <!-- * Get the current node and all its ancestors, look down -->
1122 <!-- * through them to find the last/closest node to the current -->
1123 <!-- * node that has a "dbhtml dir" PI, and get the directory name -->
1124 <!-- * from that. That's the name of the directory to which the -->
1125 <!-- * file that's being linked to will get written. -->
1126 <xsl:call-template name="dbhtml-dir">
1127 <xsl:with-param name="context"
1128 select="ancestor-or-self::*[processing-instruction('dbhtml')[contains( .,'dir')]][last()]"/>
1129 </xsl:call-template>
1130 </xsl:if>
1131 </xsl:variable>
1132 <xsl:variable name="href.to.uri">
1133 <xsl:call-template name="href.target.uri">
1134 <xsl:with-param name="object" select="$object"/>
1135 </xsl:call-template>
1136 </xsl:variable>
1137 <xsl:variable name="href.from.uri">
1138 <xsl:choose>
1139 <xsl:when test="not($toc-context = .)">
1140 <xsl:call-template name="href.target.uri">
1141 <xsl:with-param name="object" select="$toc-context"/>
1142 </xsl:call-template>
1143 </xsl:when>
1144 <xsl:otherwise>
1145 <xsl:call-template name="href.target.uri">
1146 <xsl:with-param name="object" select="$context"/>
1147 </xsl:call-template>
1148 </xsl:otherwise>
1149 </xsl:choose>
1150 </xsl:variable>
1151 <!-- * <xsl:message>toc-context: <xsl:value-of select="local-name($toc-context )"/></xsl:message> -->
1152 <!-- * <xsl:message>node: <xsl:value-of select="local-name(.)"/></xsl:message> -->
1153 <!-- * <xsl:message>context: <xsl:value-of select="local-name($context)"/></xs l:message> -->
1154 <!-- * <xsl:message>object: <xsl:value-of select="local-name($object)"/></xsl: message> -->
1155 <!-- * <xsl:message>toc-output-dir: <xsl:value-of select="$toc-output-dir"/></ xsl:message> -->
1156 <!-- * <xsl:message>linked-file-output-dir: <xsl:value-of select="$linked-file -output-dir"/></xsl:message> -->
1157 <!-- * <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:me ssage> -->
1158 <!-- * <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xs l:message> -->
1159 <xsl:variable name="href.to">
1160 <xsl:choose>
1161 <!-- * 2007-07-19, MikeSmith: Added the following conditional to -->
1162 <!-- * deal with a problem case for links in TOCs. It checks to see -->
1163 <!-- * if the output dir that a TOC will get written to is -->
1164 <!-- * different from the output dir of the file being linked to. -->
1165 <!-- * If it is different, we do not call trim.common.uri.paths. -->
1166 <!-- * -->
1167 <!-- * Reason why I added that conditional is: I ran into a bug for -->
1168 <!-- * this case: -->
1169 <!-- * -->
1170 <!-- * 1. we are chunking into separate dirs -->
1171 <!-- * -->
1172 <!-- * 2. output for the TOC is written to current dir, but the file -->
1173 <!-- * being linked to is written to some subdir "foo". -->
1174 <!-- * -->
1175 <!-- * For that case, links to that file in that TOC did not show -->
1176 <!-- * the correct path - they omitted the "foo". -->
1177 <!-- * -->
1178 <!-- * The cause of that problem was that the trim.common.uri.paths -->
1179 <!-- * template[1] was being called under all conditions. But it's -->
1180 <!-- * apparent that we don't want to call trim.common.uri.paths in -->
1181 <!-- * the case where a linked file is being written to a different -->
1182 <!-- * directory than the TOC that contains the link, because doing -->
1183 <!-- * so will cause a necessary (not redundant) directory-name -->
1184 <!-- * part of the link to get inadvertently trimmed, resulting in -->
1185 <!-- * a broken link to that file. Thus, added the conditional. -->
1186 <!-- * -->
1187 <!-- * [1] The purpose of the trim.common.uri.paths template is to -->
1188 <!-- * prevent cases where, if we didn't call it, we end up with -->
1189 <!-- * unnecessary, redundant directory names getting output; for -->
1190 <!-- * example, "foo/foo/refname.html". -->
1191 <xsl:when test="not($toc-output-dir = $linked-file-output-dir)">
1192 <xsl:value-of select="$href.to.uri"/>
1193 </xsl:when>
1194 <xsl:otherwise>
1195 <xsl:call-template name="trim.common.uri.paths">
1196 <xsl:with-param name="uriA" select="$href.to.uri"/>
1197 <xsl:with-param name="uriB" select="$href.from.uri"/>
1198 <xsl:with-param name="return" select="'A'"/>
1199 </xsl:call-template>
1200 </xsl:otherwise>
1201 </xsl:choose>
1202 </xsl:variable>
1203 <xsl:variable name="href.from">
1204 <xsl:call-template name="trim.common.uri.paths">
1205 <xsl:with-param name="uriA" select="$href.to.uri"/>
1206 <xsl:with-param name="uriB" select="$href.from.uri"/>
1207 <xsl:with-param name="return" select="'B'"/>
1208 </xsl:call-template>
1209 </xsl:variable>
1210 <xsl:variable name="depth">
1211 <xsl:call-template name="count.uri.path.depth">
1212 <xsl:with-param name="filename" select="$href.from"/>
1213 </xsl:call-template>
1214 </xsl:variable>
1215 <xsl:variable name="href">
1216 <xsl:call-template name="copy-string">
1217 <xsl:with-param name="string" select="'../'"/>
1218 <xsl:with-param name="count" select="$depth"/>
1219 </xsl:call-template>
1220 <xsl:value-of select="$href.to"/>
1221 </xsl:variable>
1222 <!--
1223 <xsl:message>
1224 <xsl:text>In </xsl:text>
1225 <xsl:value-of select="name(.)"/>
1226 <xsl:text> (</xsl:text>
1227 <xsl:value-of select="$href.from"/>
1228 <xsl:text>,</xsl:text>
1229 <xsl:value-of select="$depth"/>
1230 <xsl:text>) </xsl:text>
1231 <xsl:value-of select="name($object)"/>
1232 <xsl:text> href=</xsl:text>
1233 <xsl:value-of select="$href"/>
1234 </xsl:message>
1235 -->
1236 <xsl:value-of select="$href"/>
1237 </xsl:template>
1238
1239 <!-- Returns the complete olink href value if found -->
1240 <!-- Must take into account any dbhtml dir of the chunk containing the olink -->
1241 <xsl:template name="make.olink.href">
1242 <xsl:param name="olink.key" select="''"/>
1243 <xsl:param name="target.database"/>
1244
1245 <xsl:if test="$olink.key != ''">
1246 <xsl:variable name="target.href" >
1247 <xsl:for-each select="$target.database" >
1248 <xsl:value-of select="key('targetptr-key', $olink.key)[1]/@href" />
1249 </xsl:for-each>
1250 </xsl:variable>
1251
1252 <!-- an olink starting point may be in a subdirectory, so need
1253 the "from" reference point to compute a relative path -->
1254
1255 <xsl:variable name="from.href">
1256 <xsl:call-template name="olink.from.uri">
1257 <xsl:with-param name="target.database" select="$target.database"/>
1258 <xsl:with-param name="object" select="."/>
1259 <xsl:with-param name="object.targetdoc" select="$current.docid"/>
1260 </xsl:call-template>
1261 </xsl:variable>
1262
1263 <!-- If the from.href has directory path, then must "../" upward
1264 to document level -->
1265 <xsl:variable name="upward.from.path">
1266 <xsl:call-template name="upward.path">
1267 <xsl:with-param name="path" select="$from.href"/>
1268 </xsl:call-template>
1269 </xsl:variable>
1270
1271 <xsl:variable name="targetdoc">
1272 <xsl:value-of select="substring-before($olink.key, '/')"/>
1273 </xsl:variable>
1274
1275 <!-- Does the target database use a sitemap? -->
1276 <xsl:variable name="use.sitemap">
1277 <xsl:choose>
1278 <xsl:when test="$target.database//sitemap">1</xsl:when>
1279 <xsl:otherwise>0</xsl:otherwise>
1280 </xsl:choose>
1281 </xsl:variable>
1282
1283
1284 <!-- Get the baseuri for this targetptr -->
1285 <xsl:variable name="baseuri" >
1286 <xsl:choose>
1287 <!-- Does the database use a sitemap? -->
1288 <xsl:when test="$use.sitemap != 0" >
1289 <xsl:choose>
1290 <!-- Was current.docid parameter set? -->
1291 <xsl:when test="$current.docid != ''">
1292 <!-- Was it found in the database? -->
1293 <xsl:variable name="currentdoc.key" >
1294 <xsl:for-each select="$target.database" >
1295 <xsl:value-of select="key('targetdoc-key',
1296 $current.docid)/@targetdoc" />
1297 </xsl:for-each>
1298 </xsl:variable>
1299 <xsl:choose>
1300 <xsl:when test="$currentdoc.key != ''">
1301 <xsl:for-each select="$target.database" >
1302 <xsl:call-template name="targetpath" >
1303 <xsl:with-param name="dirnode"
1304 select="key('targetdoc-key', $current.docid)/parent::d ir"/>
1305 <xsl:with-param name="targetdoc" select="$targetdoc"/>
1306 </xsl:call-template>
1307 </xsl:for-each >
1308 </xsl:when>
1309 <xsl:otherwise>
1310 <xsl:message>
1311 <xsl:text>Olink error: cannot compute relative </xsl:text>
1312 <xsl:text>sitemap path because $current.docid '</xsl:text>
1313 <xsl:value-of select="$current.docid"/>
1314 <xsl:text>' not found in target database.</xsl:text>
1315 </xsl:message>
1316 </xsl:otherwise>
1317 </xsl:choose>
1318 </xsl:when>
1319 <xsl:otherwise>
1320 <xsl:message>
1321 <xsl:text>Olink warning: cannot compute relative </xsl:text>
1322 <xsl:text>sitemap path without $current.docid parameter</xsl:tex t>
1323 </xsl:message>
1324 </xsl:otherwise>
1325 </xsl:choose>
1326 <!-- In either case, add baseuri from its document entry-->
1327 <xsl:variable name="docbaseuri">
1328 <xsl:for-each select="$target.database" >
1329 <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri" / >
1330 </xsl:for-each>
1331 </xsl:variable>
1332 <xsl:if test="$docbaseuri != ''" >
1333 <xsl:value-of select="$docbaseuri"/>
1334 </xsl:if>
1335 </xsl:when>
1336 <!-- No database sitemap in use -->
1337 <xsl:otherwise>
1338 <!-- Just use any baseuri from its document entry -->
1339 <xsl:variable name="docbaseuri">
1340 <xsl:for-each select="$target.database" >
1341 <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri" / >
1342 </xsl:for-each>
1343 </xsl:variable>
1344 <xsl:if test="$docbaseuri != ''" >
1345 <xsl:value-of select="$docbaseuri"/>
1346 </xsl:if>
1347 </xsl:otherwise>
1348 </xsl:choose>
1349 </xsl:variable>
1350
1351 <!-- Form the href information -->
1352 <xsl:if test="not(contains($baseuri, ':'))">
1353 <!-- if not an absolute uri, add upward path from olink chunk -->
1354 <xsl:value-of select="$upward.from.path"/>
1355 </xsl:if>
1356
1357 <xsl:if test="$baseuri != ''">
1358 <xsl:value-of select="$baseuri"/>
1359 <xsl:if test="substring($target.href,1,1) != '#'">
1360 <!--xsl:text>/</xsl:text-->
1361 </xsl:if>
1362 </xsl:if>
1363 <!-- optionally turn off frag for PDF references -->
1364 <xsl:if test="not($insert.olink.pdf.frag = 0 and
1365 translate(substring($baseuri, string-length($baseuri) - 3),
1366 'PDF', 'pdf') = '.pdf'
1367 and starts-with($target.href, '#') )">
1368 <xsl:value-of select="$target.href"/>
1369 </xsl:if>
1370 </xsl:if>
1371 </xsl:template>
1372
1373 <!-- Computes "../" to reach top -->
1374 <xsl:template name="upward.path">
1375 <xsl:param name="path" select="''"/>
1376 <xsl:choose>
1377 <!-- Don't bother with absolute uris -->
1378 <xsl:when test="contains($path, ':')"/>
1379 <xsl:when test="starts-with($path, '/')"/>
1380 <xsl:when test="contains($path, '/')">
1381 <xsl:text>../</xsl:text>
1382 <xsl:call-template name="upward.path">
1383 <xsl:with-param name="path" select="substring-after($path, '/')"/>
1384 </xsl:call-template>
1385 </xsl:when>
1386 </xsl:choose>
1387
1388 </xsl:template>
1389
1390 <!-- ==================================================================== -->
1391
1392 <xsl:template name="html.head">
1393 <xsl:param name="prev" select="/foo"/>
1394 <xsl:param name="next" select="/foo"/>
1395 <xsl:variable name="this" select="."/>
1396 <xsl:variable name="home" select="/*[1]"/>
1397 <xsl:variable name="up" select="parent::*"/>
1398
1399 <head>
1400 <xsl:call-template name="system.head.content"/>
1401 <xsl:call-template name="head.content"/>
1402
1403 <!-- home link not valid in HTML5 -->
1404 <xsl:if test="$home and $div.element != 'section'">
1405 <link rel="home">
1406 <xsl:attribute name="href">
1407 <xsl:call-template name="href.target">
1408 <xsl:with-param name="object" select="$home"/>
1409 </xsl:call-template>
1410 </xsl:attribute>
1411 <xsl:attribute name="title">
1412 <xsl:apply-templates select="$home"
1413 mode="object.title.markup.textonly"/>
1414 </xsl:attribute>
1415 </link>
1416 </xsl:if>
1417
1418 <!-- up link not valid in HTML5 -->
1419 <xsl:if test="$up and $div.element != 'section'">
1420 <link rel="up">
1421 <xsl:attribute name="href">
1422 <xsl:call-template name="href.target">
1423 <xsl:with-param name="object" select="$up"/>
1424 </xsl:call-template>
1425 </xsl:attribute>
1426 <xsl:attribute name="title">
1427 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/ >
1428 </xsl:attribute>
1429 </link>
1430 </xsl:if>
1431
1432 <xsl:if test="$prev">
1433 <link rel="prev">
1434 <xsl:attribute name="href">
1435 <xsl:call-template name="href.target">
1436 <xsl:with-param name="object" select="$prev"/>
1437 </xsl:call-template>
1438 </xsl:attribute>
1439 <xsl:attribute name="title">
1440 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly "/>
1441 </xsl:attribute>
1442 </link>
1443 </xsl:if>
1444
1445 <xsl:if test="$next">
1446 <link rel="next">
1447 <xsl:attribute name="href">
1448 <xsl:call-template name="href.target">
1449 <xsl:with-param name="object" select="$next"/>
1450 </xsl:call-template>
1451 </xsl:attribute>
1452 <xsl:attribute name="title">
1453 <xsl:apply-templates select="$next" mode="object.title.markup.textonly "/>
1454 </xsl:attribute>
1455 </link>
1456 </xsl:if>
1457
1458 <xsl:if test="$html.extra.head.links != 0">
1459 <xsl:for-each select="//part
1460 |//reference
1461 |//preface
1462 |//chapter
1463 |//article
1464 |//refentry
1465 |//appendix[not(parent::article)]|appendix
1466 |//glossary[not(parent::article)]|glossary
1467 |//index[not(parent::article)]|index">
1468 <link rel="{local-name(.)}">
1469 <xsl:attribute name="href">
1470 <xsl:call-template name="href.target">
1471 <xsl:with-param name="context" select="$this"/>
1472 <xsl:with-param name="object" select="."/>
1473 </xsl:call-template>
1474 </xsl:attribute>
1475 <xsl:attribute name="title">
1476 <xsl:apply-templates select="." mode="object.title.markup.textonly"/ >
1477 </xsl:attribute>
1478 </link>
1479 </xsl:for-each>
1480
1481 <xsl:for-each select="section|sect1|refsection|refsect1">
1482 <link>
1483 <xsl:attribute name="rel">
1484 <xsl:choose>
1485 <xsl:when test="local-name($this) = 'section'
1486 or local-name($this) = 'refsection'">
1487 <xsl:value-of select="'subsection'"/>
1488 </xsl:when>
1489 <xsl:otherwise>
1490 <xsl:value-of select="'section'"/>
1491 </xsl:otherwise>
1492 </xsl:choose>
1493 </xsl:attribute>
1494 <xsl:attribute name="href">
1495 <xsl:call-template name="href.target">
1496 <xsl:with-param name="context" select="$this"/>
1497 <xsl:with-param name="object" select="."/>
1498 </xsl:call-template>
1499 </xsl:attribute>
1500 <xsl:attribute name="title">
1501 <xsl:apply-templates select="." mode="object.title.markup.textonly"/ >
1502 </xsl:attribute>
1503 </link>
1504 </xsl:for-each>
1505
1506 <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
1507 <link rel="subsection">
1508 <xsl:attribute name="href">
1509 <xsl:call-template name="href.target">
1510 <xsl:with-param name="context" select="$this"/>
1511 <xsl:with-param name="object" select="."/>
1512 </xsl:call-template>
1513 </xsl:attribute>
1514 <xsl:attribute name="title">
1515 <xsl:apply-templates select="." mode="object.title.markup.textonly"/ >
1516 </xsl:attribute>
1517 </link>
1518 </xsl:for-each>
1519 </xsl:if>
1520
1521 <!-- * if we have a legalnotice and user wants it output as a -->
1522 <!-- * separate page and $html.head.legalnotice.link.types is -->
1523 <!-- * non-empty, we generate a link or links for each value in -->
1524 <!-- * $html.head.legalnotice.link.types -->
1525 <xsl:if test="//legalnotice
1526 and not($generate.legalnotice.link = 0)
1527 and not($html.head.legalnotice.link.types = '')">
1528 <xsl:call-template name="make.legalnotice.head.links"/>
1529 </xsl:if>
1530
1531 <xsl:call-template name="user.head.content"/>
1532 </head>
1533 </xsl:template>
1534
1535 <!-- ==================================================================== -->
1536
1537 <xsl:template name="header.navigation">
1538 <xsl:param name="prev" select="/foo"/>
1539 <xsl:param name="next" select="/foo"/>
1540 <xsl:param name="nav.context"/>
1541
1542 <xsl:variable name="home" select="/*[1]"/>
1543 <xsl:variable name="up" select="parent::*"/>
1544
1545 <xsl:variable name="row1" select="$navig.showtitles != 0"/>
1546 <xsl:variable name="row2" select="count($prev) &gt; 0
1547 or (count($up) &gt; 0
1548 and generate-id($up) != generate-id($hom e)
1549 and $navig.showtitles != 0)
1550 or count($next) &gt; 0"/>
1551
1552 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0' ">
1553 <div class="navheader">
1554 <xsl:if test="$row1 or $row2">
1555 <table width="100%" summary="Navigation header">
1556 <xsl:if test="$row1">
1557 <tr>
1558 <th colspan="3" align="center">
1559 <xsl:apply-templates select="." mode="object.title.markup"/>
1560 </th>
1561 </tr>
1562 </xsl:if>
1563
1564 <xsl:if test="$row2">
1565 <tr>
1566 <td width="20%" align="{$direction.align.start}">
1567 <xsl:if test="count($prev)>0">
1568 <a accesskey="p">
1569 <xsl:attribute name="href">
1570 <xsl:call-template name="href.target">
1571 <xsl:with-param name="object" select="$prev"/>
1572 </xsl:call-template>
1573 </xsl:attribute>
1574 <xsl:call-template name="navig.content">
1575 <xsl:with-param name="direction" select="'prev'"/>
1576 </xsl:call-template>
1577 </a>
1578 </xsl:if>
1579 <xsl:text>&#160;</xsl:text>
1580 </td>
1581 <th width="60%" align="center">
1582 <xsl:choose>
1583 <xsl:when test="count($up) > 0
1584 and generate-id($up) != generate-id($home)
1585 and $navig.showtitles != 0">
1586 <xsl:apply-templates select="$up" mode="object.title.markup" />
1587 </xsl:when>
1588 <xsl:otherwise>&#160;</xsl:otherwise>
1589 </xsl:choose>
1590 </th>
1591 <td width="20%" align="{$direction.align.end}">
1592 <xsl:text>&#160;</xsl:text>
1593 <xsl:if test="count($next)>0">
1594 <a accesskey="n">
1595 <xsl:attribute name="href">
1596 <xsl:call-template name="href.target">
1597 <xsl:with-param name="object" select="$next"/>
1598 </xsl:call-template>
1599 </xsl:attribute>
1600 <xsl:call-template name="navig.content">
1601 <xsl:with-param name="direction" select="'next'"/>
1602 </xsl:call-template>
1603 </a>
1604 </xsl:if>
1605 </td>
1606 </tr>
1607 </xsl:if>
1608 </table>
1609 </xsl:if>
1610 <xsl:if test="$header.rule != 0">
1611 <hr/>
1612 </xsl:if>
1613 </div>
1614 </xsl:if>
1615 </xsl:template>
1616
1617 <!-- ==================================================================== -->
1618
1619 <xsl:template name="footer.navigation">
1620 <xsl:param name="prev" select="/foo"/>
1621 <xsl:param name="next" select="/foo"/>
1622 <xsl:param name="nav.context"/>
1623
1624 <xsl:variable name="home" select="/*[1]"/>
1625 <xsl:variable name="up" select="parent::*"/>
1626
1627 <xsl:variable name="row1" select="count($prev) &gt; 0
1628 or count($up) &gt; 0
1629 or count($next) &gt; 0"/>
1630
1631 <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
1632 or (generate-id($home) != generate-id(.)
1633 or $nav.context = 'toc')
1634 or ($chunk.tocs.and.lots != 0
1635 and $nav.context != 'toc')
1636 or ($next and $navig.showtitles != 0)"/>
1637
1638 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0' ">
1639 <div class="navfooter">
1640 <xsl:if test="$footer.rule != 0">
1641 <hr/>
1642 </xsl:if>
1643
1644 <xsl:if test="$row1 or $row2">
1645 <table width="100%" summary="Navigation footer">
1646 <xsl:if test="$row1">
1647 <tr>
1648 <td width="40%" align="{$direction.align.start}">
1649 <xsl:if test="count($prev)>0">
1650 <a accesskey="p">
1651 <xsl:attribute name="href">
1652 <xsl:call-template name="href.target">
1653 <xsl:with-param name="object" select="$prev"/>
1654 </xsl:call-template>
1655 </xsl:attribute>
1656 <xsl:call-template name="navig.content">
1657 <xsl:with-param name="direction" select="'prev'"/>
1658 </xsl:call-template>
1659 </a>
1660 </xsl:if>
1661 <xsl:text>&#160;</xsl:text>
1662 </td>
1663 <td width="20%" align="center">
1664 <xsl:choose>
1665 <xsl:when test="count($up)&gt;0
1666 and generate-id($up) != generate-id($home)">
1667 <a accesskey="u">
1668 <xsl:attribute name="href">
1669 <xsl:call-template name="href.target">
1670 <xsl:with-param name="object" select="$up"/>
1671 </xsl:call-template>
1672 </xsl:attribute>
1673 <xsl:call-template name="navig.content">
1674 <xsl:with-param name="direction" select="'up'"/>
1675 </xsl:call-template>
1676 </a>
1677 </xsl:when>
1678 <xsl:otherwise>&#160;</xsl:otherwise>
1679 </xsl:choose>
1680 </td>
1681 <td width="40%" align="{$direction.align.end}">
1682 <xsl:text>&#160;</xsl:text>
1683 <xsl:if test="count($next)>0">
1684 <a accesskey="n">
1685 <xsl:attribute name="href">
1686 <xsl:call-template name="href.target">
1687 <xsl:with-param name="object" select="$next"/>
1688 </xsl:call-template>
1689 </xsl:attribute>
1690 <xsl:call-template name="navig.content">
1691 <xsl:with-param name="direction" select="'next'"/>
1692 </xsl:call-template>
1693 </a>
1694 </xsl:if>
1695 </td>
1696 </tr>
1697 </xsl:if>
1698
1699 <xsl:if test="$row2">
1700 <tr>
1701 <td width="40%" align="{$direction.align.start}" valign="top">
1702 <xsl:if test="$navig.showtitles != 0">
1703 <xsl:apply-templates select="$prev" mode="object.title.markup" />
1704 </xsl:if>
1705 <xsl:text>&#160;</xsl:text>
1706 </td>
1707 <td width="20%" align="center">
1708 <xsl:choose>
1709 <xsl:when test="$home != . or $nav.context = 'toc'">
1710 <a accesskey="h">
1711 <xsl:attribute name="href">
1712 <xsl:call-template name="href.target">
1713 <xsl:with-param name="object" select="$home"/>
1714 </xsl:call-template>
1715 </xsl:attribute>
1716 <xsl:call-template name="navig.content">
1717 <xsl:with-param name="direction" select="'home'"/>
1718 </xsl:call-template>
1719 </a>
1720 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1721 <xsl:text>&#160;|&#160;</xsl:text>
1722 </xsl:if>
1723 </xsl:when>
1724 <xsl:otherwise>&#160;</xsl:otherwise>
1725 </xsl:choose>
1726
1727 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc '">
1728 <a accesskey="t">
1729 <xsl:attribute name="href">
1730 <xsl:value-of select="$chunked.filename.prefix"/>
1731 <xsl:apply-templates select="/*[1]"
1732 mode="recursive-chunk-filename">
1733 <xsl:with-param name="recursive" select="true()"/>
1734 </xsl:apply-templates>
1735 <xsl:text>-toc</xsl:text>
1736 <xsl:value-of select="$html.ext"/>
1737 </xsl:attribute>
1738 <xsl:call-template name="gentext">
1739 <xsl:with-param name="key" select="'nav-toc'"/>
1740 </xsl:call-template>
1741 </a>
1742 </xsl:if>
1743 </td>
1744 <td width="40%" align="{$direction.align.end}" valign="top">
1745 <xsl:text>&#160;</xsl:text>
1746 <xsl:if test="$navig.showtitles != 0">
1747 <xsl:apply-templates select="$next" mode="object.title.markup" />
1748 </xsl:if>
1749 </td>
1750 </tr>
1751 </xsl:if>
1752 </table>
1753 </xsl:if>
1754 </div>
1755 </xsl:if>
1756 </xsl:template>
1757
1758 <!-- ==================================================================== -->
1759
1760 <xsl:template name="navig.content">
1761 <xsl:param name="direction" select="next"/>
1762 <xsl:variable name="navtext">
1763 <xsl:choose>
1764 <xsl:when test="$direction = 'prev'">
1765 <xsl:call-template name="gentext.nav.prev"/>
1766 </xsl:when>
1767 <xsl:when test="$direction = 'next'">
1768 <xsl:call-template name="gentext.nav.next"/>
1769 </xsl:when>
1770 <xsl:when test="$direction = 'up'">
1771 <xsl:call-template name="gentext.nav.up"/>
1772 </xsl:when>
1773 <xsl:when test="$direction = 'home'">
1774 <xsl:call-template name="gentext.nav.home"/>
1775 </xsl:when>
1776 <xsl:otherwise>
1777 <xsl:text>xxx</xsl:text>
1778 </xsl:otherwise>
1779 </xsl:choose>
1780 </xsl:variable>
1781
1782 <xsl:choose>
1783 <xsl:when test="$navig.graphics != 0">
1784 <img>
1785 <xsl:attribute name="src">
1786 <xsl:value-of select="$navig.graphics.path"/>
1787 <xsl:value-of select="$direction"/>
1788 <xsl:value-of select="$navig.graphics.extension"/>
1789 </xsl:attribute>
1790 <xsl:attribute name="alt">
1791 <xsl:value-of select="$navtext"/>
1792 </xsl:attribute>
1793 </img>
1794 </xsl:when>
1795 <xsl:otherwise>
1796 <xsl:value-of select="$navtext"/>
1797 </xsl:otherwise>
1798 </xsl:choose>
1799 </xsl:template>
1800
1801 <!-- ==================================================================== -->
1802
1803 <!-- * The following template assumes that the first legalnotice -->
1804 <!-- * instance found in a document applies to the contents of the -->
1805 <!-- * entire document. It generates an HTML link in each chunk, back -->
1806 <!-- * to the file containing the contents of the first legalnotice. -->
1807 <!-- * -->
1808 <!-- * Actually, it may generate multiple link instances in each chunk, -->
1809 <!-- * because it walks through the space-separated list of link -->
1810 <!-- * types specified in the $html.head.legalnotice.link.types param, -->
1811 <!-- * popping off link types and generating links for them until it -->
1812 <!-- * depletes the list. -->
1813
1814 <xsl:template name="make.legalnotice.head.links">
1815 <!-- * the following ID is used as part of the legalnotice filename; -->
1816 <!-- * we need it in order to construct the filename for use in the -->
1817 <!-- * value of the href attribute on the link -->
1818
1819 <xsl:param name="ln-node" select="(//legalnotice)[1]"/>
1820
1821 <xsl:param name="linktype">
1822 <xsl:choose>
1823 <xsl:when test="contains($html.head.legalnotice.link.types, ' ')">
1824 <xsl:value-of
1825 select="normalize-space(
1826 substring-before($html.head.legalnotice.link.types, ' '))"/>
1827 </xsl:when>
1828 <xsl:otherwise>
1829 <xsl:value-of select="$html.head.legalnotice.link.types"/>
1830 </xsl:otherwise>
1831 </xsl:choose>
1832 </xsl:param>
1833 <xsl:param
1834 name="remaining.linktypes"
1835 select="concat(
1836 normalize-space(
1837 substring-after($html.head.legalnotice.link.types, ' ')),' ')"/>
1838 <xsl:if test="not($linktype = '')">
1839
1840 <!-- Compute name of legalnotice file (see titlepage.xsl) -->
1841 <xsl:variable name="file">
1842 <xsl:call-template name="ln.or.rh.filename">
1843 <xsl:with-param name="node" select="$ln-node"/>
1844 </xsl:call-template>
1845 </xsl:variable>
1846
1847 <link rel="{$linktype}">
1848 <xsl:attribute name="href">
1849 <xsl:value-of select="$file"/>
1850 </xsl:attribute>
1851 <xsl:attribute name="title">
1852 <xsl:apply-templates select="(//legalnotice)[1]"
1853 mode="object.title.markup.textonly"/>
1854 </xsl:attribute>
1855 </link>
1856 <xsl:call-template name="make.legalnotice.head.links">
1857 <!-- * pop the next value off the list of link types -->
1858 <xsl:with-param
1859 name="linktype"
1860 select="substring-before($remaining.linktypes, ' ')"/>
1861 <!-- * remove the link type from the list of remaining link types -->
1862 <xsl:with-param
1863 name="remaining.linktypes"
1864 select="substring-after($remaining.linktypes, ' ')"/>
1865 </xsl:call-template>
1866 </xsl:if>
1867 </xsl:template>
1868
1869 <!-- ==================================================================== -->
1870 <xsl:template name="chunk-element-content">
1871 <xsl:param name="prev"/>
1872 <xsl:param name="next"/>
1873 <xsl:param name="nav.context"/>
1874 <xsl:param name="content">
1875 <xsl:apply-imports/>
1876 </xsl:param>
1877
1878 <xsl:call-template name="user.preroot"/>
1879
1880 <html>
1881 <xsl:call-template name="root.attributes"/>
1882 <xsl:call-template name="html.head">
1883 <xsl:with-param name="prev" select="$prev"/>
1884 <xsl:with-param name="next" select="$next"/>
1885 </xsl:call-template>
1886
1887 <body>
1888 <xsl:call-template name="body.attributes"/>
1889
1890 <xsl:call-template name="user.header.navigation">
1891 <xsl:with-param name="prev" select="$prev"/>
1892 <xsl:with-param name="next" select="$next"/>
1893 <xsl:with-param name="nav.context" select="$nav.context"/>
1894 </xsl:call-template>
1895
1896 <xsl:call-template name="header.navigation">
1897 <xsl:with-param name="prev" select="$prev"/>
1898 <xsl:with-param name="next" select="$next"/>
1899 <xsl:with-param name="nav.context" select="$nav.context"/>
1900 </xsl:call-template>
1901
1902 <xsl:call-template name="user.header.content"/>
1903
1904 <xsl:copy-of select="$content"/>
1905
1906 <xsl:call-template name="user.footer.content"/>
1907
1908 <xsl:call-template name="footer.navigation">
1909 <xsl:with-param name="prev" select="$prev"/>
1910 <xsl:with-param name="next" select="$next"/>
1911 <xsl:with-param name="nav.context" select="$nav.context"/>
1912 </xsl:call-template>
1913
1914 <xsl:call-template name="user.footer.navigation">
1915 <xsl:with-param name="prev" select="$prev"/>
1916 <xsl:with-param name="next" select="$next"/>
1917 <xsl:with-param name="nav.context" select="$nav.context"/>
1918 </xsl:call-template>
1919 </body>
1920 </html>
1921 <xsl:value-of select="$chunk.append"/>
1922 </xsl:template>
1923
1924 <!-- ==================================================================== -->
1925 <xsl:template name="generate.manifest">
1926 <xsl:param name="node" select="/"/>
1927 <xsl:call-template name="write.text.chunk">
1928 <xsl:with-param name="filename">
1929 <xsl:if test="$manifest.in.base.dir != 0">
1930 <xsl:value-of select="$chunk.base.dir"/>
1931 </xsl:if>
1932 <xsl:value-of select="$manifest"/>
1933 </xsl:with-param>
1934 <xsl:with-param name="method" select="'text'"/>
1935 <xsl:with-param name="content">
1936 <xsl:apply-templates select="$node" mode="enumerate-files"/>
1937 </xsl:with-param>
1938 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
1939 </xsl:call-template>
1940 </xsl:template>
1941
1942 <!-- ==================================================================== -->
1943
1944 <xsl:template name="dbhtml-dir">
1945 <xsl:param name="context" select="."/>
1946 <!-- directories are now inherited from previous levels -->
1947 <xsl:variable name="ppath">
1948 <xsl:if test="$context/parent::*">
1949 <xsl:call-template name="dbhtml-dir">
1950 <xsl:with-param name="context" select="$context/parent::*"/>
1951 </xsl:call-template>
1952 </xsl:if>
1953 </xsl:variable>
1954 <xsl:variable name="path">
1955 <xsl:call-template name="pi.dbhtml_dir">
1956 <xsl:with-param name="node" select="$context"/>
1957 </xsl:call-template>
1958 </xsl:variable>
1959 <xsl:choose>
1960 <xsl:when test="$path = ''">
1961 <xsl:if test="$ppath != ''">
1962 <xsl:value-of select="$ppath"/>
1963 </xsl:if>
1964 </xsl:when>
1965 <xsl:otherwise>
1966 <xsl:if test="$ppath != ''">
1967 <xsl:value-of select="$ppath"/>
1968 <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
1969 <xsl:text>/</xsl:text>
1970 </xsl:if>
1971 </xsl:if>
1972 <xsl:value-of select="$path"/>
1973 <xsl:text>/</xsl:text>
1974 </xsl:otherwise>
1975 </xsl:choose>
1976 </xsl:template>
1977
1978 </xsl:stylesheet>
OLDNEW
« no previous file with comments | « third_party/docbook-xsl-1.78.0/html/chunk-code.xsl ('k') | third_party/docbook-xsl-1.78.0/html/chunker.xsl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698