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