Debian Codegraph @

ru/stylesheets/chunk.xsl

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:saxon="http://icl.com/saxon"
4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
5 version="1.0"
6 exclude-result-prefixes="doc"
7 extension-element-prefixes="saxon">
8
9 <!-- THIS STYLESHEET IS FOR SAXON -->
10
11 <!-- Because I want to change the chunking rules, I need to copy the
12 while stylesheet. The import/apply-imports trick won't work because
13 the imported chunking code would chunk at the places where I want
14 to avoid chunking. -->
15
16 <xsl:import href="tdg.xsl"/>
17
18 <xsl:output method="html"
19 encoding="ISO-8859-1"
20 indent="no"/>
21
22 <xsl:param name="html.ext" select="'.html'"/>
23 <xsl:param name="root.filename" select="'docbook'"/>
24 <xsl:param name="base.dir" select="''"/>
25
26 <!-- ==================================================================== -->
27
28 <xsl:template match="bookinfo/copyright" mode="titlepage.mode">
29 <p class="copyright">
30 <a href="{concat('dbcpyright',$html.ext)}">Copyright</a>
31 <xsl:text> &#xA9; </xsl:text>
32 <xsl:for-each select="year">
33 <xsl:if test="position() &gt; 1">, </xsl:if>
34 <xsl:apply-templates select="." mode="titlepage.mode"/>
35 </xsl:for-each>
36 <xsl:text> </xsl:text>
37 <xsl:apply-templates select="holder" mode="titlepage.mode"/>
38 </p>
39 <br clear="all"/>
40 <xsl:call-template name="write.chunk">
41 <xsl:with-param name="filename">
42 <xsl:call-template name="make-relative-filename">
43 <xsl:with-param name="base.dir" select="$base.dir"/>
44 <xsl:with-param name="base.name" select="concat('dbcpyright',$html.ext)"/>
45 </xsl:call-template>
46 </xsl:with-param>
47 <xsl:with-param name="content">
48 <xsl:apply-templates select="/book" mode="dbcpyright-mode"/>
49 </xsl:with-param>
50 </xsl:call-template>
51 </xsl:template>
52
53 <xsl:template match="book" mode="dbcpyright-mode">
54 <html>
55 <xsl:call-template name="html.head"/>
56 <body>
57 <xsl:apply-templates select="bookinfo/legalnotice"
58 mode="titlepage.mode"/>
59 </body>
60 </html>
61 </xsl:template>
62
63 <!-- ==================================================================== -->
64 <!-- What's a chunk?
65
66 appendix
67 article
68 bibliography in article or book
69 book
70 chapter
71 colophon
72 glossary in article or book
73 index in article or book
74 part
75 preface
76 refentry
77 reference
78 set
79 setindex
80 -->
81 <!-- ==================================================================== -->
82
83 <xsl:template name="chunk">
84 <xsl:param name="node" select="."/>
85 <!-- returns 1 if $node is a chunk -->
86
87 <xsl:choose>
88 <xsl:when test="name($node)='preface'">1</xsl:when>
89 <xsl:when test="name($node)='chapter'">1</xsl:when>
90 <xsl:when test="name($node)='appendix'">1</xsl:when>
91 <xsl:when test="name($node)='article'">1</xsl:when>
92 <xsl:when test="name($node)='part'">1</xsl:when>
93 <xsl:when test="name($node)='reference'">1</xsl:when>
94 <xsl:when test="name($node)='refentry'">1</xsl:when>
95 <xsl:when test="name($node)='index'">1</xsl:when>
96 <xsl:when test="name($node)='bibliography'">1</xsl:when>
97 <xsl:when test="name($node)='glossary'">1</xsl:when>
98 <xsl:when test="name($node)='colophon'">1</xsl:when>
99 <xsl:when test="name($node)='book'">1</xsl:when>
100 <xsl:when test="name($node)='set'">1</xsl:when>
101 <xsl:when test="name($node)='setindex'">1</xsl:when>
102 <xsl:otherwise>0</xsl:otherwise>
103 </xsl:choose>
104 </xsl:template>
105
106 <!-- ==================================================================== -->
107
108 <xsl:template match="*" mode="chunk-filename">
109 <xsl:param name="recursive" select="false()"/>
110
111 <!-- returns the filename of a chunk -->
112 <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
113 <xsl:variable name="filename">
•114 <xsl:call-template name="pi.dbhtml_filename"/>
115 </xsl:variable>
116 <xsl:variable name="dir">
•117 <xsl:call-template name="pi.dbhtml_dir"/>
118 </xsl:variable>
119
120 <xsl:choose>
121 <xsl:when test="$ischunk='0'">
122 <!-- if called on something that isn't a chunk, walk up... -->
123 <xsl:choose>
124 <xsl:when test="count(parent::*)>0">
125 <xsl:apply-templates mode="chunk-filename" select="parent::*">
126 <xsl:with-param name="recursive" select="$recursive"/>
127 </xsl:apply-templates>
128 </xsl:when>
129 <!-- unless there is no up, in which case return "" -->
130 <xsl:otherwise></xsl:otherwise>
131 </xsl:choose>
132 </xsl:when>
133
134 <xsl:when test="not($recursive) and $filename != ''">
135 <!-- if this chunk has an explicit name, use it -->
136 <xsl:if test="$dir != ''">
137 <xsl:value-of select="$dir"/>
138 <xsl:text>/</xsl:text>
139 </xsl:if>
140
141 <xsl:choose>
142 <!-- hack hack hack -->
143 <xsl:when test="$html.ext != '.html'">
144 <xsl:value-of select="substring-before($filename, '.html')"/>
145 <xsl:value-of select="$html.ext"/>
146 </xsl:when>
147 <xsl:otherwise>
148 <xsl:value-of select="$filename"/>
149 </xsl:otherwise>
150 </xsl:choose>
151 </xsl:when>
152
153 <xsl:when test="local-name(.)='set'">
154 <xsl:value-of select="$root.filename"/>
155 <xsl:if test="not($recursive)">
156 <xsl:value-of select="$html.ext"/>
157 </xsl:if>
158 </xsl:when>
159
160 <xsl:when test="local-name(.)='book'">
161 <xsl:choose>
162 <xsl:when test="count(parent::*)>0">
163 <xsl:text>bk</xsl:text>
164 <xsl:number level="any" format="01"/>
165 </xsl:when>
166 <xsl:otherwise>
167 <xsl:value-of select="$root.filename"/>
168 </xsl:otherwise>
169 </xsl:choose>
170 <xsl:if test="not($recursive)">
171 <xsl:value-of select="$html.ext"/>
172 </xsl:if>
173 </xsl:when>
174
175 <xsl:when test="local-name(.)='article'">
176 <xsl:choose>
177 <xsl:when test="/set">
178 <!-- in a set, make sure we inherit the right book info... -->
179 <xsl:apply-templates mode="chunk-filename" select="parent::*">
180 <xsl:with-param name="recursive" select="true()"/>
181 </xsl:apply-templates>
182 </xsl:when>
183 <xsl:when test="count(parent::*)>0">
184 <!-- if we aren't the root, name them numerically ... -->
185 <xsl:text>ar</xsl:text>
186 <xsl:number level="any" format="01" from="book"/>
187 </xsl:when>
188 <xsl:otherwise>
189 <xsl:value-of select="$root.filename"/>
190 </xsl:otherwise>
191 </xsl:choose>
192 <xsl:if test="not($recursive)">
193 <xsl:value-of select="$html.ext"/>
194 </xsl:if>
195 </xsl:when>
196
197 <xsl:when test="local-name(.)='preface'">
198 <xsl:if test="/set">
199 <xsl:apply-templates mode="chunk-filename" select="parent::*">
200 <xsl:with-param name="recursive" select="true()"/>
201 </xsl:apply-templates>
202 </xsl:if>
203 <xsl:text>pr</xsl:text>
204 <xsl:number level="any" format="01" from="book"/>
205 <xsl:if test="not($recursive)">
206 <xsl:value-of select="$html.ext"/>
207 </xsl:if>
208 </xsl:when>
209
210 <xsl:when test="local-name(.)='chapter'">
211 <xsl:if test="/set">
212 <xsl:apply-templates mode="chunk-filename" select="parent::*">
213 <xsl:with-param name="recursive" select="true()"/>
214 </xsl:apply-templates>
215 </xsl:if>
216 <xsl:text>ch</xsl:text>
217 <xsl:number level="any" format="01" from="book"/>
218 <xsl:if test="not($recursive)">
219 <xsl:value-of select="$html.ext"/>
220 </xsl:if>
221 </xsl:when>
222
223 <xsl:when test="local-name(.)='appendix'">
224 <xsl:if test="/set">
225 <xsl:apply-templates mode="chunk-filename" select="parent::*">
226 <xsl:with-param name="recursive" select="true()"/>
227 </xsl:apply-templates>
228 </xsl:if>
229 <xsl:text>ap</xsl:text>
230 <xsl:number level="any" format="a" from="book"/>
231 <xsl:if test="not($recursive)">
232 <xsl:value-of select="$html.ext"/>
233 </xsl:if>
234 </xsl:when>
235
236 <xsl:when test="local-name(.)='part'">
237 <xsl:if test="/set">
238 <xsl:apply-templates mode="chunk-filename" select="parent::*">
239 <xsl:with-param name="recursive" select="true()"/>
240 </xsl:apply-templates>
241 </xsl:if>
242 <xsl:text>pt</xsl:text>
243 <xsl:number level="any" format="01" from="book"/>
244 <xsl:if test="not($recursive)">
245 <xsl:value-of select="$html.ext"/>
246 </xsl:if>
247 </xsl:when>
248
249 <xsl:when test="local-name(.)='reference'">
250 <xsl:if test="/set">
251 <xsl:apply-templates mode="chunk-filename" select="parent::*">
252 <xsl:with-param name="recursive" select="true()"/>
253 </xsl:apply-templates>
254 </xsl:if>
255 <xsl:text>rn</xsl:text>
256 <xsl:number level="any" format="01" from="book"/>
257 <xsl:if test="not($recursive)">
258 <xsl:value-of select="$html.ext"/>
259 </xsl:if>
260 </xsl:when>
261
262 <xsl:when test="local-name(.)='refentry'">
263 <xsl:if test="parent::reference">
264 <xsl:apply-templates mode="chunk-filename" select="parent::*">
265 <xsl:with-param name="recursive" select="true()"/>
266 </xsl:apply-templates>
267 </xsl:if>
268 <xsl:text>re</xsl:text>
269 <xsl:number level="any" format="01" from="book"/>
270 <xsl:if test="not($recursive)">
271 <xsl:value-of select="$html.ext"/>
272 </xsl:if>
273 </xsl:when>
274
275 <xsl:when test="local-name(.)='colophon'">
276 <xsl:if test="/set">
277 <xsl:apply-templates mode="chunk-filename" select="parent::*">
278 <xsl:with-param name="recursive" select="true()"/>
279 </xsl:apply-templates>
280 </xsl:if>
281 <xsl:text>co</xsl:text>
282 <xsl:number level="any" format="01" from="book"/>
283 <xsl:if test="not($recursive)">
284 <xsl:value-of select="$html.ext"/>
285 </xsl:if>
286 </xsl:when>
287
288 <xsl:when test="local-name(.)='bibliography'">
289 <xsl:if test="/set">
290 <xsl:apply-templates mode="chunk-filename" select="parent::*">
291 <xsl:with-param name="recursive" select="true()"/>
292 </xsl:apply-templates>
293 </xsl:if>
294 <xsl:text>bi</xsl:text>
295 <xsl:number level="any" format="01" from="book"/>
296 <xsl:if test="not($recursive)">
297 <xsl:value-of select="$html.ext"/>
298 </xsl:if>
299 </xsl:when>
300
301 <xsl:when test="local-name(.)='glossary'">
302 <xsl:if test="/set">
303 <xsl:apply-templates mode="chunk-filename" select="parent::*">
304 <xsl:with-param name="recursive" select="true()"/>
305 </xsl:apply-templates>
306 </xsl:if>
307 <xsl:text>go</xsl:text>
308 <xsl:number level="any" format="01" from="book"/>
309 <xsl:if test="not($recursive)">
310 <xsl:value-of select="$html.ext"/>
311 </xsl:if>
312 </xsl:when>
313
314 <xsl:when test="local-name(.)='index'">
315 <xsl:if test="/set">
316 <xsl:apply-templates mode="chunk-filename" select="parent::*">
317 <xsl:with-param name="recursive" select="true()"/>
318 </xsl:apply-templates>
319 </xsl:if>
320 <xsl:text>ix</xsl:text>
321 <xsl:number level="any" format="01" from="book"/>
322 <xsl:if test="not($recursive)">
323 <xsl:value-of select="$html.ext"/>
324 </xsl:if>
325 </xsl:when>
326
327 <xsl:when test="local-name(.)='setindex'">
328 <xsl:text>si</xsl:text>
329 <xsl:number level="any" format="01" from="set"/>
330 <xsl:if test="not($recursive)">
331 <xsl:value-of select="$html.ext"/>
332 </xsl:if>
333 </xsl:when>
334
335 <xsl:otherwise>
336 <xsl:text>chunk-filename-error-</xsl:text>
337 <xsl:value-of select="local-name(.)"/>
338 <xsl:number level="any" format="01" from="set"/>
339 <xsl:if test="not($recursive)">
340 <xsl:value-of select="$html.ext"/>
341 </xsl:if>
342 </xsl:otherwise>
343 </xsl:choose>
344 </xsl:template>
345
346 <!-- ==================================================================== -->
347
348 <xsl:template name="href.target">
349 <xsl:param name="object" select="."/>
350 <xsl:variable name="ischunk">
351 <xsl:call-template name="chunk">
352 <xsl:with-param name="node" select="$object"/>
353 </xsl:call-template>
354 </xsl:variable>
355
356 <xsl:apply-templates mode="chunk-filename" select="$object"/>
357
358 <xsl:if test="$ischunk='0'">
359 <xsl:text>#</xsl:text>
360 <xsl:call-template name="object.id">
361 <xsl:with-param name="object" select="$object"/>
362 </xsl:call-template>
363 </xsl:if>
364 </xsl:template>
365
366 <!-- ==================================================================== -->
367
368 <xsl:template name="html.head">
369 <xsl:param name="prev" select="/foo"/>
370 <xsl:param name="next" select="/foo"/>
371 <xsl:variable name="home" select="/*[1]"/>
372 <xsl:variable name="up" select="parent::*"/>
373
374 <head>
375 <xsl:call-template name="head.content"/>
376 <xsl:call-template name="user.head.content"/>
377
378 <xsl:if test="$home">
379 <link rel="home">
380 <xsl:attribute name="href">
381 <xsl:call-template name="href.target">
382 <xsl:with-param name="object" select="$home"/>
383 </xsl:call-template>
384 </xsl:attribute>
385 <xsl:attribute name="title">
386 <xsl:apply-templates select="$home" mode="object.title.markup.textonly">
387 <xsl:with-param name="text-only" select="'1'"/>
388 </xsl:apply-templates>
389 </xsl:attribute>
390 </link>
391 </xsl:if>
392
393 <xsl:if test="$up">
394 <link rel="up">
395 <xsl:attribute name="href">
396 <xsl:call-template name="href.target">
397 <xsl:with-param name="object" select="$up"/>
398 </xsl:call-template>
399 </xsl:attribute>
400 <xsl:attribute name="title">
401 <xsl:apply-templates select="$up" mode="object.title.markup.textonly">
402 <xsl:with-param name="text-only" select="'1'"/>
403 </xsl:apply-templates>
404 </xsl:attribute>
405 </link>
406 </xsl:if>
407
408 <xsl:if test="$prev">
409 <link rel="previous">
410 <xsl:attribute name="href">
411 <xsl:call-template name="href.target">
412 <xsl:with-param name="object" select="$prev"/>
413 </xsl:call-template>
414 </xsl:attribute>
415 <xsl:attribute name="title">
416 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly">
417 <xsl:with-param name="text-only" select="'1'"/>
418 </xsl:apply-templates>
419 </xsl:attribute>
420 </link>
421 </xsl:if>
422
423 <xsl:if test="$next">
424 <link rel="next">
425 <xsl:attribute name="href">
426 <xsl:call-template name="href.target">
427 <xsl:with-param name="object" select="$next"/>
428 </xsl:call-template>
429 </xsl:attribute>
430 <xsl:attribute name="title">
431 <xsl:apply-templates select="$next" mode="object.title.markup.textonly">
432 <xsl:with-param name="text-only" select="'1'"/>
433 </xsl:apply-templates>
434 </xsl:attribute>
435 </link>
436 </xsl:if>
437 </head>
438 </xsl:template>
439
440 <!-- ==================================================================== -->
441
442 <xsl:template name="header.navigation">
443 <xsl:param name="prev" select="/foo"/>
444 <xsl:param name="next" select="/foo"/>
445 <xsl:variable name="home" select="/*[1]"/>
446 <xsl:variable name="up" select="parent::*"/>
447
448 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
449 <div class="navheader">
450 <table border="0" cellpadding="0" cellspacing="0" width="100%"
451 summary="Navigation table">
452 <tr>
453 <td align="left">
454 <xsl:text>&#160;</xsl:text>
455 <a>
456 <xsl:attribute name="title">
457 <xsl:apply-templates select="$home" mode="object.title.markup.textonly"/>
458 </xsl:attribute>
459 <xsl:attribute name="href">
460 <xsl:call-template name="href.target">
461 <xsl:with-param name="object" select="$home"/>
462 </xsl:call-template>
463 </xsl:attribute>
464
465 <img src="figures/nav-home.png" alt="Home" border="0"/>
466 </a>
467 <xsl:text>&#160;</xsl:text>
468
469 <xsl:choose>
470 <xsl:when test="count($prev)>0">
471 <a>
472 <xsl:attribute name="title">
473 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
474 </xsl:attribute>
475 <xsl:attribute name="href">
476 <xsl:call-template name="href.target">
477 <xsl:with-param name="object" select="$prev"/>
478 </xsl:call-template>
479 </xsl:attribute>
480
481 <img src="figures/nav-prev.png" alt="Prev" border="0"/>
482 </a>
483 </xsl:when>
484 <xsl:otherwise>
485 <img src="figures/nav-xprev.png" alt="Prev" border="0"/>
486 </xsl:otherwise>
487 </xsl:choose>
488 <xsl:text>&#160;</xsl:text>
489
490 <xsl:choose>
491 <xsl:when test="count($up)>0">
492 <a>
493 <xsl:attribute name="title">
494 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
495 </xsl:attribute>
496 <xsl:attribute name="href">
497 <xsl:call-template name="href.target">
498 <xsl:with-param name="object" select="$up"/>
499 </xsl:call-template>
500 </xsl:attribute>
501
502 <img src="figures/nav-up.png" alt="Up" border="0"/>
503 </a>
504 </xsl:when>
505 <xsl:otherwise>
506 <img src="figures/nav-xup.png" alt="Up" border="0"/>
507 </xsl:otherwise>
508 </xsl:choose>
509 <xsl:text>&#160;</xsl:text>
510
511 <xsl:choose>
512 <xsl:when test="count($next)>0">
513 <a>
514 <xsl:attribute name="title">
515 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
516 </xsl:attribute>
517 <xsl:attribute name="href">
518 <xsl:call-template name="href.target">
519 <xsl:with-param name="object" select="$next"/>
520 </xsl:call-template>
521 </xsl:attribute>
522
523 <img src="figures/nav-next.png" alt="Next" border="0"/>
524 </a>
525 </xsl:when>
526 <xsl:otherwise>
527 <img src="figures/nav-xnext.png" alt="Next" border="0"/>
528 </xsl:otherwise>
529 </xsl:choose>
530 </td>
531 <td align="right">
532 <i>DocBook: The Definitive Guide</i>
533 <xsl:text> </xsl:text>
534 <xsl:value-of select="/book/bookinfo/releaseinfo"/>
535 <xsl:text> </xsl:text>
536 <span class="alpha-version">
537 <xsl:text>(</xsl:text>
538 <a>
539 <xsl:choose>
540 <xsl:when test="$output.type = 'unexpanded'">
541 <xsl:attribute name="href">co01-x.html</xsl:attribute>
542 </xsl:when>
543 <xsl:otherwise>
544 <xsl:attribute name="href">co01.html</xsl:attribute>
545 </xsl:otherwise>
546 </xsl:choose>
547 <em>Alpha</em>
548 </a>
549 <xsl:text>)</xsl:text>
550 </span>
551 <xsl:text> </xsl:text>
552 </td>
553 </tr>
554 </table>
555 </div>
556 </xsl:if>
557 </xsl:template>
558
559 <xsl:template name="X.header.navigation">
560 <xsl:param name="prev" select="/foo"/>
561 <xsl:param name="next" select="/foo"/>
562 <xsl:variable name="home" select="/*[1]"/>
563 <xsl:variable name="up" select="parent::*"/>
564
565 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
566 <div class="navheader">
567 <table width="100%">
568 <tr>
569 <th colspan="3" align="center">
570 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
571 </th>
572 </tr>
573 <tr>
574 <td width="20%" align="left">
575 <xsl:if test="count($prev)>0">
576 <a>
577 <xsl:attribute name="href">
578 <xsl:call-template name="href.target">
579 <xsl:with-param name="object" select="$prev"/>
580 </xsl:call-template>
581 </xsl:attribute>
582 <xsl:call-template name="gentext.nav.prev"/>
583 </a>
584 </xsl:if>
585 <xsl:text>&#160;</xsl:text>
586 </td>
587 <th width="60%" align="center">
588 <xsl:choose>
589 <xsl:when test="count($up) > 0 and $up != $home">
590 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
591 </xsl:when>
592 <xsl:otherwise>&#160;</xsl:otherwise>
593 </xsl:choose>
594 </th>
595 <td width="20%" align="right">
596 <xsl:text>&#160;</xsl:text>
597 <xsl:if test="count($next)>0">
598 <a>
599 <xsl:attribute name="href">
600 <xsl:call-template name="href.target">
601 <xsl:with-param name="object" select="$next"/>
602 </xsl:call-template>
603 </xsl:attribute>
604 <xsl:call-template name="gentext.nav.next"/>
605 </a>
606 </xsl:if>
607 </td>
608 </tr>
609 </table>
610 <hr/>
611 </div>
612 </xsl:if>
613 </xsl:template>
614
615 <!-- ==================================================================== -->
616
617 <xsl:template name="footer.navigation">
618 <xsl:param name="prev" select="/foo"/>
619 <xsl:param name="next" select="/foo"/>
620 <xsl:variable name="home" select="/*[1]"/>
621 <xsl:variable name="up" select="parent::*"/>
622
623 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
624 <div class="navfooter">
625 <table width="100%" summary="Navigation table">
626 <tr>
627 <td width="40%" align="left">
628 <xsl:if test="count($prev)>0">
629 <a>
630 <xsl:attribute name="title">
631 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
632 </xsl:attribute>
633 <xsl:attribute name="href">
634 <xsl:call-template name="href.target">
635 <xsl:with-param name="object" select="$prev"/>
636 </xsl:call-template>
637 </xsl:attribute>
638
639 <img src="figures/nav-prev.png" alt="Prev" border="0"/>
640 </a>
641 </xsl:if>
642 <xsl:text>&#160;</xsl:text>
643 </td>
644 <td width="20%" align="center">
645 <xsl:choose>
646 <xsl:when test="$home != .">
647 <a>
648 <xsl:attribute name="title">
649 <xsl:apply-templates select="$home" mode="object.title.markup.textonly"/>
650 </xsl:attribute>
651 <xsl:attribute name="href">
652 <xsl:call-template name="href.target">
653 <xsl:with-param name="object" select="$home"/>
654 </xsl:call-template>
655 </xsl:attribute>
656
657 <img src="figures/nav-home.png" alt="Home" border="0"/>
658 </a>
659 </xsl:when>
660 <xsl:otherwise>&#160;</xsl:otherwise>
661 </xsl:choose>
662 </td>
663 <td width="40%" align="right">
664 <xsl:text>&#160;</xsl:text>
665 <xsl:if test="count($next)>0">
666 <a>
667 <xsl:attribute name="title">
668 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
669 </xsl:attribute>
670 <xsl:attribute name="href">
671 <xsl:call-template name="href.target">
672 <xsl:with-param name="object" select="$next"/>
673 </xsl:call-template>
674 </xsl:attribute>
675
676 <img src="figures/nav-next.png" alt="Next" border="0"/>
677 </a>
678 </xsl:if>
679 </td>
680 </tr>
681
682 <tr>
683 <td width="40%" align="left">
684 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
685 <xsl:text>&#160;</xsl:text>
686 </td>
687 <td width="20%" align="center">
688 <xsl:choose>
689 <xsl:when test="count($up)>0">
690 <a>
691 <xsl:attribute name="title">
692 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
693 </xsl:attribute>
694 <xsl:attribute name="href">
695 <xsl:call-template name="href.target">
696 <xsl:with-param name="object" select="$up"/>
697 </xsl:call-template>
698 </xsl:attribute>
699
700 <img src="figures/nav-up.png" alt="Up" border="0"/>
701 </a>
702 </xsl:when>
703 <xsl:otherwise>&#160;</xsl:otherwise>
704 </xsl:choose>
705 </td>
706 <td width="40%" align="right">
707 <xsl:text>&#160;</xsl:text>
708 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
709 </td>
710 </tr>
711 </table>
712 </div>
713 </xsl:if>
714 </xsl:template>
715
716 <xsl:template name="X.footer.navigation">
717 <xsl:param name="prev" select="/foo"/>
718 <xsl:param name="next" select="/foo"/>
719 <xsl:variable name="home" select="/*[1]"/>
720 <xsl:variable name="up" select="parent::*"/>
721
722 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
723 <div class="navfooter">
724 <table width="100%" summary="Navigation table">
725 <tr>
726 <td width="40%" align="left">
727 <xsl:if test="count($prev)>0">
728 <a>
729 <xsl:attribute name="href">
730 <xsl:call-template name="href.target">
731 <xsl:with-param name="object" select="$prev"/>
732 </xsl:call-template>
733 </xsl:attribute>
734 <xsl:call-template name="gentext.nav.prev"/>
735 </a>
736 </xsl:if>
737 <xsl:text>&#160;</xsl:text>
738 </td>
739 <td width="20%" align="center">
740 <xsl:choose>
741 <xsl:when test="$home != .">
742 <a>
743 <xsl:attribute name="href">
744 <xsl:call-template name="href.target">
745 <xsl:with-param name="object" select="$home"/>
746 </xsl:call-template>
747 </xsl:attribute>
748 <xsl:call-template name="gentext.nav.home"/>
749 </a>
750 </xsl:when>
751 <xsl:otherwise>&#160;</xsl:otherwise>
752 </xsl:choose>
753 </td>
754 <td width="40%" align="right">
755 <xsl:text>&#160;</xsl:text>
756 <xsl:if test="count($next)>0">
757 <a>
758 <xsl:attribute name="href">
759 <xsl:call-template name="href.target">
760 <xsl:with-param name="object" select="$next"/>
761 </xsl:call-template>
762 </xsl:attribute>
763 <xsl:call-template name="gentext.nav.next"/>
764 </a>
765 </xsl:if>
766 </td>
767 </tr>
768
769 <tr>
770 <td width="40%" align="left">
771 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
772 <xsl:text>&#160;</xsl:text>
773 </td>
774 <td width="20%" align="center">
775 <xsl:choose>
776 <xsl:when test="count($up)>0">
777 <a>
778 <xsl:attribute name="href">
779 <xsl:call-template name="href.target">
780 <xsl:with-param name="object" select="$up"/>
781 </xsl:call-template>
782 </xsl:attribute>
783 <xsl:call-template name="gentext.nav.up"/>
784 </a>
785 </xsl:when>
786 <xsl:otherwise>&#160;</xsl:otherwise>
787 </xsl:choose>
788 </td>
789 <td width="40%" align="right">
790 <xsl:text>&#160;</xsl:text>
791 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
792 </td>
793 </tr>
794 </table>
795 </div>
796 </xsl:if>
797 </xsl:template>
798
799 <!-- ==================================================================== -->
800
801 <xsl:template match="processing-instruction('dbhtml')">
802 <!-- nop -->
803 </xsl:template>
804
805 <!-- ==================================================================== -->
806
807 <xsl:template name="process-chunk-element">
808 <xsl:param name="root" select="count(parent::*) &gt; 0"/>
809
810 <xsl:variable name="prev"
811 select="(preceding::book[1]
812 |preceding::preface[1]
813 |preceding::chapter[1]
814 |preceding::appendix[1]
815 |preceding::part[1]
816 |preceding::reference[1]
817 |preceding::refentry[1]
818 |preceding::colophon[1]
819 |preceding::article[1]
820 |preceding::bibliography[1]
821 |preceding::glossary[1]
822 |preceding::index[1]
823 |preceding::setindex[1]
824 |ancestor::set
825 |ancestor::book[1]
826 |ancestor::preface[1]
827 |ancestor::chapter[1]
828 |ancestor::appendix[1]
829 |ancestor::part[1]
830 |ancestor::reference[1]
831 |ancestor::article[1])[last()]"/>
832
833 <xsl:variable name="next"
834 select="(following::book[1]
835 |following::preface[1]
836 |following::chapter[1]
837 |following::appendix[1]
838 |following::part[1]
839 |following::reference[1]
840 |following::refentry[1]
841 |following::colophon[1]
842 |following::bibliography[1]
843 |following::glossary[1]
844 |following::index[1]
845 |following::article[1]
846 |following::setindex[1]
847 |descendant::book[1]
848 |descendant::preface[1]
849 |descendant::chapter[1]
850 |descendant::appendix[1]
851 |descendant::article[1]
852 |descendant::bibliography[1]
853 |descendant::glossary[1]
854 |descendant::index[1]
855 |descendant::colophon[1]
856 |descendant::setindex[1]
857 |descendant::part[1]
858 |descendant::reference[1]
859 |descendant::refentry[1])[1]"/>
860
861 <xsl:variable name="ischunk">
862 <xsl:call-template name="chunk"/>
863 </xsl:variable>
864
865 <xsl:variable name="chunkfn">
866 <xsl:if test="$ischunk='1'">
867 <xsl:apply-templates mode="chunk-filename" select="."/>
868 </xsl:if>
869 </xsl:variable>
870
871 <xsl:if test="$ischunk='0'">
872 <xsl:message>
873 <xsl:text>Error </xsl:text>
874 <xsl:value-of select="name(.)"/>
875 <xsl:text> is not a chunk!</xsl:text>
876 </xsl:message>
877 </xsl:if>
878
879 <xsl:variable name="filename">
880 <xsl:call-template name="make-relative-filename">
881 <xsl:with-param name="base.dir" select="$base.dir"/>
882 <xsl:with-param name="base.name" select="$chunkfn"/>
883 </xsl:call-template>
884 </xsl:variable>
885
886 <!-- processing the whole book and the index in the same pass -->
887 <!-- causes out-of-memory errors. So don't do that. -->
888 <xsl:if test="local-name(.) != 'index' or $rootid != ''">
889 <xsl:call-template name="write.chunk">
890 <xsl:with-param name="filename" select="$filename"/>
891 <xsl:with-param name="content">
892 <xsl:call-template name="chunk-element-content">
893 <xsl:with-param name="prev" select="$prev"/>
894 <xsl:with-param name="next" select="$next"/>
895 </xsl:call-template>
896 </xsl:with-param>
897 </xsl:call-template>
898 </xsl:if>
899 </xsl:template>
900
901 <!-- ==================================================================== -->
902
903 <xsl:template name="chunk-element-content">
904 <xsl:param name="prev"></xsl:param>
905 <xsl:param name="next"></xsl:param>
906
907 <html>
908 <xsl:call-template name="html.head">
909 <xsl:with-param name="prev" select="$prev"/>
910 <xsl:with-param name="next" select="$next"/>
911 </xsl:call-template>
912
913 <body>
914 <xsl:if test=". != /book">
915 <xsl:call-template name="user.header.navigation"/>
916
917 <xsl:call-template name="header.navigation">
918 <xsl:with-param name="prev" select="$prev"/>
919 <xsl:with-param name="next" select="$next"/>
920 </xsl:call-template>
921
922 <xsl:call-template name="user.header.content"/>
923 </xsl:if>
924
925 <xsl:apply-imports/>
926
927 <xsl:if test=". != /book">
928 <xsl:call-template name="user.footer.content"/>
929
930 <xsl:call-template name="footer.navigation">
931 <xsl:with-param name="prev" select="$prev"/>
932 <xsl:with-param name="next" select="$next"/>
933 </xsl:call-template>
934
935 <xsl:call-template name="user.footer.navigation"/>
936 </xsl:if>
937 </body>
938 </html>
939 </xsl:template>
940
941 <!-- ==================================================================== -->
942
943 <xsl:template match="/set|/book|/part|/preface|/chapter|/appendix
944 |/article|/reference|/refentry
945 |/glossary|/bibliography|/colophon
946 |/setindex|/index"
947 priority="2">
948 <xsl:call-template name="process-chunk-element">
949 <xsl:with-param name="root" select="'1'"/>
950 </xsl:call-template>
951 </xsl:template>
952
953 <xsl:template match="set|book|part|preface|chapter|appendix
954 |article
955 |reference|refentry
956 |book/glossary|article/glossary
957 |book/bibliography|article/bibliography
958 |colophon">
959 <xsl:call-template name="process-chunk-element"/>
960 </xsl:template>
961
962 <xsl:template match="setindex
963 |book/index
964 |article/index">
965 <!-- some implementations use completely empty index tags to indicate -->
966 <!-- where an automatically generated index should be inserted. so -->
967 <!-- if the index is completely empty, skip it. -->
968 <xsl:if test="count(*)>0 or $generate.index != '0'">
969 <xsl:call-template name="process-chunk-element"/>
970 </xsl:if>
971 </xsl:template>
972
973 <!-- ==================================================================== -->
974
975 </xsl:stylesheet>