Debian Codegraph @

stylesheets/defchunk.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:doc="http://nwalsh.com/xsl/documentation/1.0"
4 version="1.0"
5 exclude-result-prefixes="doc">
6
7 <!-- THIS STYLESHEET IS FOR SAXON -->
8
9 <!-- Because I want to change the chunking rules, I need to copy the
10 while stylesheet. The import/apply-imports trick won't work because
11 the imported chunking code would chunk at the places where I want
12 to avoid chunking. -->
13
14 <xsl:import href="defguide.xsl"/>
•15 <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>
16
17 <xsl:output method="html"
18 encoding="ISO-8859-1"
19 indent="no"/>
20
21 <!-- ==================================================================== -->
22
23 <xsl:param name="html.ext" select="'.html'"/>
24 <xsl:param name="root.filename" select="'docbook'"/>
25 <xsl:param name="base.dir" select="''"/>
26 <doc:param name="base.dir" xmlns="">
27 <refpurpose>Output directory for chunks</refpurpose>
28 <refdescription>
29 <para>If specified, the <literal>base.dir</literal> identifies
30 the output directory for chunks. (If not specified, the output directory
31 is system dependent.)</para>
32 </refdescription>
33 </doc:param>
34
35 <!-- ==================================================================== -->
36
37 <xsl:template match="bookinfo/copyright" mode="titlepage.mode">
38 <p class="copyright">
39 <a href="dbcpyright.html">Copyright</a>
40 <xsl:text> (C) </xsl:text>
41 <xsl:apply-templates select="year" mode="titlepage.mode"/>
42 <xsl:text> </xsl:text>
43 <xsl:apply-templates select="holder" mode="titlepage.mode"/>
44 </p>
45 <br clear="all"/>
46 <xsl:call-template name="write.chunk">
47 <xsl:with-param name="filename">
48 <xsl:call-template name="make-relative-filename">
49 <xsl:with-param name="base.dir" select="$base.dir"/>
50 <xsl:with-param name="base.name" select="'dbcpyright.html'"/>
51 </xsl:call-template>
52 </xsl:with-param>
53 <xsl:with-param name="content">
54 <xsl:apply-templates select="/book" mode="dbcpyright-mode"/>
55 </xsl:with-param>
56 </xsl:call-template>
57 </xsl:template>
58
59 <xsl:template match="book" mode="dbcpyright-mode">
60 <html>
61 <xsl:call-template name="html.head"/>
62 <body>
63 <xsl:call-template name="body.attributes"/>
64 <xsl:apply-templates select="bookinfo/legalnotice"
65 mode="titlepage.mode"/>
66 </body>
67 </html>
68 </xsl:template>
69
70 <!-- ==================================================================== -->
71 <!-- What's a chunk?
72
73 appendix
74 article
75 bibliography in article or book
76 book
77 chapter
78 colophon
79 glossary in article or book
80 index in article or book
81 part
82 preface
83 refentry
84 reference
85 set
86 setindex
87 -->
88 <!-- ==================================================================== -->
89
90 <xsl:template name="chunk">
91 <xsl:param name="node" select="."/>
92 <!-- returns 1 if $node is a chunk -->
93
94 <xsl:choose>
95 <xsl:when test="name($node)='preface'">1</xsl:when>
96 <xsl:when test="name($node)='chapter'">1</xsl:when>
97 <xsl:when test="name($node)='appendix'">1</xsl:when>
98 <xsl:when test="name($node)='article'">1</xsl:when>
99 <xsl:when test="name($node)='part'">1</xsl:when>
100 <xsl:when test="name($node)='reference'">1</xsl:when>
101 <xsl:when test="name($node)='refentry'">1</xsl:when>
102 <xsl:when test="name($node)='index'">1</xsl:when>
103 <xsl:when test="name($node)='bibliography'">1</xsl:when>
104 <xsl:when test="name($node)='glossary'">1</xsl:when>
105 <xsl:when test="name($node)='colophon'">1</xsl:when>
106 <xsl:when test="name($node)='book'">1</xsl:when>
107 <xsl:when test="name($node)='set'">1</xsl:when>
108 <xsl:when test="name($node)='setindex'">1</xsl:when>
109 <xsl:otherwise>0</xsl:otherwise>
110 </xsl:choose>
111 </xsl:template>
112
113 <!-- ==================================================================== -->
114
115 <xsl:template match="*" mode="chunk-filename">
116 <xsl:param name="recursive" select="false()"/>
117
118 <!-- returns the filename of a chunk -->
119 <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
120 <xsl:variable name="filename">
•121 <xsl:call-template name="pi.dbhtml_filename"/>
122 </xsl:variable>
123 <xsl:variable name="dir">
•124 <xsl:call-template name="pi.dbhtml_dir"/>
125 </xsl:variable>
126
127 <xsl:choose>
128 <xsl:when test="$ischunk='0'">
129 <!-- if called on something that isn't a chunk, walk up... -->
130 <xsl:choose>
131 <xsl:when test="count(parent::*)>0">
132 <xsl:apply-templates mode="chunk-filename" select="parent::*">
133 <xsl:with-param name="recursive" select="$recursive"/>
134 </xsl:apply-templates>
135 </xsl:when>
136 <!-- unless there is no up, in which case return "" -->
137 <xsl:otherwise></xsl:otherwise>
138 </xsl:choose>
139 </xsl:when>
140
141 <xsl:when test="not($recursive) and $filename != ''">
142 <!-- if this chunk has an explicit name, use it -->
143 <xsl:if test="$dir != ''">
144 <xsl:value-of select="$dir"/>
145 <xsl:text>/</xsl:text>
146 </xsl:if>
147 <xsl:value-of select="$filename"/>
148 </xsl:when>
149
150 <xsl:when test="local-name(.)='set'">
151 <xsl:value-of select="$root.filename"/>
152 <xsl:if test="not($recursive)">
153 <xsl:value-of select="$html.ext"/>
154 </xsl:if>
155 </xsl:when>
156
157 <xsl:when test="local-name(.)='book'">
158 <xsl:choose>
159 <xsl:when test="count(parent::*)>0">
160 <xsl:text>bk</xsl:text>
161 <xsl:number level="any" format="01"/>
162 </xsl:when>
163 <xsl:otherwise>
164 <xsl:value-of select="$root.filename"/>
165 </xsl:otherwise>
166 </xsl:choose>
167 <xsl:if test="not($recursive)">
168 <xsl:value-of select="$html.ext"/>
169 </xsl:if>
170 </xsl:when>
171
172 <xsl:when test="local-name(.)='article'">
173 <xsl:choose>
174 <xsl:when test="/set">
175 <!-- in a set, make sure we inherit the right book info... -->
176 <xsl:apply-templates mode="chunk-filename" select="parent::*">
177 <xsl:with-param name="recursive" select="true()"/>
178 </xsl:apply-templates>
179 </xsl:when>
180 <xsl:when test="count(parent::*)>0">
181 <!-- if we aren't the root, name them numerically ... -->
182 <xsl:text>ar</xsl:text>
183 <xsl:number level="any" format="01" from="book"/>
184 </xsl:when>
185 <xsl:otherwise>
186 <xsl:value-of select="$root.filename"/>
187 </xsl:otherwise>
188 </xsl:choose>
189 <xsl:if test="not($recursive)">
190 <xsl:value-of select="$html.ext"/>
191 </xsl:if>
192 </xsl:when>
193
194 <xsl:when test="local-name(.)='preface'">
195 <xsl:if test="/set">
196 <xsl:apply-templates mode="chunk-filename" select="parent::*">
197 <xsl:with-param name="recursive" select="true()"/>
198 </xsl:apply-templates>
199 </xsl:if>
200 <xsl:text>pr</xsl:text>
201 <xsl:number level="any" format="01" from="book"/>
202 <xsl:if test="not($recursive)">
203 <xsl:value-of select="$html.ext"/>
204 </xsl:if>
205 </xsl:when>
206
207 <xsl:when test="local-name(.)='chapter'">
208 <xsl:if test="/set">
209 <xsl:apply-templates mode="chunk-filename" select="parent::*">
210 <xsl:with-param name="recursive" select="true()"/>
211 </xsl:apply-templates>
212 </xsl:if>
213 <xsl:text>ch</xsl:text>
214 <xsl:number level="any" format="01" from="book"/>
215 <xsl:if test="not($recursive)">
216 <xsl:value-of select="$html.ext"/>
217 </xsl:if>
218 </xsl:when>
219
220 <xsl:when test="local-name(.)='appendix'">
221 <xsl:if test="/set">
222 <xsl:apply-templates mode="chunk-filename" select="parent::*">
223 <xsl:with-param name="recursive" select="true()"/>
224 </xsl:apply-templates>
225 </xsl:if>
226 <xsl:text>ap</xsl:text>
227 <xsl:number level="any" format="a" from="book"/>
228 <xsl:if test="not($recursive)">
229 <xsl:value-of select="$html.ext"/>
230 </xsl:if>
231 </xsl:when>
232
233 <xsl:when test="local-name(.)='part'">
234 <xsl:if test="/set">
235 <xsl:apply-templates mode="chunk-filename" select="parent::*">
236 <xsl:with-param name="recursive" select="true()"/>
237 </xsl:apply-templates>
238 </xsl:if>
239 <xsl:text>pt</xsl:text>
240 <xsl:number level="any" format="01" from="book"/>
241 <xsl:if test="not($recursive)">
242 <xsl:value-of select="$html.ext"/>
243 </xsl:if>
244 </xsl:when>
245
246 <xsl:when test="local-name(.)='reference'">
247 <xsl:if test="/set">
248 <xsl:apply-templates mode="chunk-filename" select="parent::*">
249 <xsl:with-param name="recursive" select="true()"/>
250 </xsl:apply-templates>
251 </xsl:if>
252 <xsl:text>rn</xsl:text>
253 <xsl:number level="any" format="01" from="book"/>
254 <xsl:if test="not($recursive)">
255 <xsl:value-of select="$html.ext"/>
256 </xsl:if>
257 </xsl:when>
258
259 <xsl:when test="local-name(.)='refentry'">
260 <xsl:if test="parent::reference">
261 <xsl:apply-templates mode="chunk-filename" select="parent::*">
262 <xsl:with-param name="recursive" select="true()"/>
263 </xsl:apply-templates>
264 </xsl:if>
265 <xsl:text>re</xsl:text>
266 <xsl:number level="any" format="01" from="book"/>
267 <xsl:if test="not($recursive)">
268 <xsl:value-of select="$html.ext"/>
269 </xsl:if>
270 </xsl:when>
271
272 <xsl:when test="local-name(.)='colophon'">
273 <xsl:if test="/set">
274 <xsl:apply-templates mode="chunk-filename" select="parent::*">
275 <xsl:with-param name="recursive" select="true()"/>
276 </xsl:apply-templates>
277 </xsl:if>
278 <xsl:text>co</xsl:text>
279 <xsl:number level="any" format="01" from="book"/>
280 <xsl:if test="not($recursive)">
281 <xsl:value-of select="$html.ext"/>
282 </xsl:if>
283 </xsl:when>
284
285 <xsl:when test="local-name(.)='bibliography'">
286 <xsl:if test="/set">
287 <xsl:apply-templates mode="chunk-filename" select="parent::*">
288 <xsl:with-param name="recursive" select="true()"/>
289 </xsl:apply-templates>
290 </xsl:if>
291 <xsl:text>bi</xsl:text>
292 <xsl:number level="any" format="01" from="book"/>
293 <xsl:if test="not($recursive)">
294 <xsl:value-of select="$html.ext"/>
295 </xsl:if>
296 </xsl:when>
297
298 <xsl:when test="local-name(.)='glossary'">
299 <xsl:if test="/set">
300 <xsl:apply-templates mode="chunk-filename" select="parent::*">
301 <xsl:with-param name="recursive" select="true()"/>
302 </xsl:apply-templates>
303 </xsl:if>
304 <xsl:text>go</xsl:text>
305 <xsl:number level="any" format="01" from="book"/>
306 <xsl:if test="not($recursive)">
307 <xsl:value-of select="$html.ext"/>
308 </xsl:if>
309 </xsl:when>
310
311 <xsl:when test="local-name(.)='index'">
312 <xsl:if test="/set">
313 <xsl:apply-templates mode="chunk-filename" select="parent::*">
314 <xsl:with-param name="recursive" select="true()"/>
315 </xsl:apply-templates>
316 </xsl:if>
317 <xsl:text>ix</xsl:text>
318 <xsl:number level="any" format="01" from="book"/>
319 <xsl:if test="not($recursive)">
320 <xsl:value-of select="$html.ext"/>
321 </xsl:if>
322 </xsl:when>
323
324 <xsl:when test="local-name(.)='setindex'">
325 <xsl:text>si</xsl:text>
326 <xsl:number level="any" format="01" from="set"/>
327 <xsl:if test="not($recursive)">
328 <xsl:value-of select="$html.ext"/>
329 </xsl:if>
330 </xsl:when>
331
332 <xsl:otherwise>
333 <xsl:text>chunk-filename-error-</xsl:text>
334 <xsl:value-of select="local-name(.)"/>
335 <xsl:number level="any" format="01" from="set"/>
336 <xsl:if test="not($recursive)">
337 <xsl:value-of select="$html.ext"/>
338 </xsl:if>
339 </xsl:otherwise>
340 </xsl:choose>
341 </xsl:template>
342
343 <!-- ==================================================================== -->
344
345 <xsl:template name="href.target">
346 <xsl:param name="object" select="."/>
347 <xsl:variable name="ischunk">
348 <xsl:call-template name="chunk">
349 <xsl:with-param name="node" select="$object"/>
350 </xsl:call-template>
351 </xsl:variable>
352
353 <xsl:apply-templates mode="chunk-filename" select="$object"/>
354
355 <xsl:if test="$ischunk='0'">
356 <xsl:text>#</xsl:text>
357 <xsl:call-template name="object.id">
358 <xsl:with-param name="object" select="$object"/>
359 </xsl:call-template>
360 </xsl:if>
361 </xsl:template>
362
363 <!-- ==================================================================== -->
364
365 <xsl:template name="html.head">
366 <xsl:param name="prev" select="/foo"/>
367 <xsl:param name="next" select="/foo"/>
368 <xsl:variable name="home" select="/*[1]"/>
369 <xsl:variable name="up" select="parent::*"/>
370
371 <head>
372 <xsl:call-template name="head.content"/>
373 <xsl:call-template name="user.head.content"/>
374
375 <xsl:if test="$home">
376 <link rel="home">
377 <xsl:attribute name="href">
378 <xsl:call-template name="href.target">
379 <xsl:with-param name="object" select="$home"/>
380 </xsl:call-template>
381 </xsl:attribute>
382 <xsl:attribute name="title">
383 <xsl:apply-templates select="$home" mode="object.title.markup.textonly">
384 <xsl:with-param name="text-only" select="'1'"/>
385 </xsl:apply-templates>
386 </xsl:attribute>
387 </link>
388 </xsl:if>
389
390 <xsl:if test="$up">
391 <link rel="up">
392 <xsl:attribute name="href">
393 <xsl:call-template name="href.target">
394 <xsl:with-param name="object" select="$up"/>
395 </xsl:call-template>
396 </xsl:attribute>
397 <xsl:attribute name="title">
398 <xsl:apply-templates select="$up" mode="object.title.markup.textonly">
399 <xsl:with-param name="text-only" select="'1'"/>
400 </xsl:apply-templates>
401 </xsl:attribute>
402 </link>
403 </xsl:if>
404
405 <xsl:if test="$prev">
406 <link rel="previous">
407 <xsl:attribute name="href">
408 <xsl:call-template name="href.target">
409 <xsl:with-param name="object" select="$prev"/>
410 </xsl:call-template>
411 </xsl:attribute>
412 <xsl:attribute name="title">
413 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly">
414 <xsl:with-param name="text-only" select="'1'"/>
415 </xsl:apply-templates>
416 </xsl:attribute>
417 </link>
418 </xsl:if>
419
420 <xsl:if test="$next">
421 <link rel="next">
422 <xsl:attribute name="href">
423 <xsl:call-template name="href.target">
424 <xsl:with-param name="object" select="$next"/>
425 </xsl:call-template>
426 </xsl:attribute>
427 <xsl:attribute name="title">
428 <xsl:apply-templates select="$next" mode="object.title.markup.textonly">
429 <xsl:with-param name="text-only" select="'1'"/>
430 </xsl:apply-templates>
431 </xsl:attribute>
432 </link>
433 </xsl:if>
434 </head>
435 </xsl:template>
436
437 <!-- ==================================================================== -->
438
439 <xsl:template name="header.navigation">
440 <xsl:param name="prev" select="/foo"/>
441 <xsl:param name="next" select="/foo"/>
442 <xsl:variable name="home" select="/*[1]"/>
443 <xsl:variable name="up" select="parent::*"/>
444
445 <xsl:if test="$suppress.navigation = '0'">
446 <div class="navheader">
447 <table width="100%">
448 <tr>
449 <th colspan="3" align="center">
450 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
451 </th>
452 </tr>
453 <tr>
454 <td width="20%" align="left">
455 <xsl:if test="count($prev)>0">
456 <a>
457 <xsl:attribute name="href">
458 <xsl:call-template name="href.target">
459 <xsl:with-param name="object" select="$prev"/>
460 </xsl:call-template>
461 </xsl:attribute>
462 <xsl:call-template name="gentext.nav.prev"/>
463 </a>
464 </xsl:if>
465 <xsl:text>&#160;</xsl:text>
466 </td>
467 <th width="60%" align="center">
468 <xsl:choose>
469 <xsl:when test="count($up) > 0 and $up != $home">
470 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
471 </xsl:when>
472 <xsl:otherwise>&#160;</xsl:otherwise>
473 </xsl:choose>
474 </th>
475 <td width="20%" align="right">
476 <xsl:text>&#160;</xsl:text>
477 <xsl:if test="count($next)>0">
478 <a>
479 <xsl:attribute name="href">
480 <xsl:call-template name="href.target">
481 <xsl:with-param name="object" select="$next"/>
482 </xsl:call-template>
483 </xsl:attribute>
484 <xsl:call-template name="gentext.nav.next"/>
485 </a>
486 </xsl:if>
487 </td>
488 </tr>
489 </table>
490 <hr/>
491 </div>
492 </xsl:if>
493 </xsl:template>
494
495 <!-- ==================================================================== -->
496
497 <xsl:template name="footer.navigation">
498 <xsl:param name="prev" select="/foo"/>
499 <xsl:param name="next" select="/foo"/>
500 <xsl:variable name="home" select="/*[1]"/>
501 <xsl:variable name="up" select="parent::*"/>
502
503 <xsl:if test="$suppress.navigation = '0'">
504 <div class="navfooter">
505 <hr/>
506 <table width="100%">
507 <tr>
508 <td width="40%" align="left">
509 <xsl:if test="count($prev)>0">
510 <a>
511 <xsl:attribute name="href">
512 <xsl:call-template name="href.target">
513 <xsl:with-param name="object" select="$prev"/>
514 </xsl:call-template>
515 </xsl:attribute>
516 <xsl:call-template name="gentext.nav.prev"/>
517 </a>
518 </xsl:if>
519 <xsl:text>&#160;</xsl:text>
520 </td>
521 <td width="20%" align="center">
522 <xsl:choose>
523 <xsl:when test="$home != .">
524 <a>
525 <xsl:attribute name="href">
526 <xsl:call-template name="href.target">
527 <xsl:with-param name="object" select="$home"/>
528 </xsl:call-template>
529 </xsl:attribute>
530 <xsl:call-template name="gentext.nav.home"/>
531 </a>
532 </xsl:when>
533 <xsl:otherwise>&#160;</xsl:otherwise>
534 </xsl:choose>
535 </td>
536 <td width="40%" align="right">
537 <xsl:text>&#160;</xsl:text>
538 <xsl:if test="count($next)>0">
539 <a>
540 <xsl:attribute name="href">
541 <xsl:call-template name="href.target">
542 <xsl:with-param name="object" select="$next"/>
543 </xsl:call-template>
544 </xsl:attribute>
545 <xsl:call-template name="gentext.nav.next"/>
546 </a>
547 </xsl:if>
548 </td>
549 </tr>
550
551 <tr>
552 <td width="40%" align="left">
553 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
554 <xsl:text>&#160;</xsl:text>
555 </td>
556 <td width="20%" align="center">
557 <xsl:choose>
558 <xsl:when test="count($up)>0">
559 <a>
560 <xsl:attribute name="href">
561 <xsl:call-template name="href.target">
562 <xsl:with-param name="object" select="$up"/>
563 </xsl:call-template>
564 </xsl:attribute>
565 <xsl:call-template name="gentext.nav.up"/>
566 </a>
567 </xsl:when>
568 <xsl:otherwise>&#160;</xsl:otherwise>
569 </xsl:choose>
570 </td>
571 <td width="40%" align="right">
572 <xsl:text>&#160;</xsl:text>
573 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
574 </td>
575 </tr>
576 </table>
577 </div>
578 </xsl:if>
579 </xsl:template>
580
581 <!-- ==================================================================== -->
582
583 <xsl:template match="processing-instruction('dbhtml')">
584 <!-- nop -->
585 </xsl:template>
586
587 <!-- ==================================================================== -->
588
589 <xsl:template name="process-chunk-element">
590 <xsl:param name="root" select="count(parent::*) &gt; 0"/>
591
592 <xsl:variable name="prev"
593 select="(preceding::book[1]
594 |preceding::preface[1]
595 |preceding::chapter[1]
596 |preceding::appendix[1]
597 |preceding::part[1]
598 |preceding::reference[1]
599 |preceding::refentry[1]
600 |preceding::colophon[1]
601 |preceding::article[1]
602 |preceding::bibliography[1]
603 |preceding::glossary[1]
604 |preceding::index[1]
605 |preceding::setindex[1]
606 |ancestor::set
607 |ancestor::book[1]
608 |ancestor::preface[1]
609 |ancestor::chapter[1]
610 |ancestor::appendix[1]
611 |ancestor::part[1]
612 |ancestor::reference[1]
613 |ancestor::article[1])[last()]"/>
614
615 <xsl:variable name="next"
616 select="(following::book[1]
617 |following::preface[1]
618 |following::chapter[1]
619 |following::appendix[1]
620 |following::part[1]
621 |following::reference[1]
622 |following::refentry[1]
623 |following::colophon[1]
624 |following::bibliography[1]
625 |following::glossary[1]
626 |following::index[1]
627 |following::article[1]
628 |following::setindex[1]
629 |descendant::book[1]
630 |descendant::preface[1]
631 |descendant::chapter[1]
632 |descendant::appendix[1]
633 |descendant::article[1]
634 |descendant::bibliography[1]
635 |descendant::glossary[1]
636 |descendant::index[1]
637 |descendant::colophon[1]
638 |descendant::setindex[1]
639 |descendant::part[1]
640 |descendant::reference[1]
641 |descendant::refentry[1])[1]"/>
642
643 <xsl:variable name="ischunk">
644 <xsl:call-template name="chunk"/>
645 </xsl:variable>
646
647 <xsl:variable name="chunkfn">
648 <xsl:if test="$ischunk='1'">
649 <xsl:apply-templates mode="chunk-filename" select="."/>
650 </xsl:if>
651 </xsl:variable>
652
653 <xsl:if test="$ischunk='0'">
654 <xsl:message>
655 <xsl:text>Error </xsl:text>
656 <xsl:value-of select="name(.)"/>
657 <xsl:text> is not a chunk!</xsl:text>
658 </xsl:message>
659 </xsl:if>
660
661 <xsl:variable name="filename">
662 <xsl:call-template name="make-relative-filename">
663 <xsl:with-param name="base.dir" select="$base.dir"/>
664 <xsl:with-param name="base.name" select="$chunkfn"/>
665 </xsl:call-template>
666 </xsl:variable>
667
668 <xsl:call-template name="write.chunk">
669 <xsl:with-param name="filename" select="$filename"/>
670 <xsl:with-param name="content">
671 <xsl:call-template name="chunk-element-content">
672 <xsl:with-param name="prev" select="$prev"/>
673 <xsl:with-param name="next" select="$next"/>
674 </xsl:call-template>
675 </xsl:with-param>
676 </xsl:call-template>
677 </xsl:template>
678
679 <!-- ==================================================================== -->
680
681 <xsl:template name="chunk-element-content">
682 <xsl:param name="prev"></xsl:param>
683 <xsl:param name="next"></xsl:param>
684
685 <html>
686 <xsl:call-template name="html.head">
687 <xsl:with-param name="prev" select="$prev"/>
688 <xsl:with-param name="next" select="$next"/>
689 </xsl:call-template>
690
691 <body>
692 <xsl:call-template name="body.attributes"/>
693 <xsl:if test=". != /book">
694 <xsl:call-template name="user.header.navigation"/>
695
696 <xsl:call-template name="header.navigation">
697 <xsl:with-param name="prev" select="$prev"/>
698 <xsl:with-param name="next" select="$next"/>
699 </xsl:call-template>
700
701 <xsl:call-template name="user.header.content"/>
702 </xsl:if>
703
704 <xsl:apply-imports/>
705
706 <xsl:if test=". != /book">
707 <xsl:call-template name="user.footer.content"/>
708
709 <xsl:call-template name="footer.navigation">
710 <xsl:with-param name="prev" select="$prev"/>
711 <xsl:with-param name="next" select="$next"/>
712 </xsl:call-template>
713
714 <xsl:call-template name="user.footer.navigation"/>
715 </xsl:if>
716 </body>
717 </html>
718 </xsl:template>
719
720 <!-- ==================================================================== -->
721
722 <xsl:template match="/">
723 <xsl:choose>
724 <xsl:when test="$rootid != ''">
725 <xsl:choose>
726 <xsl:when test="count(id($rootid)) = 0">
727 <xsl:message terminate="yes">
728 <xsl:text>ID '</xsl:text>
729 <xsl:value-of select="$rootid"/>
730 <xsl:text>' not found in document.</xsl:text>
731 </xsl:message>
732 </xsl:when>
733 <xsl:otherwise>
734 <xsl:message>
735 <xsl:text>Processing element </xsl:text>
736 <xsl:value-of select="$rootid"/>
737 </xsl:message>
738 <xsl:apply-templates select="id($rootid)"/>
739 </xsl:otherwise>
740 </xsl:choose>
741 </xsl:when>
742 <xsl:otherwise>
743 <xsl:apply-templates/>
744 </xsl:otherwise>
745 </xsl:choose>
746 </xsl:template>
747
748 <xsl:template match="/set|/book|/part|/preface|/chapter|/appendix
749 |/article|/reference|/refentry
750 |/glossary|/bibliography|/colophon
751 |/setindex|/index"
752 priority="2">
753 <xsl:call-template name="process-chunk-element">
754 <xsl:with-param name="root" select="'1'"/>
755 </xsl:call-template>
756 </xsl:template>
757
758 <xsl:template match="set|book|part|preface|chapter|appendix
759 |article
760 |reference|refentry
761 |book/glossary|article/glossary
762 |book/bibliography|article/bibliography
763 |colophon">
764 <xsl:call-template name="process-chunk-element"/>
765 </xsl:template>
766
767 <xsl:template match="setindex
768 |book/index
769 |article/index">
770 <!-- some implementations use completely empty index tags to indicate -->
771 <!-- where an automatically generated index should be inserted. so -->
772 <!-- if the index is completely empty, skip it. -->
773 <xsl:if test="count(*)>0 or $generate.index != '0'">
774 <xsl:call-template name="process-chunk-element"/>
775 </xsl:if>
776 </xsl:template>
777
778 <!-- ==================================================================== -->
779
780 </xsl:stylesheet>