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 6403 2006-11-12 08:23:54Z bobstayton $ |
---|
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="../@chunked = 0">0</xsl:when> |
---|
64 | <xsl:when test="not($node/parent::*)">1</xsl:when> |
---|
65 | |
---|
66 | <xsl:when test="local-name($node) = 'sect1' |
---|
67 | and $chunk.section.depth >= 1 |
---|
68 | and ($chunk.first.sections != 0 |
---|
69 | or count($node/preceding-sibling::sect1) > 0)"> |
---|
70 | <xsl:text>1</xsl:text> |
---|
71 | </xsl:when> |
---|
72 | <xsl:when test="local-name($node) = 'sect2' |
---|
73 | and $chunk.section.depth >= 2 |
---|
74 | and ($chunk.first.sections != 0 |
---|
75 | or count($node/preceding-sibling::sect2) > 0)"> |
---|
76 | <xsl:call-template name="chunk"> |
---|
77 | <xsl:with-param name="node" select="$node/parent::*"/> |
---|
78 | </xsl:call-template> |
---|
79 | </xsl:when> |
---|
80 | <xsl:when test="local-name($node) = 'sect3' |
---|
81 | and $chunk.section.depth >= 3 |
---|
82 | and ($chunk.first.sections != 0 |
---|
83 | or count($node/preceding-sibling::sect3) > 0)"> |
---|
84 | <xsl:call-template name="chunk"> |
---|
85 | <xsl:with-param name="node" select="$node/parent::*"/> |
---|
86 | </xsl:call-template> |
---|
87 | </xsl:when> |
---|
88 | <xsl:when test="local-name($node) = 'sect4' |
---|
89 | and $chunk.section.depth >= 4 |
---|
90 | and ($chunk.first.sections != 0 |
---|
91 | or count($node/preceding-sibling::sect4) > 0)"> |
---|
92 | <xsl:call-template name="chunk"> |
---|
93 | <xsl:with-param name="node" select="$node/parent::*"/> |
---|
94 | </xsl:call-template> |
---|
95 | </xsl:when> |
---|
96 | <xsl:when test="local-name($node) = 'sect5' |
---|
97 | and $chunk.section.depth >= 5 |
---|
98 | and ($chunk.first.sections != 0 |
---|
99 | or count($node/preceding-sibling::sect5) > 0)"> |
---|
100 | <xsl:call-template name="chunk"> |
---|
101 | <xsl:with-param name="node" select="$node/parent::*"/> |
---|
102 | </xsl:call-template> |
---|
103 | </xsl:when> |
---|
104 | <xsl:when test="local-name($node) = 'section' |
---|
105 | and $chunk.section.depth >= count($node/ancestor::section)+1 |
---|
106 | and ($chunk.first.sections != 0 |
---|
107 | or count($node/preceding-sibling::section) > 0)"> |
---|
108 | <xsl:call-template name="chunk"> |
---|
109 | <xsl:with-param name="node" select="$node/parent::*"/> |
---|
110 | </xsl:call-template> |
---|
111 | </xsl:when> |
---|
112 | |
---|
113 | <xsl:when test="local-name($node)='preface'">1</xsl:when> |
---|
114 | <xsl:when test="local-name($node)='chapter'">1</xsl:when> |
---|
115 | <xsl:when test="local-name($node)='appendix'">1</xsl:when> |
---|
116 | <xsl:when test="local-name($node)='article'">1</xsl:when> |
---|
117 | <xsl:when test="local-name($node)='part'">1</xsl:when> |
---|
118 | <xsl:when test="local-name($node)='reference'">1</xsl:when> |
---|
119 | <xsl:when test="local-name($node)='refentry'">1</xsl:when> |
---|
120 | <xsl:when test="local-name($node)='index' and ($generate.index != 0 or count($node/*) > 0) |
---|
121 | and (local-name($node/parent::*) = 'article' |
---|
122 | or local-name($node/parent::*) = 'book' |
---|
123 | or local-name($node/parent::*) = 'part' |
---|
124 | )">1</xsl:when> |
---|
125 | <xsl:when test="local-name($node)='bibliography' |
---|
126 | and (local-name($node/parent::*) = 'article' |
---|
127 | or local-name($node/parent::*) = 'book' |
---|
128 | or local-name($node/parent::*) = 'part' |
---|
129 | )">1</xsl:when> |
---|
130 | <xsl:when test="local-name($node)='glossary' |
---|
131 | and (local-name($node/parent::*) = 'article' |
---|
132 | or local-name($node/parent::*) = 'book' |
---|
133 | or local-name($node/parent::*) = 'part' |
---|
134 | )">1</xsl:when> |
---|
135 | <xsl:when test="local-name($node)='colophon'">1</xsl:when> |
---|
136 | <xsl:when test="local-name($node)='book'">1</xsl:when> |
---|
137 | <xsl:when test="local-name($node)='set'">1</xsl:when> |
---|
138 | <xsl:when test="local-name($node)='setindex'">1</xsl:when> |
---|
139 | <xsl:when test="local-name($node)='legalnotice' |
---|
140 | and $generate.legalnotice.link != 0">1</xsl:when> |
---|
141 | <xsl:otherwise>0</xsl:otherwise> |
---|
142 | </xsl:choose> |
---|
143 | </xsl:template> |
---|
144 | |
---|
145 | <!-- ==================================================================== --> |
---|
146 | |
---|
147 | <xsl:template match="*" mode="chunk-filename"> |
---|
148 | <!-- returns the filename of a chunk --> |
---|
149 | <xsl:variable name="ischunk"> |
---|
150 | <xsl:call-template name="chunk"/> |
---|
151 | </xsl:variable> |
---|
152 | |
---|
153 | <xsl:variable name="fn"> |
---|
154 | <xsl:apply-templates select="." mode="recursive-chunk-filename"/> |
---|
155 | </xsl:variable> |
---|
156 | |
---|
157 | <!-- |
---|
158 | <xsl:message> |
---|
159 | <xsl:value-of select="$ischunk"/> |
---|
160 | <xsl:text> (</xsl:text> |
---|
161 | <xsl:value-of select="local-name(.)"/> |
---|
162 | <xsl:text>) </xsl:text> |
---|
163 | <xsl:value-of select="$fn"/> |
---|
164 | <xsl:text>, </xsl:text> |
---|
165 | <xsl:call-template name="dbhtml-dir"/> |
---|
166 | </xsl:message> |
---|
167 | --> |
---|
168 | |
---|
169 | <!-- 2003-11-25 by ndw: |
---|
170 | The following test used to read test="$ischunk != 0 and $fn != ''" |
---|
171 | I've removed the ischunk part of the test so that href.to.uri and |
---|
172 | href.from.uri will be fully qualified even if the source or target |
---|
173 | isn't a chunk. I *think* that if $fn != '' then it's appropriate |
---|
174 | to put the directory on the front, even if the element isn't a |
---|
175 | chunk. I could be wrong. --> |
---|
176 | |
---|
177 | <xsl:if test="$fn != ''"> |
---|
178 | <xsl:call-template name="dbhtml-dir"/> |
---|
179 | </xsl:if> |
---|
180 | |
---|
181 | <xsl:value-of select="$fn"/> |
---|
182 | <!-- You can't add the html.ext here because dbhtml filename= may already --> |
---|
183 | <!-- have added it. It really does have to be handled in the recursive template --> |
---|
184 | </xsl:template> |
---|
185 | |
---|
186 | <xsl:template match="*" mode="recursive-chunk-filename"> |
---|
187 | <xsl:param name="recursive" select="false()"/> |
---|
188 | |
---|
189 | <!-- returns the filename of a chunk --> |
---|
190 | <xsl:variable name="ischunk"> |
---|
191 | <xsl:call-template name="chunk"/> |
---|
192 | </xsl:variable> |
---|
193 | |
---|
194 | <xsl:variable name="dbhtml-filename"> |
---|
195 | <xsl:call-template name="dbhtml-filename"/> |
---|
196 | </xsl:variable> |
---|
197 | |
---|
198 | <xsl:variable name="filename"> |
---|
199 | <xsl:choose> |
---|
200 | <xsl:when test="$dbhtml-filename != ''"> |
---|
201 | <xsl:value-of select="$dbhtml-filename"/> |
---|
202 | </xsl:when> |
---|
203 | <!-- if this is the root element, use the root.filename --> |
---|
204 | <xsl:when test="not(parent::*) and $root.filename != ''"> |
---|
205 | <xsl:value-of select="$root.filename"/> |
---|
206 | <xsl:value-of select="$html.ext"/> |
---|
207 | </xsl:when> |
---|
208 | <!-- Special case --> |
---|
209 | <xsl:when test="self::legalnotice and $generate.legalnotice.link != 0"> |
---|
210 | <xsl:variable name="id"> |
---|
211 | <xsl:call-template name="object.id"/> |
---|
212 | </xsl:variable> |
---|
213 | <xsl:value-of select="concat('ln-',$id,$html.ext)"/> |
---|
214 | </xsl:when> |
---|
215 | <!-- if there's no dbhtml filename, and if we're to use IDs as --> |
---|
216 | <!-- filenames, then use the ID to generate the filename. --> |
---|
217 | <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0"> |
---|
218 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
219 | <xsl:value-of select="$html.ext"/> |
---|
220 | </xsl:when> |
---|
221 | <xsl:otherwise></xsl:otherwise> |
---|
222 | </xsl:choose> |
---|
223 | </xsl:variable> |
---|
224 | |
---|
225 | <xsl:choose> |
---|
226 | <xsl:when test="$ischunk='0'"> |
---|
227 | <!-- if called on something that isn't a chunk, walk up... --> |
---|
228 | <xsl:choose> |
---|
229 | <xsl:when test="count(parent::*)>0"> |
---|
230 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
231 | <xsl:with-param name="recursive" select="$recursive"/> |
---|
232 | </xsl:apply-templates> |
---|
233 | </xsl:when> |
---|
234 | <!-- unless there is no up, in which case return "" --> |
---|
235 | <xsl:otherwise></xsl:otherwise> |
---|
236 | </xsl:choose> |
---|
237 | </xsl:when> |
---|
238 | |
---|
239 | <xsl:when test="not($recursive) and $filename != ''"> |
---|
240 | <!-- if this chunk has an explicit name, use it --> |
---|
241 | <xsl:value-of select="$filename"/> |
---|
242 | </xsl:when> |
---|
243 | |
---|
244 | <xsl:when test="self::set"> |
---|
245 | <xsl:value-of select="$root.filename"/> |
---|
246 | <xsl:if test="not($recursive)"> |
---|
247 | <xsl:value-of select="$html.ext"/> |
---|
248 | </xsl:if> |
---|
249 | </xsl:when> |
---|
250 | |
---|
251 | <xsl:when test="self::book"> |
---|
252 | <xsl:text>bk</xsl:text> |
---|
253 | <xsl:number level="any" format="01"/> |
---|
254 | <xsl:if test="not($recursive)"> |
---|
255 | <xsl:value-of select="$html.ext"/> |
---|
256 | </xsl:if> |
---|
257 | </xsl:when> |
---|
258 | |
---|
259 | <xsl:when test="self::article"> |
---|
260 | <xsl:if test="/set"> |
---|
261 | <!-- in a set, make sure we inherit the right book info... --> |
---|
262 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
263 | <xsl:with-param name="recursive" select="true()"/> |
---|
264 | </xsl:apply-templates> |
---|
265 | </xsl:if> |
---|
266 | |
---|
267 | <xsl:text>ar</xsl:text> |
---|
268 | <xsl:number level="any" format="01" from="book"/> |
---|
269 | <xsl:if test="not($recursive)"> |
---|
270 | <xsl:value-of select="$html.ext"/> |
---|
271 | </xsl:if> |
---|
272 | </xsl:when> |
---|
273 | |
---|
274 | <xsl:when test="self::preface"> |
---|
275 | <xsl:if test="/set"> |
---|
276 | <!-- in a set, make sure we inherit the right book info... --> |
---|
277 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
278 | <xsl:with-param name="recursive" select="true()"/> |
---|
279 | </xsl:apply-templates> |
---|
280 | </xsl:if> |
---|
281 | |
---|
282 | <xsl:text>pr</xsl:text> |
---|
283 | <xsl:number level="any" format="01" from="book"/> |
---|
284 | <xsl:if test="not($recursive)"> |
---|
285 | <xsl:value-of select="$html.ext"/> |
---|
286 | </xsl:if> |
---|
287 | </xsl:when> |
---|
288 | |
---|
289 | <xsl:when test="self::chapter"> |
---|
290 | <xsl:if test="/set"> |
---|
291 | <!-- in a set, make sure we inherit the right book info... --> |
---|
292 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
293 | <xsl:with-param name="recursive" select="true()"/> |
---|
294 | </xsl:apply-templates> |
---|
295 | </xsl:if> |
---|
296 | |
---|
297 | <xsl:text>ch</xsl:text> |
---|
298 | <xsl:number level="any" format="01" from="book"/> |
---|
299 | <xsl:if test="not($recursive)"> |
---|
300 | <xsl:value-of select="$html.ext"/> |
---|
301 | </xsl:if> |
---|
302 | </xsl:when> |
---|
303 | |
---|
304 | <xsl:when test="self::appendix"> |
---|
305 | <xsl:if 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:if> |
---|
311 | |
---|
312 | <xsl:text>ap</xsl:text> |
---|
313 | <xsl:number level="any" format="a" from="book"/> |
---|
314 | <xsl:if test="not($recursive)"> |
---|
315 | <xsl:value-of select="$html.ext"/> |
---|
316 | </xsl:if> |
---|
317 | </xsl:when> |
---|
318 | |
---|
319 | <xsl:when test="self::part"> |
---|
320 | <xsl:choose> |
---|
321 | <xsl:when test="/set"> |
---|
322 | <!-- in a set, make sure we inherit the right book info... --> |
---|
323 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
324 | <xsl:with-param name="recursive" select="true()"/> |
---|
325 | </xsl:apply-templates> |
---|
326 | </xsl:when> |
---|
327 | <xsl:otherwise> |
---|
328 | </xsl:otherwise> |
---|
329 | </xsl:choose> |
---|
330 | |
---|
331 | <xsl:text>pt</xsl:text> |
---|
332 | <xsl:number level="any" format="01" from="book"/> |
---|
333 | <xsl:if test="not($recursive)"> |
---|
334 | <xsl:value-of select="$html.ext"/> |
---|
335 | </xsl:if> |
---|
336 | </xsl:when> |
---|
337 | |
---|
338 | <xsl:when test="self::reference"> |
---|
339 | <xsl:choose> |
---|
340 | <xsl:when test="/set"> |
---|
341 | <!-- in a set, make sure we inherit the right book info... --> |
---|
342 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
343 | <xsl:with-param name="recursive" select="true()"/> |
---|
344 | </xsl:apply-templates> |
---|
345 | </xsl:when> |
---|
346 | <xsl:otherwise> |
---|
347 | </xsl:otherwise> |
---|
348 | </xsl:choose> |
---|
349 | |
---|
350 | <xsl:text>rn</xsl:text> |
---|
351 | <xsl:number level="any" format="01" from="book"/> |
---|
352 | <xsl:if test="not($recursive)"> |
---|
353 | <xsl:value-of select="$html.ext"/> |
---|
354 | </xsl:if> |
---|
355 | </xsl:when> |
---|
356 | |
---|
357 | <xsl:when test="self::refentry"> |
---|
358 | <xsl:choose> |
---|
359 | <xsl:when test="parent::reference"> |
---|
360 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
361 | <xsl:with-param name="recursive" select="true()"/> |
---|
362 | </xsl:apply-templates> |
---|
363 | </xsl:when> |
---|
364 | <xsl:otherwise> |
---|
365 | </xsl:otherwise> |
---|
366 | </xsl:choose> |
---|
367 | |
---|
368 | <xsl:text>re</xsl:text> |
---|
369 | <xsl:number level="any" format="01" from="book"/> |
---|
370 | <xsl:if test="not($recursive)"> |
---|
371 | <xsl:value-of select="$html.ext"/> |
---|
372 | </xsl:if> |
---|
373 | </xsl:when> |
---|
374 | |
---|
375 | <xsl:when test="self::colophon"> |
---|
376 | <xsl:choose> |
---|
377 | <xsl:when test="/set"> |
---|
378 | <!-- in a set, make sure we inherit the right book info... --> |
---|
379 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
380 | <xsl:with-param name="recursive" select="true()"/> |
---|
381 | </xsl:apply-templates> |
---|
382 | </xsl:when> |
---|
383 | <xsl:otherwise> |
---|
384 | </xsl:otherwise> |
---|
385 | </xsl:choose> |
---|
386 | |
---|
387 | <xsl:text>co</xsl:text> |
---|
388 | <xsl:number level="any" format="01" from="book"/> |
---|
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::sect1 |
---|
395 | or self::sect2 |
---|
396 | or self::sect3 |
---|
397 | or self::sect4 |
---|
398 | or self::sect5 |
---|
399 | or self::section"> |
---|
400 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
401 | <xsl:with-param name="recursive" select="true()"/> |
---|
402 | </xsl:apply-templates> |
---|
403 | <xsl:text>s</xsl:text> |
---|
404 | <xsl:number format="01"/> |
---|
405 | <xsl:if test="not($recursive)"> |
---|
406 | <xsl:value-of select="$html.ext"/> |
---|
407 | </xsl:if> |
---|
408 | </xsl:when> |
---|
409 | |
---|
410 | <xsl:when test="self::bibliography"> |
---|
411 | <xsl:choose> |
---|
412 | <xsl:when test="/set"> |
---|
413 | <!-- in a set, make sure we inherit the right book info... --> |
---|
414 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
415 | <xsl:with-param name="recursive" select="true()"/> |
---|
416 | </xsl:apply-templates> |
---|
417 | </xsl:when> |
---|
418 | <xsl:otherwise> |
---|
419 | </xsl:otherwise> |
---|
420 | </xsl:choose> |
---|
421 | |
---|
422 | <xsl:text>bi</xsl:text> |
---|
423 | <xsl:number level="any" format="01" from="book"/> |
---|
424 | <xsl:if test="not($recursive)"> |
---|
425 | <xsl:value-of select="$html.ext"/> |
---|
426 | </xsl:if> |
---|
427 | </xsl:when> |
---|
428 | |
---|
429 | <xsl:when test="self::glossary"> |
---|
430 | <xsl:choose> |
---|
431 | <xsl:when test="/set"> |
---|
432 | <!-- in a set, make sure we inherit the right book info... --> |
---|
433 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
434 | <xsl:with-param name="recursive" select="true()"/> |
---|
435 | </xsl:apply-templates> |
---|
436 | </xsl:when> |
---|
437 | <xsl:otherwise> |
---|
438 | </xsl:otherwise> |
---|
439 | </xsl:choose> |
---|
440 | |
---|
441 | <xsl:text>go</xsl:text> |
---|
442 | <xsl:number level="any" format="01" from="book"/> |
---|
443 | <xsl:if test="not($recursive)"> |
---|
444 | <xsl:value-of select="$html.ext"/> |
---|
445 | </xsl:if> |
---|
446 | </xsl:when> |
---|
447 | |
---|
448 | <xsl:when test="self::index"> |
---|
449 | <xsl:choose> |
---|
450 | <xsl:when test="/set"> |
---|
451 | <!-- in a set, make sure we inherit the right book info... --> |
---|
452 | <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> |
---|
453 | <xsl:with-param name="recursive" select="true()"/> |
---|
454 | </xsl:apply-templates> |
---|
455 | </xsl:when> |
---|
456 | <xsl:otherwise> |
---|
457 | </xsl:otherwise> |
---|
458 | </xsl:choose> |
---|
459 | |
---|
460 | <xsl:text>ix</xsl:text> |
---|
461 | <xsl:number level="any" format="01" from="book"/> |
---|
462 | <xsl:if test="not($recursive)"> |
---|
463 | <xsl:value-of select="$html.ext"/> |
---|
464 | </xsl:if> |
---|
465 | </xsl:when> |
---|
466 | |
---|
467 | <xsl:when test="self::setindex"> |
---|
468 | <xsl:text>si</xsl:text> |
---|
469 | <xsl:number level="any" format="01" from="set"/> |
---|
470 | <xsl:if test="not($recursive)"> |
---|
471 | <xsl:value-of select="$html.ext"/> |
---|
472 | </xsl:if> |
---|
473 | </xsl:when> |
---|
474 | |
---|
475 | <xsl:otherwise> |
---|
476 | <xsl:text>chunk-filename-error-</xsl:text> |
---|
477 | <xsl:value-of select="name(.)"/> |
---|
478 | <xsl:number level="any" format="01" from="set"/> |
---|
479 | <xsl:if test="not($recursive)"> |
---|
480 | <xsl:value-of select="$html.ext"/> |
---|
481 | </xsl:if> |
---|
482 | </xsl:otherwise> |
---|
483 | </xsl:choose> |
---|
484 | </xsl:template> |
---|
485 | |
---|
486 | <!-- ==================================================================== --> |
---|
487 | |
---|
488 | <xsl:template name="href.target.uri"> |
---|
489 | <xsl:param name="object" select="."/> |
---|
490 | <xsl:variable name="ischunk"> |
---|
491 | <xsl:call-template name="chunk" /> |
---|
492 | </xsl:variable> |
---|
493 | |
---|
494 | <xsl:apply-templates mode="chunk-filename" select="$object"/> |
---|
495 | |
---|
496 | <xsl:if test="$ischunk='0'"> |
---|
497 | <xsl:text>#</xsl:text> |
---|
498 | <xsl:call-template name="object.id"> |
---|
499 | <xsl:with-param name="object" select="$object"/> |
---|
500 | </xsl:call-template> |
---|
501 | </xsl:if> |
---|
502 | </xsl:template> |
---|
503 | |
---|
504 | <xsl:template name="href.target"> |
---|
505 | <xsl:param name="context" select="."/> |
---|
506 | <xsl:param name="object" select="."/> |
---|
507 | |
---|
508 | <xsl:variable name="href.to.uri"> |
---|
509 | <xsl:call-template name="href.target.uri"> |
---|
510 | <xsl:with-param name="object" select="$object"/> |
---|
511 | </xsl:call-template> |
---|
512 | </xsl:variable> |
---|
513 | |
---|
514 | <xsl:variable name="href.from.uri"> |
---|
515 | <xsl:call-template name="href.target.uri"> |
---|
516 | <xsl:with-param name="object" select="$context"/> |
---|
517 | </xsl:call-template> |
---|
518 | </xsl:variable> |
---|
519 | |
---|
520 | <!-- |
---|
521 | <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message> |
---|
522 | <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message> |
---|
523 | --> |
---|
524 | |
---|
525 | <xsl:variable name="href.to"> |
---|
526 | <xsl:call-template name="trim.common.uri.paths"> |
---|
527 | <xsl:with-param name="uriA" select="$href.to.uri"/> |
---|
528 | <xsl:with-param name="uriB" select="$href.from.uri"/> |
---|
529 | <xsl:with-param name="return" select="'A'"/> |
---|
530 | </xsl:call-template> |
---|
531 | </xsl:variable> |
---|
532 | |
---|
533 | <xsl:variable name="href.from"> |
---|
534 | <xsl:call-template name="trim.common.uri.paths"> |
---|
535 | <xsl:with-param name="uriA" select="$href.to.uri"/> |
---|
536 | <xsl:with-param name="uriB" select="$href.from.uri"/> |
---|
537 | <xsl:with-param name="return" select="'B'"/> |
---|
538 | </xsl:call-template> |
---|
539 | </xsl:variable> |
---|
540 | |
---|
541 | <xsl:variable name="depth"> |
---|
542 | <xsl:call-template name="count.uri.path.depth"> |
---|
543 | <xsl:with-param name="filename" select="$href.from"/> |
---|
544 | </xsl:call-template> |
---|
545 | </xsl:variable> |
---|
546 | |
---|
547 | <xsl:variable name="href"> |
---|
548 | <xsl:call-template name="copy-string"> |
---|
549 | <xsl:with-param name="string" select="'../'"/> |
---|
550 | <xsl:with-param name="count" select="$depth"/> |
---|
551 | </xsl:call-template> |
---|
552 | <xsl:value-of select="$href.to"/> |
---|
553 | </xsl:variable> |
---|
554 | |
---|
555 | <!-- |
---|
556 | <xsl:message> |
---|
557 | <xsl:text>In </xsl:text> |
---|
558 | <xsl:value-of select="name(.)"/> |
---|
559 | <xsl:text> (</xsl:text> |
---|
560 | <xsl:value-of select="$href.from"/> |
---|
561 | <xsl:text>,</xsl:text> |
---|
562 | <xsl:value-of select="$depth"/> |
---|
563 | <xsl:text>) </xsl:text> |
---|
564 | <xsl:value-of select="name($object)"/> |
---|
565 | <xsl:text> href=</xsl:text> |
---|
566 | <xsl:value-of select="$href"/> |
---|
567 | </xsl:message> |
---|
568 | --> |
---|
569 | |
---|
570 | <xsl:value-of select="$href"/> |
---|
571 | </xsl:template> |
---|
572 | |
---|
573 | <!-- Returns the complete olink href value if found --> |
---|
574 | <!-- Must take into account any dbhtml dir of the chunk containing the olink --> |
---|
575 | <xsl:template name="make.olink.href"> |
---|
576 | <xsl:param name="olink.key" select="''"/> |
---|
577 | <xsl:param name="target.database"/> |
---|
578 | |
---|
579 | <xsl:if test="$olink.key != ''"> |
---|
580 | <xsl:variable name="target.href" > |
---|
581 | <xsl:for-each select="$target.database" > |
---|
582 | <xsl:value-of select="key('targetptr-key', $olink.key)/@href" /> |
---|
583 | </xsl:for-each> |
---|
584 | </xsl:variable> |
---|
585 | |
---|
586 | <!-- an olink starting point may be in a subdirectory, so need |
---|
587 | the "from" reference point to compute a relative path --> |
---|
588 | |
---|
589 | <xsl:variable name="from.href"> |
---|
590 | <xsl:call-template name="olink.from.uri"> |
---|
591 | <xsl:with-param name="target.database" select="$target.database"/> |
---|
592 | <xsl:with-param name="object" select="."/> |
---|
593 | <xsl:with-param name="object.targetdoc" select="$current.docid"/> |
---|
594 | </xsl:call-template> |
---|
595 | </xsl:variable> |
---|
596 | |
---|
597 | <!-- If the from.href has directory path, then must "../" upward |
---|
598 | to document level --> |
---|
599 | <xsl:variable name="upward.from.path"> |
---|
600 | <xsl:call-template name="upward.path"> |
---|
601 | <xsl:with-param name="path" select="$from.href"/> |
---|
602 | </xsl:call-template> |
---|
603 | </xsl:variable> |
---|
604 | |
---|
605 | <xsl:variable name="targetdoc"> |
---|
606 | <xsl:value-of select="substring-before($olink.key, '/')"/> |
---|
607 | </xsl:variable> |
---|
608 | |
---|
609 | <!-- Does the target database use a sitemap? --> |
---|
610 | <xsl:variable name="use.sitemap"> |
---|
611 | <xsl:choose> |
---|
612 | <xsl:when test="$target.database//sitemap">1</xsl:when> |
---|
613 | <xsl:otherwise>0</xsl:otherwise> |
---|
614 | </xsl:choose> |
---|
615 | </xsl:variable> |
---|
616 | |
---|
617 | |
---|
618 | <!-- Get the baseuri for this targetptr --> |
---|
619 | <xsl:variable name="baseuri" > |
---|
620 | <xsl:choose> |
---|
621 | <!-- Does the database use a sitemap? --> |
---|
622 | <xsl:when test="$use.sitemap != 0" > |
---|
623 | <xsl:choose> |
---|
624 | <!-- Was current.docid parameter set? --> |
---|
625 | <xsl:when test="$current.docid != ''"> |
---|
626 | <!-- Was it found in the database? --> |
---|
627 | <xsl:variable name="currentdoc.key" > |
---|
628 | <xsl:for-each select="$target.database" > |
---|
629 | <xsl:value-of select="key('targetdoc-key', |
---|
630 | $current.docid)/@targetdoc" /> |
---|
631 | </xsl:for-each> |
---|
632 | </xsl:variable> |
---|
633 | <xsl:choose> |
---|
634 | <xsl:when test="$currentdoc.key != ''"> |
---|
635 | <xsl:for-each select="$target.database" > |
---|
636 | <xsl:call-template name="targetpath" > |
---|
637 | <xsl:with-param name="dirnode" |
---|
638 | select="key('targetdoc-key', $current.docid)/parent::dir"/> |
---|
639 | <xsl:with-param name="targetdoc" select="$targetdoc"/> |
---|
640 | </xsl:call-template> |
---|
641 | </xsl:for-each > |
---|
642 | </xsl:when> |
---|
643 | <xsl:otherwise> |
---|
644 | <xsl:message> |
---|
645 | <xsl:text>Olink error: cannot compute relative </xsl:text> |
---|
646 | <xsl:text>sitemap path because $current.docid '</xsl:text> |
---|
647 | <xsl:value-of select="$current.docid"/> |
---|
648 | <xsl:text>' not found in target database.</xsl:text> |
---|
649 | </xsl:message> |
---|
650 | </xsl:otherwise> |
---|
651 | </xsl:choose> |
---|
652 | </xsl:when> |
---|
653 | <xsl:otherwise> |
---|
654 | <xsl:message> |
---|
655 | <xsl:text>Olink warning: cannot compute relative </xsl:text> |
---|
656 | <xsl:text>sitemap path without $current.docid parameter</xsl:text> |
---|
657 | </xsl:message> |
---|
658 | </xsl:otherwise> |
---|
659 | </xsl:choose> |
---|
660 | <!-- In either case, add baseuri from its document entry--> |
---|
661 | <xsl:variable name="docbaseuri"> |
---|
662 | <xsl:for-each select="$target.database" > |
---|
663 | <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri" /> |
---|
664 | </xsl:for-each> |
---|
665 | </xsl:variable> |
---|
666 | <xsl:if test="$docbaseuri != ''" > |
---|
667 | <xsl:value-of select="$docbaseuri"/> |
---|
668 | </xsl:if> |
---|
669 | </xsl:when> |
---|
670 | <!-- No database sitemap in use --> |
---|
671 | <xsl:otherwise> |
---|
672 | <!-- Just use any baseuri from its document entry --> |
---|
673 | <xsl:variable name="docbaseuri"> |
---|
674 | <xsl:for-each select="$target.database" > |
---|
675 | <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri" /> |
---|
676 | </xsl:for-each> |
---|
677 | </xsl:variable> |
---|
678 | <xsl:if test="$docbaseuri != ''" > |
---|
679 | <xsl:value-of select="$docbaseuri"/> |
---|
680 | </xsl:if> |
---|
681 | </xsl:otherwise> |
---|
682 | </xsl:choose> |
---|
683 | </xsl:variable> |
---|
684 | |
---|
685 | <!-- Form the href information --> |
---|
686 | <xsl:if test="not(contains($baseuri, ':'))"> |
---|
687 | <!-- if not an absolute uri, add upward path from olink chunk --> |
---|
688 | <xsl:value-of select="$upward.from.path"/> |
---|
689 | </xsl:if> |
---|
690 | |
---|
691 | <xsl:if test="$baseuri != ''"> |
---|
692 | <xsl:value-of select="$baseuri"/> |
---|
693 | <xsl:if test="substring($target.href,1,1) != '#'"> |
---|
694 | <!--xsl:text>/</xsl:text--> |
---|
695 | </xsl:if> |
---|
696 | </xsl:if> |
---|
697 | <!-- optionally turn off frag for PDF references --> |
---|
698 | <xsl:if test="not($insert.olink.pdf.frag = 0 and |
---|
699 | translate(substring($baseuri, string-length($baseuri) - 3), |
---|
700 | 'PDF', 'pdf') = '.pdf' |
---|
701 | and starts-with($target.href, '#') )"> |
---|
702 | <xsl:value-of select="$target.href"/> |
---|
703 | </xsl:if> |
---|
704 | </xsl:if> |
---|
705 | </xsl:template> |
---|
706 | |
---|
707 | <!-- Computes "../" to reach top --> |
---|
708 | <xsl:template name="upward.path"> |
---|
709 | <xsl:param name="path" select="''"/> |
---|
710 | <xsl:choose> |
---|
711 | <!-- Don't bother with absolute uris --> |
---|
712 | <xsl:when test="contains($path, ':')"/> |
---|
713 | <xsl:when test="starts-with($path, '/')"/> |
---|
714 | <xsl:when test="contains($path, '/')"> |
---|
715 | <xsl:text>../</xsl:text> |
---|
716 | <xsl:call-template name="upward.path"> |
---|
717 | <xsl:with-param name="path" select="substring-after($path, '/')"/> |
---|
718 | </xsl:call-template> |
---|
719 | </xsl:when> |
---|
720 | </xsl:choose> |
---|
721 | |
---|
722 | </xsl:template> |
---|
723 | |
---|
724 | <!-- ==================================================================== --> |
---|
725 | |
---|
726 | <xsl:template name="html.head"> |
---|
727 | <xsl:param name="prev" select="/foo"/> |
---|
728 | <xsl:param name="next" select="/foo"/> |
---|
729 | <xsl:variable name="this" select="."/> |
---|
730 | <xsl:variable name="home" select="/*[1]"/> |
---|
731 | <xsl:variable name="up" select="parent::*"/> |
---|
732 | |
---|
733 | <head> |
---|
734 | <xsl:call-template name="system.head.content"/> |
---|
735 | <xsl:call-template name="head.content"/> |
---|
736 | |
---|
737 | <xsl:if test="$home"> |
---|
738 | <link rel="start"> |
---|
739 | <xsl:attribute name="href"> |
---|
740 | <xsl:call-template name="href.target"> |
---|
741 | <xsl:with-param name="object" select="$home"/> |
---|
742 | </xsl:call-template> |
---|
743 | </xsl:attribute> |
---|
744 | <xsl:attribute name="title"> |
---|
745 | <xsl:apply-templates select="$home" |
---|
746 | mode="object.title.markup.textonly"/> |
---|
747 | </xsl:attribute> |
---|
748 | </link> |
---|
749 | </xsl:if> |
---|
750 | |
---|
751 | <xsl:if test="$up"> |
---|
752 | <link rel="up"> |
---|
753 | <xsl:attribute name="href"> |
---|
754 | <xsl:call-template name="href.target"> |
---|
755 | <xsl:with-param name="object" select="$up"/> |
---|
756 | </xsl:call-template> |
---|
757 | </xsl:attribute> |
---|
758 | <xsl:attribute name="title"> |
---|
759 | <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/> |
---|
760 | </xsl:attribute> |
---|
761 | </link> |
---|
762 | </xsl:if> |
---|
763 | |
---|
764 | <xsl:if test="$prev"> |
---|
765 | <link rel="prev"> |
---|
766 | <xsl:attribute name="href"> |
---|
767 | <xsl:call-template name="href.target"> |
---|
768 | <xsl:with-param name="object" select="$prev"/> |
---|
769 | </xsl:call-template> |
---|
770 | </xsl:attribute> |
---|
771 | <xsl:attribute name="title"> |
---|
772 | <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/> |
---|
773 | </xsl:attribute> |
---|
774 | </link> |
---|
775 | </xsl:if> |
---|
776 | |
---|
777 | <xsl:if test="$next"> |
---|
778 | <link rel="next"> |
---|
779 | <xsl:attribute name="href"> |
---|
780 | <xsl:call-template name="href.target"> |
---|
781 | <xsl:with-param name="object" select="$next"/> |
---|
782 | </xsl:call-template> |
---|
783 | </xsl:attribute> |
---|
784 | <xsl:attribute name="title"> |
---|
785 | <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/> |
---|
786 | </xsl:attribute> |
---|
787 | </link> |
---|
788 | </xsl:if> |
---|
789 | |
---|
790 | <xsl:if test="$html.extra.head.links != 0"> |
---|
791 | <xsl:for-each select="//part |
---|
792 | |//reference |
---|
793 | |//preface |
---|
794 | |//chapter |
---|
795 | |//article |
---|
796 | |//refentry |
---|
797 | |//appendix[not(parent::article)]|appendix |
---|
798 | |//glossary[not(parent::article)]|glossary |
---|
799 | |//index[not(parent::article)]|index"> |
---|
800 | <link rel="{local-name(.)}"> |
---|
801 | <xsl:attribute name="href"> |
---|
802 | <xsl:call-template name="href.target"> |
---|
803 | <xsl:with-param name="context" select="$this"/> |
---|
804 | <xsl:with-param name="object" select="."/> |
---|
805 | </xsl:call-template> |
---|
806 | </xsl:attribute> |
---|
807 | <xsl:attribute name="title"> |
---|
808 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/> |
---|
809 | </xsl:attribute> |
---|
810 | </link> |
---|
811 | </xsl:for-each> |
---|
812 | |
---|
813 | <xsl:for-each select="section|sect1|refsection|refsect1"> |
---|
814 | <link> |
---|
815 | <xsl:attribute name="rel"> |
---|
816 | <xsl:choose> |
---|
817 | <xsl:when test="local-name($this) = 'section' |
---|
818 | or local-name($this) = 'refsection'"> |
---|
819 | <xsl:value-of select="'subsection'"/> |
---|
820 | </xsl:when> |
---|
821 | <xsl:otherwise> |
---|
822 | <xsl:value-of select="'section'"/> |
---|
823 | </xsl:otherwise> |
---|
824 | </xsl:choose> |
---|
825 | </xsl:attribute> |
---|
826 | <xsl:attribute name="href"> |
---|
827 | <xsl:call-template name="href.target"> |
---|
828 | <xsl:with-param name="context" select="$this"/> |
---|
829 | <xsl:with-param name="object" select="."/> |
---|
830 | </xsl:call-template> |
---|
831 | </xsl:attribute> |
---|
832 | <xsl:attribute name="title"> |
---|
833 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/> |
---|
834 | </xsl:attribute> |
---|
835 | </link> |
---|
836 | </xsl:for-each> |
---|
837 | |
---|
838 | <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3"> |
---|
839 | <link rel="subsection"> |
---|
840 | <xsl:attribute name="href"> |
---|
841 | <xsl:call-template name="href.target"> |
---|
842 | <xsl:with-param name="context" select="$this"/> |
---|
843 | <xsl:with-param name="object" select="."/> |
---|
844 | </xsl:call-template> |
---|
845 | </xsl:attribute> |
---|
846 | <xsl:attribute name="title"> |
---|
847 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/> |
---|
848 | </xsl:attribute> |
---|
849 | </link> |
---|
850 | </xsl:for-each> |
---|
851 | </xsl:if> |
---|
852 | |
---|
853 | <!-- * if we have a legalnotice and user wants it output as a --> |
---|
854 | <!-- * separate page and $html.head.legalnotice.link.types is --> |
---|
855 | <!-- * non-empty, we generate a link or links for each value in --> |
---|
856 | <!-- * $html.head.legalnotice.link.types --> |
---|
857 | <xsl:if test="//legalnotice |
---|
858 | and not($generate.legalnotice.link = 0) |
---|
859 | and not($html.head.legalnotice.link.types = '')"> |
---|
860 | <xsl:call-template name="make.legalnotice.head.links"/> |
---|
861 | </xsl:if> |
---|
862 | |
---|
863 | <xsl:call-template name="user.head.content"/> |
---|
864 | </head> |
---|
865 | </xsl:template> |
---|
866 | |
---|
867 | <!-- ==================================================================== --> |
---|
868 | |
---|
869 | <xsl:template name="header.navigation"> |
---|
870 | <xsl:param name="prev" select="/foo"/> |
---|
871 | <xsl:param name="next" select="/foo"/> |
---|
872 | <xsl:param name="nav.context"/> |
---|
873 | |
---|
874 | <xsl:variable name="home" select="/*[1]"/> |
---|
875 | <xsl:variable name="up" select="parent::*"/> |
---|
876 | |
---|
877 | <xsl:variable name="row1" select="$navig.showtitles != 0"/> |
---|
878 | <xsl:variable name="row2" select="count($prev) > 0 |
---|
879 | or (count($up) > 0 |
---|
880 | and generate-id($up) != generate-id($home) |
---|
881 | and $navig.showtitles != 0) |
---|
882 | or count($next) > 0"/> |
---|
883 | |
---|
884 | <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'"> |
---|
885 | <div class="navheader"> |
---|
886 | <xsl:if test="$row1 or $row2"> |
---|
887 | <table width="100%" summary="Navigation header"> |
---|
888 | <xsl:if test="$row1"> |
---|
889 | <tr> |
---|
890 | <th colspan="3" align="center"> |
---|
891 | <xsl:apply-templates select="." mode="object.title.markup"/> |
---|
892 | </th> |
---|
893 | </tr> |
---|
894 | </xsl:if> |
---|
895 | |
---|
896 | <xsl:if test="$row2"> |
---|
897 | <tr> |
---|
898 | <td width="20%" align="left"> |
---|
899 | <xsl:if test="count($prev)>0"> |
---|
900 | <a accesskey="p"> |
---|
901 | <xsl:attribute name="href"> |
---|
902 | <xsl:call-template name="href.target"> |
---|
903 | <xsl:with-param name="object" select="$prev"/> |
---|
904 | </xsl:call-template> |
---|
905 | </xsl:attribute> |
---|
906 | <xsl:attribute name="title"> |
---|
907 | <xsl:apply-templates select="$prev" mode="object.title.markup"/> |
---|
908 | </xsl:attribute> |
---|
909 | <xsl:call-template name="navig.content"> |
---|
910 | <xsl:with-param name="direction" select="'prev'"/> |
---|
911 | </xsl:call-template> |
---|
912 | </a> |
---|
913 | </xsl:if> |
---|
914 | <xsl:text> </xsl:text> |
---|
915 | </td> |
---|
916 | <th width="60%" align="center"> |
---|
917 | <xsl:choose> |
---|
918 | <xsl:when test="count($up) > 0 |
---|
919 | and generate-id($up) != generate-id($home) |
---|
920 | and $navig.showtitles != 0"> |
---|
921 | <a accesskey="u"> |
---|
922 | <xsl:attribute name="href"> |
---|
923 | <xsl:call-template name="href.target"> |
---|
924 | <xsl:with-param name="object" select="$up"/> |
---|
925 | </xsl:call-template> |
---|
926 | </xsl:attribute> |
---|
927 | <xsl:apply-templates select="$up" mode="object.title.markup"/> |
---|
928 | </a> |
---|
929 | </xsl:when> |
---|
930 | <xsl:otherwise> </xsl:otherwise> |
---|
931 | </xsl:choose> |
---|
932 | </th> |
---|
933 | <td width="20%" align="right"> |
---|
934 | <xsl:text> </xsl:text> |
---|
935 | <xsl:if test="count($next)>0"> |
---|
936 | <a accesskey="n"> |
---|
937 | <xsl:attribute name="href"> |
---|
938 | <xsl:call-template name="href.target"> |
---|
939 | <xsl:with-param name="object" select="$next"/> |
---|
940 | </xsl:call-template> |
---|
941 | </xsl:attribute> |
---|
942 | <xsl:attribute name="title"> |
---|
943 | <xsl:apply-templates select="$next" mode="object.title.markup"/> |
---|
944 | </xsl:attribute> |
---|
945 | <xsl:call-template name="navig.content"> |
---|
946 | <xsl:with-param name="direction" select="'next'"/> |
---|
947 | </xsl:call-template> |
---|
948 | </a> |
---|
949 | </xsl:if> |
---|
950 | </td> |
---|
951 | </tr> |
---|
952 | </xsl:if> |
---|
953 | </table> |
---|
954 | </xsl:if> |
---|
955 | <xsl:if test="$header.rule != 0"> |
---|
956 | <hr/> |
---|
957 | </xsl:if> |
---|
958 | </div> |
---|
959 | </xsl:if> |
---|
960 | </xsl:template> |
---|
961 | |
---|
962 | <!-- ==================================================================== --> |
---|
963 | |
---|
964 | <xsl:template name="footer.navigation"> |
---|
965 | <xsl:param name="prev" select="/foo"/> |
---|
966 | <xsl:param name="next" select="/foo"/> |
---|
967 | <xsl:param name="nav.context"/> |
---|
968 | |
---|
969 | <xsl:variable name="home" select="/*[1]"/> |
---|
970 | <xsl:variable name="up" select="parent::*"/> |
---|
971 | |
---|
972 | <xsl:variable name="row1" select="count($prev) > 0 |
---|
973 | or count($up) > 0 |
---|
974 | or count($next) > 0"/> |
---|
975 | |
---|
976 | <xsl:variable name="row2" select="($prev and $navig.showtitles != 0) |
---|
977 | or (generate-id($home) != generate-id(.) |
---|
978 | or $nav.context = 'toc') |
---|
979 | or ($chunk.tocs.and.lots != 0 |
---|
980 | and $nav.context != 'toc') |
---|
981 | or ($next and $navig.showtitles != 0)"/> |
---|
982 | |
---|
983 | <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'"> |
---|
984 | <div class="navfooter"> |
---|
985 | <xsl:if test="$footer.rule != 0"> |
---|
986 | <hr/> |
---|
987 | </xsl:if> |
---|
988 | |
---|
989 | <xsl:if test="$row1 or $row2"> |
---|
990 | <table width="100%" summary="Navigation footer"> |
---|
991 | <xsl:if test="$row1"> |
---|
992 | <tr> |
---|
993 | <td width="40%" align="left"> |
---|
994 | <xsl:if test="count($prev)>0"> |
---|
995 | <a accesskey="p"> |
---|
996 | <xsl:attribute name="href"> |
---|
997 | <xsl:call-template name="href.target"> |
---|
998 | <xsl:with-param name="object" select="$prev"/> |
---|
999 | </xsl:call-template> |
---|
1000 | </xsl:attribute> |
---|
1001 | <xsl:call-template name="navig.content"> |
---|
1002 | <xsl:with-param name="direction" select="'prev'"/> |
---|
1003 | </xsl:call-template> |
---|
1004 | </a> |
---|
1005 | </xsl:if> |
---|
1006 | <xsl:text> </xsl:text> |
---|
1007 | </td> |
---|
1008 | <td width="20%" align="center"> |
---|
1009 | <xsl:choose> |
---|
1010 | <xsl:when test="count($up)>0 |
---|
1011 | and generate-id($up) != generate-id($home)"> |
---|
1012 | <a accesskey="u"> |
---|
1013 | <xsl:attribute name="href"> |
---|
1014 | <xsl:call-template name="href.target"> |
---|
1015 | <xsl:with-param name="object" select="$up"/> |
---|
1016 | </xsl:call-template> |
---|
1017 | </xsl:attribute> |
---|
1018 | <xsl:attribute name="title"> |
---|
1019 | <xsl:apply-templates select="$up" mode="object.title.markup"/> |
---|
1020 | </xsl:attribute> |
---|
1021 | <xsl:call-template name="navig.content"> |
---|
1022 | <xsl:with-param name="direction" select="'up'"/> |
---|
1023 | </xsl:call-template> |
---|
1024 | </a> |
---|
1025 | </xsl:when> |
---|
1026 | <xsl:otherwise> </xsl:otherwise> |
---|
1027 | </xsl:choose> |
---|
1028 | </td> |
---|
1029 | <td width="40%" align="right"> |
---|
1030 | <xsl:text> </xsl:text> |
---|
1031 | <xsl:if test="count($next)>0"> |
---|
1032 | <a accesskey="n"> |
---|
1033 | <xsl:attribute name="href"> |
---|
1034 | <xsl:call-template name="href.target"> |
---|
1035 | <xsl:with-param name="object" select="$next"/> |
---|
1036 | </xsl:call-template> |
---|
1037 | </xsl:attribute> |
---|
1038 | <xsl:call-template name="navig.content"> |
---|
1039 | <xsl:with-param name="direction" select="'next'"/> |
---|
1040 | </xsl:call-template> |
---|
1041 | </a> |
---|
1042 | </xsl:if> |
---|
1043 | </td> |
---|
1044 | </tr> |
---|
1045 | </xsl:if> |
---|
1046 | |
---|
1047 | <xsl:if test="$row2"> |
---|
1048 | <tr> |
---|
1049 | <td width="40%" align="left" valign="top"> |
---|
1050 | <xsl:if test="$navig.showtitles != 0"> |
---|
1051 | <xsl:apply-templates select="$prev" mode="object.title.markup"/> |
---|
1052 | </xsl:if> |
---|
1053 | <xsl:text> </xsl:text> |
---|
1054 | </td> |
---|
1055 | <td width="20%" align="center"> |
---|
1056 | <xsl:choose> |
---|
1057 | <xsl:when test="$home != . or $nav.context = 'toc'"> |
---|
1058 | <a accesskey="h"> |
---|
1059 | <xsl:attribute name="href"> |
---|
1060 | <xsl:call-template name="href.target"> |
---|
1061 | <xsl:with-param name="object" select="$home"/> |
---|
1062 | </xsl:call-template> |
---|
1063 | </xsl:attribute> |
---|
1064 | <xsl:call-template name="navig.content"> |
---|
1065 | <xsl:with-param name="direction" select="'home'"/> |
---|
1066 | </xsl:call-template> |
---|
1067 | </a> |
---|
1068 | <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"> |
---|
1069 | <xsl:text> | </xsl:text> |
---|
1070 | </xsl:if> |
---|
1071 | </xsl:when> |
---|
1072 | <xsl:otherwise> </xsl:otherwise> |
---|
1073 | </xsl:choose> |
---|
1074 | |
---|
1075 | <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"> |
---|
1076 | <a accesskey="t"> |
---|
1077 | <xsl:attribute name="href"> |
---|
1078 | <xsl:apply-templates select="/*[1]" |
---|
1079 | mode="recursive-chunk-filename"> |
---|
1080 | <xsl:with-param name="recursive" select="true()"/> |
---|
1081 | </xsl:apply-templates> |
---|
1082 | <xsl:text>-toc</xsl:text> |
---|
1083 | <xsl:value-of select="$html.ext"/> |
---|
1084 | </xsl:attribute> |
---|
1085 | <xsl:call-template name="gentext"> |
---|
1086 | <xsl:with-param name="key" select="'nav-toc'"/> |
---|
1087 | </xsl:call-template> |
---|
1088 | </a> |
---|
1089 | </xsl:if> |
---|
1090 | </td> |
---|
1091 | <td width="40%" align="right" valign="top"> |
---|
1092 | <xsl:text> </xsl:text> |
---|
1093 | <xsl:if test="$navig.showtitles != 0"> |
---|
1094 | <xsl:apply-templates select="$next" mode="object.title.markup"/> |
---|
1095 | </xsl:if> |
---|
1096 | </td> |
---|
1097 | </tr> |
---|
1098 | </xsl:if> |
---|
1099 | </table> |
---|
1100 | </xsl:if> |
---|
1101 | </div> |
---|
1102 | </xsl:if> |
---|
1103 | </xsl:template> |
---|
1104 | |
---|
1105 | <!-- ==================================================================== --> |
---|
1106 | |
---|
1107 | <xsl:template name="navig.content"> |
---|
1108 | <xsl:param name="direction" select="next"/> |
---|
1109 | <xsl:variable name="navtext"> |
---|
1110 | <xsl:choose> |
---|
1111 | <xsl:when test="$direction = 'prev'"> |
---|
1112 | <xsl:call-template name="gentext.nav.prev"/> |
---|
1113 | </xsl:when> |
---|
1114 | <xsl:when test="$direction = 'next'"> |
---|
1115 | <xsl:call-template name="gentext.nav.next"/> |
---|
1116 | </xsl:when> |
---|
1117 | <xsl:when test="$direction = 'up'"> |
---|
1118 | <xsl:call-template name="gentext.nav.up"/> |
---|
1119 | </xsl:when> |
---|
1120 | <xsl:when test="$direction = 'home'"> |
---|
1121 | <xsl:call-template name="gentext.nav.home"/> |
---|
1122 | </xsl:when> |
---|
1123 | <xsl:otherwise> |
---|
1124 | <xsl:text>xxx</xsl:text> |
---|
1125 | </xsl:otherwise> |
---|
1126 | </xsl:choose> |
---|
1127 | </xsl:variable> |
---|
1128 | |
---|
1129 | <xsl:choose> |
---|
1130 | <xsl:when test="$navig.graphics != 0"> |
---|
1131 | <img> |
---|
1132 | <xsl:attribute name="src"> |
---|
1133 | <xsl:value-of select="$navig.graphics.path"/> |
---|
1134 | <xsl:value-of select="$direction"/> |
---|
1135 | <xsl:value-of select="$navig.graphics.extension"/> |
---|
1136 | </xsl:attribute> |
---|
1137 | <xsl:attribute name="alt"> |
---|
1138 | <xsl:value-of select="$navtext"/> |
---|
1139 | </xsl:attribute> |
---|
1140 | </img> |
---|
1141 | </xsl:when> |
---|
1142 | <xsl:otherwise> |
---|
1143 | <xsl:value-of select="$navtext"/> |
---|
1144 | </xsl:otherwise> |
---|
1145 | </xsl:choose> |
---|
1146 | </xsl:template> |
---|
1147 | |
---|
1148 | <!-- ==================================================================== --> |
---|
1149 | |
---|
1150 | <!-- * The following template assumes that the first legalnotice --> |
---|
1151 | <!-- * instance found in a document applies to the contents of the --> |
---|
1152 | <!-- * entire document. It generates an HTML link in each chunk, back --> |
---|
1153 | <!-- * to the file containing the contents of the first legalnotice. --> |
---|
1154 | <!-- * --> |
---|
1155 | <!-- * Actually, it may generate multiple link instances in each chunk, --> |
---|
1156 | <!-- * because it walks through the space-separated list of link --> |
---|
1157 | <!-- * types specified in the $html.head.legalnotice.link.types param, --> |
---|
1158 | <!-- * popping off link types and generating links for them until it --> |
---|
1159 | <!-- * depletes the list. --> |
---|
1160 | |
---|
1161 | <xsl:template name="make.legalnotice.head.links"> |
---|
1162 | <!-- * the following ID is used as part of the legalnotice filename; --> |
---|
1163 | <!-- * we need it in order to construct the filename for use in the --> |
---|
1164 | <!-- * value of the href attribute on the link --> |
---|
1165 | <xsl:param name="id"> |
---|
1166 | <xsl:call-template name="object.id"> |
---|
1167 | <xsl:with-param name="object" select="(//legalnotice)[1]"/> |
---|
1168 | </xsl:call-template> |
---|
1169 | </xsl:param> |
---|
1170 | <xsl:param name="linktype"> |
---|
1171 | <xsl:choose> |
---|
1172 | <xsl:when test="contains($html.head.legalnotice.link.types, ' ')"> |
---|
1173 | <xsl:value-of |
---|
1174 | select="normalize-space( |
---|
1175 | substring-before($html.head.legalnotice.link.types, ' '))"/> |
---|
1176 | </xsl:when> |
---|
1177 | <xsl:otherwise> |
---|
1178 | <xsl:value-of select="$html.head.legalnotice.link.types"/> |
---|
1179 | </xsl:otherwise> |
---|
1180 | </xsl:choose> |
---|
1181 | </xsl:param> |
---|
1182 | <xsl:param |
---|
1183 | name="remaining.linktypes" |
---|
1184 | select="concat( |
---|
1185 | normalize-space( |
---|
1186 | substring-after($html.head.legalnotice.link.types, ' ')),' ')"/> |
---|
1187 | <xsl:if test="not($linktype = '')"> |
---|
1188 | <link rel="{$linktype}"> |
---|
1189 | <xsl:attribute name="href"> |
---|
1190 | <xsl:value-of select="concat('ln-',$id,$html.ext)"/> |
---|
1191 | </xsl:attribute> |
---|
1192 | <xsl:attribute name="title"> |
---|
1193 | <xsl:apply-templates select="(//legalnotice)[1]" |
---|
1194 | mode="object.title.markup.textonly"/> |
---|
1195 | </xsl:attribute> |
---|
1196 | </link> |
---|
1197 | <xsl:call-template name="make.legalnotice.head.links"> |
---|
1198 | <!-- * pop the next value off the list of link types --> |
---|
1199 | <xsl:with-param |
---|
1200 | name="linktype" |
---|
1201 | select="substring-before($remaining.linktypes, ' ')"/> |
---|
1202 | <!-- * remove the link type from the list of remaining link types --> |
---|
1203 | <xsl:with-param |
---|
1204 | name="remaining.linktypes" |
---|
1205 | select="substring-after($remaining.linktypes, ' ')"/> |
---|
1206 | </xsl:call-template> |
---|
1207 | </xsl:if> |
---|
1208 | </xsl:template> |
---|
1209 | |
---|
1210 | <!-- ==================================================================== --> |
---|
1211 | |
---|
1212 | <xsl:template match="processing-instruction('dbhtml')"> |
---|
1213 | <!-- nop --> |
---|
1214 | </xsl:template> |
---|
1215 | |
---|
1216 | <!-- ==================================================================== --> |
---|
1217 | |
---|
1218 | <xsl:template name="chunk-element-content"> |
---|
1219 | <xsl:param name="prev"/> |
---|
1220 | <xsl:param name="next"/> |
---|
1221 | <xsl:param name="nav.context"/> |
---|
1222 | <xsl:param name="content"> |
---|
1223 | <xsl:apply-imports/> |
---|
1224 | </xsl:param> |
---|
1225 | |
---|
1226 | <xsl:call-template name="user.preroot"/> |
---|
1227 | |
---|
1228 | <html> |
---|
1229 | <xsl:call-template name="html.head"> |
---|
1230 | <xsl:with-param name="prev" select="$prev"/> |
---|
1231 | <xsl:with-param name="next" select="$next"/> |
---|
1232 | </xsl:call-template> |
---|
1233 | |
---|
1234 | <body> |
---|
1235 | <xsl:call-template name="body.attributes"/> |
---|
1236 | <xsl:call-template name="user.header.navigation"/> |
---|
1237 | |
---|
1238 | <xsl:call-template name="header.navigation"> |
---|
1239 | <xsl:with-param name="prev" select="$prev"/> |
---|
1240 | <xsl:with-param name="next" select="$next"/> |
---|
1241 | <xsl:with-param name="nav.context" select="$nav.context"/> |
---|
1242 | </xsl:call-template> |
---|
1243 | |
---|
1244 | <xsl:call-template name="user.header.content"/> |
---|
1245 | |
---|
1246 | <xsl:copy-of select="$content"/> |
---|
1247 | |
---|
1248 | <xsl:call-template name="user.footer.content"/> |
---|
1249 | |
---|
1250 | <xsl:call-template name="footer.navigation"> |
---|
1251 | <xsl:with-param name="prev" select="$prev"/> |
---|
1252 | <xsl:with-param name="next" select="$next"/> |
---|
1253 | <xsl:with-param name="nav.context" select="$nav.context"/> |
---|
1254 | </xsl:call-template> |
---|
1255 | |
---|
1256 | <xsl:call-template name="user.footer.navigation"/> |
---|
1257 | </body> |
---|
1258 | </html> |
---|
1259 | <xsl:value-of select="$chunk.append"/> |
---|
1260 | </xsl:template> |
---|
1261 | |
---|
1262 | </xsl:stylesheet> |
---|