source: trunk/Distribution/XSL/html/chunk-common.xsl@ 2

Last change on this file since 2 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 36.4 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version="1.0">
4
5<!-- ********************************************************************
6 $Id: chunk-common.xsl,v 1.43 2005/05/26 07:27:34 bobstayton Exp $
7 ********************************************************************
8
9 This file is part of the XSL DocBook Stylesheet distribution.
10 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
11 and other information.
12
13 ******************************************************************** -->
14
15<!-- ==================================================================== -->
16
17<xsl:template name="chunk">
18 <xsl:param name="node" select="."/>
19 <!-- returns 1 if $node is a chunk -->
20
21 <!-- ==================================================================== -->
22 <!-- What's a chunk?
23
24 The root element
25 appendix
26 article
27 bibliography in article or part or book
28 book
29 chapter
30 colophon
31 glossary in article or part or book
32 index in article or part or book
33 part
34 preface
35 refentry
36 reference
37 sect{1,2,3,4,5} if position()>1 && depth < chunk.section.depth
38 section if position()>1 && depth < chunk.section.depth
39 set
40 setindex
41 -->
42 <!-- ==================================================================== -->
43
44<!--
45 <xsl:message>
46 <xsl:text>chunk: </xsl:text>
47 <xsl:value-of select="name($node)"/>
48 <xsl:text>(</xsl:text>
49 <xsl:value-of select="$node/@id"/>
50 <xsl:text>)</xsl:text>
51 <xsl:text> csd: </xsl:text>
52 <xsl:value-of select="$chunk.section.depth"/>
53 <xsl:text> cfs: </xsl:text>
54 <xsl:value-of select="$chunk.first.sections"/>
55 <xsl:text> ps: </xsl:text>
56 <xsl:value-of select="count($node/parent::section)"/>
57 <xsl:text> prs: </xsl:text>
58 <xsl:value-of select="count($node/preceding-sibling::section)"/>
59 </xsl:message>
60-->
61
62 <xsl:choose>
63 <xsl:when test="not($node/parent::*)">1</xsl:when>
64
65 <xsl:when test="local-name($node) = 'sect1'
66 and $chunk.section.depth &gt;= 1
67 and ($chunk.first.sections != 0
68 or count($node/preceding-sibling::sect1) &gt; 0)">
69 <xsl:text>1</xsl:text>
70 </xsl:when>
71 <xsl:when test="local-name($node) = 'sect2'
72 and $chunk.section.depth &gt;= 2
73 and ($chunk.first.sections != 0
74 or count($node/preceding-sibling::sect2) &gt; 0)">
75 <xsl:call-template name="chunk">
76 <xsl:with-param name="node" select="$node/parent::*"/>
77 </xsl:call-template>
78 </xsl:when>
79 <xsl:when test="local-name($node) = 'sect3'
80 and $chunk.section.depth &gt;= 3
81 and ($chunk.first.sections != 0
82 or count($node/preceding-sibling::sect3) &gt; 0)">
83 <xsl:call-template name="chunk">
84 <xsl:with-param name="node" select="$node/parent::*"/>
85 </xsl:call-template>
86 </xsl:when>
87 <xsl:when test="local-name($node) = 'sect4'
88 and $chunk.section.depth &gt;= 4
89 and ($chunk.first.sections != 0
90 or count($node/preceding-sibling::sect4) &gt; 0)">
91 <xsl:call-template name="chunk">
92 <xsl:with-param name="node" select="$node/parent::*"/>
93 </xsl:call-template>
94 </xsl:when>
95 <xsl:when test="local-name($node) = 'sect5'
96 and $chunk.section.depth &gt;= 5
97 and ($chunk.first.sections != 0
98 or count($node/preceding-sibling::sect5) &gt; 0)">
99 <xsl:call-template name="chunk">
100 <xsl:with-param name="node" select="$node/parent::*"/>
101 </xsl:call-template>
102 </xsl:when>
103 <xsl:when test="local-name($node) = 'section'
104 and $chunk.section.depth &gt;= count($node/ancestor::section)+1
105 and ($chunk.first.sections != 0
106 or count($node/preceding-sibling::section) &gt; 0)">
107 <xsl:call-template name="chunk">
108 <xsl:with-param name="node" select="$node/parent::*"/>
109 </xsl:call-template>
110 </xsl:when>
111
112 <xsl:when test="local-name($node)='preface'">1</xsl:when>
113 <xsl:when test="local-name($node)='chapter'">1</xsl:when>
114 <xsl:when test="local-name($node)='appendix'">1</xsl:when>
115 <xsl:when test="local-name($node)='article'">1</xsl:when>
116 <xsl:when test="local-name($node)='part'">1</xsl:when>
117 <xsl:when test="local-name($node)='reference'">1</xsl:when>
118 <xsl:when test="local-name($node)='refentry'">1</xsl:when>
119 <xsl:when test="local-name($node)='index' and $generate.index != 0
120 and (local-name($node/parent::*) = 'article'
121 or local-name($node/parent::*) = 'book'
122 or local-name($node/parent::*) = 'part'
123 )">1</xsl:when>
124 <xsl:when test="local-name($node)='bibliography'
125 and (local-name($node/parent::*) = 'article'
126 or local-name($node/parent::*) = 'book'
127 or local-name($node/parent::*) = 'part'
128 )">1</xsl:when>
129 <xsl:when test="local-name($node)='glossary'
130 and (local-name($node/parent::*) = 'article'
131 or local-name($node/parent::*) = 'book'
132 or local-name($node/parent::*) = 'part'
133 )">1</xsl:when>
134 <xsl:when test="local-name($node)='colophon'">1</xsl:when>
135 <xsl:when test="local-name($node)='book'">1</xsl:when>
136 <xsl:when test="local-name($node)='set'">1</xsl:when>
137 <xsl:when test="local-name($node)='setindex'">1</xsl:when>
138 <xsl:when test="local-name($node)='legalnotice'
139 and $generate.legalnotice.link != 0">1</xsl:when>
140 <xsl:otherwise>0</xsl:otherwise>
141 </xsl:choose>
142</xsl:template>
143
144<!-- ==================================================================== -->
145
146<xsl:template match="*" mode="chunk-filename">
147 <!-- returns the filename of a chunk -->
148 <xsl:variable name="ischunk">
149 <xsl:call-template name="chunk"/>
150 </xsl:variable>
151
152 <xsl:variable name="fn">
153 <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
154 </xsl:variable>
155
156 <!--
157 <xsl:message>
158 <xsl:value-of select="$ischunk"/>
159 <xsl:text> (</xsl:text>
160 <xsl:value-of select="local-name(.)"/>
161 <xsl:text>) </xsl:text>
162 <xsl:value-of select="$fn"/>
163 <xsl:text>, </xsl:text>
164 <xsl:call-template name="dbhtml-dir"/>
165 </xsl:message>
166 -->
167
168 <!-- 2003-11-25 by ndw:
169 The following test used to read test="$ischunk != 0 and $fn != ''"
170 I've removed the ischunk part of the test so that href.to.uri and
171 href.from.uri will be fully qualified even if the source or target
172 isn't a chunk. I *think* that if $fn != '' then it's appropriate
173 to put the directory on the front, even if the element isn't a
174 chunk. I could be wrong. -->
175
176 <xsl:if test="$fn != ''">
177 <xsl:call-template name="dbhtml-dir"/>
178 </xsl:if>
179
180 <xsl:value-of select="$fn"/>
181 <!-- You can't add the html.ext here because dbhtml filename= may already -->
182 <!-- have added it. It really does have to be handled in the recursive template -->
183</xsl:template>
184
185<xsl:template match="*" mode="recursive-chunk-filename">
186 <xsl:param name="recursive" select="false()"/>
187
188 <!-- returns the filename of a chunk -->
189 <xsl:variable name="ischunk">
190 <xsl:call-template name="chunk"/>
191 </xsl:variable>
192
193 <xsl:variable name="dbhtml-filename">
194 <xsl:call-template name="dbhtml-filename"/>
195 </xsl:variable>
196
197 <xsl:variable name="filename">
198 <xsl:choose>
199 <xsl:when test="$dbhtml-filename != ''">
200 <xsl:value-of select="$dbhtml-filename"/>
201 </xsl:when>
202 <!-- if this is the root element, use the root.filename -->
203 <xsl:when test="not(parent::*) and $root.filename != ''">
204 <xsl:value-of select="$root.filename"/>
205 <xsl:value-of select="$html.ext"/>
206 </xsl:when>
207 <!-- Special case -->
208 <xsl:when test="self::legalnotice and $generate.legalnotice.link != 0">
209 <xsl:variable name="id">
210 <xsl:call-template name="object.id"/>
211 </xsl:variable>
212 <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
213 </xsl:when>
214 <!-- if there's no dbhtml filename, and if we're to use IDs as -->
215 <!-- filenames, then use the ID to generate the filename. -->
216 <xsl:when test="@id and $use.id.as.filename != 0">
217 <xsl:value-of select="@id"/>
218 <xsl:value-of select="$html.ext"/>
219 </xsl:when>
220 <xsl:otherwise></xsl:otherwise>
221 </xsl:choose>
222 </xsl:variable>
223
224 <xsl:choose>
225 <xsl:when test="$ischunk='0'">
226 <!-- if called on something that isn't a chunk, walk up... -->
227 <xsl:choose>
228 <xsl:when test="count(parent::*)>0">
229 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
230 <xsl:with-param name="recursive" select="$recursive"/>
231 </xsl:apply-templates>
232 </xsl:when>
233 <!-- unless there is no up, in which case return "" -->
234 <xsl:otherwise></xsl:otherwise>
235 </xsl:choose>
236 </xsl:when>
237
238 <xsl:when test="not($recursive) and $filename != ''">
239 <!-- if this chunk has an explicit name, use it -->
240 <xsl:value-of select="$filename"/>
241 </xsl:when>
242
243 <xsl:when test="self::set">
244 <xsl:value-of select="$root.filename"/>
245 <xsl:if test="not($recursive)">
246 <xsl:value-of select="$html.ext"/>
247 </xsl:if>
248 </xsl:when>
249
250 <xsl:when test="self::book">
251 <xsl:text>bk</xsl:text>
252 <xsl:number level="any" format="01"/>
253 <xsl:if test="not($recursive)">
254 <xsl:value-of select="$html.ext"/>
255 </xsl:if>
256 </xsl:when>
257
258 <xsl:when test="self::article">
259 <xsl:if test="/set">
260 <!-- in a set, make sure we inherit the right book info... -->
261 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
262 <xsl:with-param name="recursive" select="true()"/>
263 </xsl:apply-templates>
264 </xsl:if>
265
266 <xsl:text>ar</xsl:text>
267 <xsl:number level="any" format="01" from="book"/>
268 <xsl:if test="not($recursive)">
269 <xsl:value-of select="$html.ext"/>
270 </xsl:if>
271 </xsl:when>
272
273 <xsl:when test="self::preface">
274 <xsl:if test="/set">
275 <!-- in a set, make sure we inherit the right book info... -->
276 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
277 <xsl:with-param name="recursive" select="true()"/>
278 </xsl:apply-templates>
279 </xsl:if>
280
281 <xsl:text>pr</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="self::chapter">
289 <xsl:if test="/set">
290 <!-- in a set, make sure we inherit the right book info... -->
291 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
292 <xsl:with-param name="recursive" select="true()"/>
293 </xsl:apply-templates>
294 </xsl:if>
295
296 <xsl:text>ch</xsl:text>
297 <xsl:number level="any" format="01" from="book"/>
298 <xsl:if test="not($recursive)">
299 <xsl:value-of select="$html.ext"/>
300 </xsl:if>
301 </xsl:when>
302
303 <xsl:when test="self::appendix">
304 <xsl:if test="/set">
305 <!-- in a set, make sure we inherit the right book info... -->
306 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
307 <xsl:with-param name="recursive" select="true()"/>
308 </xsl:apply-templates>
309 </xsl:if>
310
311 <xsl:text>ap</xsl:text>
312 <xsl:number level="any" format="a" from="book"/>
313 <xsl:if test="not($recursive)">
314 <xsl:value-of select="$html.ext"/>
315 </xsl:if>
316 </xsl:when>
317
318 <xsl:when test="self::part">
319 <xsl:choose>
320 <xsl:when test="/set">
321 <!-- in a set, make sure we inherit the right book info... -->
322 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
323 <xsl:with-param name="recursive" select="true()"/>
324 </xsl:apply-templates>
325 </xsl:when>
326 <xsl:otherwise>
327 </xsl:otherwise>
328 </xsl:choose>
329
330 <xsl:text>pt</xsl:text>
331 <xsl:number level="any" format="01" from="book"/>
332 <xsl:if test="not($recursive)">
333 <xsl:value-of select="$html.ext"/>
334 </xsl:if>
335 </xsl:when>
336
337 <xsl:when test="self::reference">
338 <xsl:choose>
339 <xsl:when test="/set">
340 <!-- in a set, make sure we inherit the right book info... -->
341 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
342 <xsl:with-param name="recursive" select="true()"/>
343 </xsl:apply-templates>
344 </xsl:when>
345 <xsl:otherwise>
346 </xsl:otherwise>
347 </xsl:choose>
348
349 <xsl:text>rn</xsl:text>
350 <xsl:number level="any" format="01" from="book"/>
351 <xsl:if test="not($recursive)">
352 <xsl:value-of select="$html.ext"/>
353 </xsl:if>
354 </xsl:when>
355
356 <xsl:when test="self::refentry">
357 <xsl:choose>
358 <xsl:when test="parent::reference">
359 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
360 <xsl:with-param name="recursive" select="true()"/>
361 </xsl:apply-templates>
362 </xsl:when>
363 <xsl:otherwise>
364 </xsl:otherwise>
365 </xsl:choose>
366
367 <xsl:text>re</xsl:text>
368 <xsl:number level="any" format="01" from="book"/>
369 <xsl:if test="not($recursive)">
370 <xsl:value-of select="$html.ext"/>
371 </xsl:if>
372 </xsl:when>
373
374 <xsl:when test="self::colophon">
375 <xsl:choose>
376 <xsl:when test="/set">
377 <!-- in a set, make sure we inherit the right book info... -->
378 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
379 <xsl:with-param name="recursive" select="true()"/>
380 </xsl:apply-templates>
381 </xsl:when>
382 <xsl:otherwise>
383 </xsl:otherwise>
384 </xsl:choose>
385
386 <xsl:text>co</xsl:text>
387 <xsl:number level="any" format="01" from="book"/>
388 <xsl:if test="not($recursive)">
389 <xsl:value-of select="$html.ext"/>
390 </xsl:if>
391 </xsl:when>
392
393 <xsl:when test="self::sect1
394 or self::sect2
395 or self::sect3
396 or self::sect4
397 or self::sect5
398 or self::section">
399 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
400 <xsl:with-param name="recursive" select="true()"/>
401 </xsl:apply-templates>
402 <xsl:text>s</xsl:text>
403 <xsl:number format="01"/>
404 <xsl:if test="not($recursive)">
405 <xsl:value-of select="$html.ext"/>
406 </xsl:if>
407 </xsl:when>
408
409 <xsl:when test="self::bibliography">
410 <xsl:choose>
411 <xsl:when test="/set">
412 <!-- in a set, make sure we inherit the right book info... -->
413 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
414 <xsl:with-param name="recursive" select="true()"/>
415 </xsl:apply-templates>
416 </xsl:when>
417 <xsl:otherwise>
418 </xsl:otherwise>
419 </xsl:choose>
420
421 <xsl:text>bi</xsl:text>
422 <xsl:number level="any" format="01" from="book"/>
423 <xsl:if test="not($recursive)">
424 <xsl:value-of select="$html.ext"/>
425 </xsl:if>
426 </xsl:when>
427
428 <xsl:when test="self::glossary">
429 <xsl:choose>
430 <xsl:when test="/set">
431 <!-- in a set, make sure we inherit the right book info... -->
432 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
433 <xsl:with-param name="recursive" select="true()"/>
434 </xsl:apply-templates>
435 </xsl:when>
436 <xsl:otherwise>
437 </xsl:otherwise>
438 </xsl:choose>
439
440 <xsl:text>go</xsl:text>
441 <xsl:number level="any" format="01" from="book"/>
442 <xsl:if test="not($recursive)">
443 <xsl:value-of select="$html.ext"/>
444 </xsl:if>
445 </xsl:when>
446
447 <xsl:when test="self::index">
448 <xsl:choose>
449 <xsl:when test="/set">
450 <!-- in a set, make sure we inherit the right book info... -->
451 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
452 <xsl:with-param name="recursive" select="true()"/>
453 </xsl:apply-templates>
454 </xsl:when>
455 <xsl:otherwise>
456 </xsl:otherwise>
457 </xsl:choose>
458
459 <xsl:text>ix</xsl:text>
460 <xsl:number level="any" format="01" from="book"/>
461 <xsl:if test="not($recursive)">
462 <xsl:value-of select="$html.ext"/>
463 </xsl:if>
464 </xsl:when>
465
466 <xsl:when test="self::setindex">
467 <xsl:text>si</xsl:text>
468 <xsl:number level="any" format="01" from="set"/>
469 <xsl:if test="not($recursive)">
470 <xsl:value-of select="$html.ext"/>
471 </xsl:if>
472 </xsl:when>
473
474 <xsl:otherwise>
475 <xsl:text>chunk-filename-error-</xsl:text>
476 <xsl:value-of select="name(.)"/>
477 <xsl:number level="any" format="01" from="set"/>
478 <xsl:if test="not($recursive)">
479 <xsl:value-of select="$html.ext"/>
480 </xsl:if>
481 </xsl:otherwise>
482 </xsl:choose>
483</xsl:template>
484
485<!-- ==================================================================== -->
486
487<xsl:template name="href.target.uri">
488 <xsl:param name="object" select="."/>
489 <xsl:variable name="ischunk">
490 <xsl:call-template name="chunk">
491 <xsl:with-param name="node" select="$object"/>
492 </xsl:call-template>
493 </xsl:variable>
494
495 <xsl:apply-templates mode="chunk-filename" select="$object"/>
496
497 <xsl:if test="$ischunk='0'">
498 <xsl:text>#</xsl:text>
499 <xsl:call-template name="object.id">
500 <xsl:with-param name="object" select="$object"/>
501 </xsl:call-template>
502 </xsl:if>
503</xsl:template>
504
505<xsl:template name="href.target">
506 <xsl:param name="context" select="."/>
507 <xsl:param name="object" select="."/>
508
509 <xsl:variable name="href.to.uri">
510 <xsl:call-template name="href.target.uri">
511 <xsl:with-param name="object" select="$object"/>
512 </xsl:call-template>
513 </xsl:variable>
514
515 <xsl:variable name="href.from.uri">
516 <xsl:call-template name="href.target.uri">
517 <xsl:with-param name="object" select="$context"/>
518 </xsl:call-template>
519 </xsl:variable>
520
521 <!--
522 <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message>
523 <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message>
524 -->
525
526 <xsl:variable name="href.to">
527 <xsl:call-template name="trim.common.uri.paths">
528 <xsl:with-param name="uriA" select="$href.to.uri"/>
529 <xsl:with-param name="uriB" select="$href.from.uri"/>
530 <xsl:with-param name="return" select="'A'"/>
531 </xsl:call-template>
532 </xsl:variable>
533
534 <xsl:variable name="href.from">
535 <xsl:call-template name="trim.common.uri.paths">
536 <xsl:with-param name="uriA" select="$href.to.uri"/>
537 <xsl:with-param name="uriB" select="$href.from.uri"/>
538 <xsl:with-param name="return" select="'B'"/>
539 </xsl:call-template>
540 </xsl:variable>
541
542 <xsl:variable name="depth">
543 <xsl:call-template name="count.uri.path.depth">
544 <xsl:with-param name="filename" select="$href.from"/>
545 </xsl:call-template>
546 </xsl:variable>
547
548 <xsl:variable name="href">
549 <xsl:call-template name="copy-string">
550 <xsl:with-param name="string" select="'../'"/>
551 <xsl:with-param name="count" select="$depth"/>
552 </xsl:call-template>
553 <xsl:value-of select="$href.to"/>
554 </xsl:variable>
555
556 <!--
557 <xsl:message>
558 <xsl:text>In </xsl:text>
559 <xsl:value-of select="name(.)"/>
560 <xsl:text> (</xsl:text>
561 <xsl:value-of select="$href.from"/>
562 <xsl:text>,</xsl:text>
563 <xsl:value-of select="$depth"/>
564 <xsl:text>) </xsl:text>
565 <xsl:value-of select="name($object)"/>
566 <xsl:text> href=</xsl:text>
567 <xsl:value-of select="$href"/>
568 </xsl:message>
569 -->
570
571 <xsl:value-of select="$href"/>
572</xsl:template>
573
574<!-- ==================================================================== -->
575
576<xsl:template name="html.head">
577 <xsl:param name="prev" select="/foo"/>
578 <xsl:param name="next" select="/foo"/>
579 <xsl:variable name="this" select="."/>
580 <xsl:variable name="home" select="/*[1]"/>
581 <xsl:variable name="up" select="parent::*"/>
582
583 <head>
584 <xsl:call-template name="system.head.content"/>
585 <xsl:call-template name="head.content"/>
586
587 <xsl:if test="$home">
588 <link rel="start">
589 <xsl:attribute name="href">
590 <xsl:call-template name="href.target">
591 <xsl:with-param name="object" select="$home"/>
592 </xsl:call-template>
593 </xsl:attribute>
594 <xsl:attribute name="title">
595 <xsl:apply-templates select="$home"
596 mode="object.title.markup.textonly"/>
597 </xsl:attribute>
598 </link>
599 </xsl:if>
600
601 <xsl:if test="$up">
602 <link rel="up">
603 <xsl:attribute name="href">
604 <xsl:call-template name="href.target">
605 <xsl:with-param name="object" select="$up"/>
606 </xsl:call-template>
607 </xsl:attribute>
608 <xsl:attribute name="title">
609 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
610 </xsl:attribute>
611 </link>
612 </xsl:if>
613
614 <xsl:if test="$prev">
615 <link rel="prev">
616 <xsl:attribute name="href">
617 <xsl:call-template name="href.target">
618 <xsl:with-param name="object" select="$prev"/>
619 </xsl:call-template>
620 </xsl:attribute>
621 <xsl:attribute name="title">
622 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
623 </xsl:attribute>
624 </link>
625 </xsl:if>
626
627 <xsl:if test="$next">
628 <link rel="next">
629 <xsl:attribute name="href">
630 <xsl:call-template name="href.target">
631 <xsl:with-param name="object" select="$next"/>
632 </xsl:call-template>
633 </xsl:attribute>
634 <xsl:attribute name="title">
635 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
636 </xsl:attribute>
637 </link>
638 </xsl:if>
639
640 <xsl:if test="$html.extra.head.links != 0">
641 <xsl:for-each select="//part
642 |//reference
643 |//preface
644 |//chapter
645 |//article
646 |//refentry
647 |//appendix[not(parent::article)]|appendix
648 |//glossary[not(parent::article)]|glossary
649 |//index[not(parent::article)]|index">
650 <link rel="{local-name(.)}">
651 <xsl:attribute name="href">
652 <xsl:call-template name="href.target">
653 <xsl:with-param name="context" select="$this"/>
654 <xsl:with-param name="object" select="."/>
655 </xsl:call-template>
656 </xsl:attribute>
657 <xsl:attribute name="title">
658 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
659 </xsl:attribute>
660 </link>
661 </xsl:for-each>
662
663 <xsl:for-each select="section|sect1|refsection|refsect1">
664 <link>
665 <xsl:attribute name="rel">
666 <xsl:choose>
667 <xsl:when test="local-name($this) = 'section'
668 or local-name($this) = 'refsection'">
669 <xsl:value-of select="'subsection'"/>
670 </xsl:when>
671 <xsl:otherwise>
672 <xsl:value-of select="'section'"/>
673 </xsl:otherwise>
674 </xsl:choose>
675 </xsl:attribute>
676 <xsl:attribute name="href">
677 <xsl:call-template name="href.target">
678 <xsl:with-param name="context" select="$this"/>
679 <xsl:with-param name="object" select="."/>
680 </xsl:call-template>
681 </xsl:attribute>
682 <xsl:attribute name="title">
683 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
684 </xsl:attribute>
685 </link>
686 </xsl:for-each>
687
688 <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
689 <link rel="subsection">
690 <xsl:attribute name="href">
691 <xsl:call-template name="href.target">
692 <xsl:with-param name="context" select="$this"/>
693 <xsl:with-param name="object" select="."/>
694 </xsl:call-template>
695 </xsl:attribute>
696 <xsl:attribute name="title">
697 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
698 </xsl:attribute>
699 </link>
700 </xsl:for-each>
701 </xsl:if>
702
703 <xsl:call-template name="user.head.content"/>
704 </head>
705</xsl:template>
706
707<!-- ==================================================================== -->
708
709<xsl:template name="header.navigation">
710 <xsl:param name="prev" select="/foo"/>
711 <xsl:param name="next" select="/foo"/>
712 <xsl:param name="nav.context"/>
713
714 <xsl:variable name="home" select="/*[1]"/>
715 <xsl:variable name="up" select="parent::*"/>
716
717 <xsl:variable name="row1" select="$navig.showtitles != 0"/>
718 <xsl:variable name="row2" select="count($prev) &gt; 0
719 or (count($up) &gt; 0
720 and generate-id($up) != generate-id($home)
721 and $navig.showtitles != 0)
722 or count($next) &gt; 0"/>
723
724 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
725 <div class="navheader">
726 <xsl:if test="$row1 or $row2">
727 <table width="100%" summary="Navigation header">
728 <xsl:if test="$row1">
729 <tr>
730 <th colspan="3" align="center">
731 <xsl:apply-templates select="." mode="object.title.markup"/>
732 </th>
733 </tr>
734 </xsl:if>
735
736 <xsl:if test="$row2">
737 <tr>
738 <td width="20%" align="left">
739 <xsl:if test="count($prev)>0">
740 <a accesskey="p">
741 <xsl:attribute name="href">
742 <xsl:call-template name="href.target">
743 <xsl:with-param name="object" select="$prev"/>
744 </xsl:call-template>
745 </xsl:attribute>
746 <xsl:call-template name="navig.content">
747 <xsl:with-param name="direction" select="'prev'"/>
748 </xsl:call-template>
749 </a>
750 </xsl:if>
751 <xsl:text>&#160;</xsl:text>
752 </td>
753 <th width="60%" align="center">
754 <xsl:choose>
755 <xsl:when test="count($up) > 0
756 and generate-id($up) != generate-id($home)
757 and $navig.showtitles != 0">
758 <xsl:apply-templates select="$up" mode="object.title.markup"/>
759 </xsl:when>
760 <xsl:otherwise>&#160;</xsl:otherwise>
761 </xsl:choose>
762 </th>
763 <td width="20%" align="right">
764 <xsl:text>&#160;</xsl:text>
765 <xsl:if test="count($next)>0">
766 <a accesskey="n">
767 <xsl:attribute name="href">
768 <xsl:call-template name="href.target">
769 <xsl:with-param name="object" select="$next"/>
770 </xsl:call-template>
771 </xsl:attribute>
772 <xsl:call-template name="navig.content">
773 <xsl:with-param name="direction" select="'next'"/>
774 </xsl:call-template>
775 </a>
776 </xsl:if>
777 </td>
778 </tr>
779 </xsl:if>
780 </table>
781 </xsl:if>
782 <xsl:if test="$header.rule != 0">
783 <hr/>
784 </xsl:if>
785 </div>
786 </xsl:if>
787</xsl:template>
788
789<!-- ==================================================================== -->
790
791<xsl:template name="footer.navigation">
792 <xsl:param name="prev" select="/foo"/>
793 <xsl:param name="next" select="/foo"/>
794 <xsl:param name="nav.context"/>
795
796 <xsl:variable name="home" select="/*[1]"/>
797 <xsl:variable name="up" select="parent::*"/>
798
799 <xsl:variable name="row1" select="count($prev) &gt; 0
800 or count($up) &gt; 0
801 or count($next) &gt; 0"/>
802
803 <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
804 or (generate-id($home) != generate-id(.)
805 or $nav.context = 'toc')
806 or ($chunk.tocs.and.lots != 0
807 and $nav.context != 'toc')
808 or ($next and $navig.showtitles != 0)"/>
809
810 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
811 <div class="navfooter">
812 <xsl:if test="$footer.rule != 0">
813 <hr/>
814 </xsl:if>
815
816 <xsl:if test="$row1 or $row2">
817 <table width="100%" summary="Navigation footer">
818 <xsl:if test="$row1">
819 <tr>
820 <td width="40%" align="left">
821 <xsl:if test="count($prev)>0">
822 <a accesskey="p">
823 <xsl:attribute name="href">
824 <xsl:call-template name="href.target">
825 <xsl:with-param name="object" select="$prev"/>
826 </xsl:call-template>
827 </xsl:attribute>
828 <xsl:call-template name="navig.content">
829 <xsl:with-param name="direction" select="'prev'"/>
830 </xsl:call-template>
831 </a>
832 </xsl:if>
833 <xsl:text>&#160;</xsl:text>
834 </td>
835 <td width="20%" align="center">
836 <xsl:choose>
837 <xsl:when test="count($up)&gt;0
838 and generate-id($up) != generate-id($home)">
839 <a accesskey="u">
840 <xsl:attribute name="href">
841 <xsl:call-template name="href.target">
842 <xsl:with-param name="object" select="$up"/>
843 </xsl:call-template>
844 </xsl:attribute>
845 <xsl:call-template name="navig.content">
846 <xsl:with-param name="direction" select="'up'"/>
847 </xsl:call-template>
848 </a>
849 </xsl:when>
850 <xsl:otherwise>&#160;</xsl:otherwise>
851 </xsl:choose>
852 </td>
853 <td width="40%" align="right">
854 <xsl:text>&#160;</xsl:text>
855 <xsl:if test="count($next)>0">
856 <a accesskey="n">
857 <xsl:attribute name="href">
858 <xsl:call-template name="href.target">
859 <xsl:with-param name="object" select="$next"/>
860 </xsl:call-template>
861 </xsl:attribute>
862 <xsl:call-template name="navig.content">
863 <xsl:with-param name="direction" select="'next'"/>
864 </xsl:call-template>
865 </a>
866 </xsl:if>
867 </td>
868 </tr>
869 </xsl:if>
870
871 <xsl:if test="$row2">
872 <tr>
873 <td width="40%" align="left" valign="top">
874 <xsl:if test="$navig.showtitles != 0">
875 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
876 </xsl:if>
877 <xsl:text>&#160;</xsl:text>
878 </td>
879 <td width="20%" align="center">
880 <xsl:choose>
881 <xsl:when test="$home != . or $nav.context = 'toc'">
882 <a accesskey="h">
883 <xsl:attribute name="href">
884 <xsl:call-template name="href.target">
885 <xsl:with-param name="object" select="$home"/>
886 </xsl:call-template>
887 </xsl:attribute>
888 <xsl:call-template name="navig.content">
889 <xsl:with-param name="direction" select="'home'"/>
890 </xsl:call-template>
891 </a>
892 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
893 <xsl:text>&#160;|&#160;</xsl:text>
894 </xsl:if>
895 </xsl:when>
896 <xsl:otherwise>&#160;</xsl:otherwise>
897 </xsl:choose>
898
899 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
900 <a accesskey="t">
901 <xsl:attribute name="href">
902 <xsl:apply-templates select="/*[1]"
903 mode="recursive-chunk-filename">
904 <xsl:with-param name="recursive" select="true()"/>
905 </xsl:apply-templates>
906 <xsl:text>-toc</xsl:text>
907 <xsl:value-of select="$html.ext"/>
908 </xsl:attribute>
909 <xsl:call-template name="gentext">
910 <xsl:with-param name="key" select="'nav-toc'"/>
911 </xsl:call-template>
912 </a>
913 </xsl:if>
914 </td>
915 <td width="40%" align="right" valign="top">
916 <xsl:text>&#160;</xsl:text>
917 <xsl:if test="$navig.showtitles != 0">
918 <xsl:apply-templates select="$next" mode="object.title.markup"/>
919 </xsl:if>
920 </td>
921 </tr>
922 </xsl:if>
923 </table>
924 </xsl:if>
925 </div>
926 </xsl:if>
927</xsl:template>
928
929<!-- ==================================================================== -->
930
931<xsl:template name="navig.content">
932 <xsl:param name="direction" select="next"/>
933 <xsl:variable name="navtext">
934 <xsl:choose>
935 <xsl:when test="$direction = 'prev'">
936 <xsl:call-template name="gentext.nav.prev"/>
937 </xsl:when>
938 <xsl:when test="$direction = 'next'">
939 <xsl:call-template name="gentext.nav.next"/>
940 </xsl:when>
941 <xsl:when test="$direction = 'up'">
942 <xsl:call-template name="gentext.nav.up"/>
943 </xsl:when>
944 <xsl:when test="$direction = 'home'">
945 <xsl:call-template name="gentext.nav.home"/>
946 </xsl:when>
947 <xsl:otherwise>
948 <xsl:text>xxx</xsl:text>
949 </xsl:otherwise>
950 </xsl:choose>
951 </xsl:variable>
952
953 <xsl:choose>
954 <xsl:when test="$navig.graphics != 0">
955 <img>
956 <xsl:attribute name="src">
957 <xsl:value-of select="$navig.graphics.path"/>
958 <xsl:value-of select="$direction"/>
959 <xsl:value-of select="$navig.graphics.extension"/>
960 </xsl:attribute>
961 <xsl:attribute name="alt">
962 <xsl:value-of select="$navtext"/>
963 </xsl:attribute>
964 </img>
965 </xsl:when>
966 <xsl:otherwise>
967 <xsl:value-of select="$navtext"/>
968 </xsl:otherwise>
969 </xsl:choose>
970</xsl:template>
971
972<!-- ==================================================================== -->
973
974<xsl:template match="processing-instruction('dbhtml')">
975 <!-- nop -->
976</xsl:template>
977
978<!-- ==================================================================== -->
979
980<xsl:template name="chunk-element-content">
981 <xsl:param name="prev"/>
982 <xsl:param name="next"/>
983 <xsl:param name="nav.context"/>
984 <xsl:param name="content">
985 <xsl:apply-imports/>
986 </xsl:param>
987
988 <xsl:call-template name="user.preroot"/>
989
990 <html>
991 <xsl:call-template name="html.head">
992 <xsl:with-param name="prev" select="$prev"/>
993 <xsl:with-param name="next" select="$next"/>
994 </xsl:call-template>
995
996 <body>
997 <xsl:call-template name="body.attributes"/>
998 <xsl:call-template name="user.header.navigation"/>
999
1000 <xsl:call-template name="header.navigation">
1001 <xsl:with-param name="prev" select="$prev"/>
1002 <xsl:with-param name="next" select="$next"/>
1003 <xsl:with-param name="nav.context" select="$nav.context"/>
1004 </xsl:call-template>
1005
1006 <xsl:call-template name="user.header.content"/>
1007
1008 <xsl:copy-of select="$content"/>
1009
1010 <xsl:call-template name="user.footer.content"/>
1011
1012 <xsl:call-template name="footer.navigation">
1013 <xsl:with-param name="prev" select="$prev"/>
1014 <xsl:with-param name="next" select="$next"/>
1015 <xsl:with-param name="nav.context" select="$nav.context"/>
1016 </xsl:call-template>
1017
1018 <xsl:call-template name="user.footer.navigation"/>
1019 </body>
1020 </html>
1021</xsl:template>
1022
1023</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.