~ubuntu-branches/ubuntu/raring/libjboss-remoting-java/raring

« back to all changes in this revision

Viewing changes to docs/guide/support/support/docbook-xsl/html/chunk-common.xsl

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

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