Debian Codegraph @

docs/xsl-generic/html/chunk-common.xsl

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