OLD | NEW |
| (Empty) |
1 <?xml version="1.0"?> | |
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
3 xmlns:exsl="http://exslt.org/common" | |
4 xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" | |
5 xmlns:ng="http://docbook.org/docbook-ng" | |
6 xmlns:db="http://docbook.org/ns/docbook" | |
7 exclude-result-prefixes="exsl cf ng db" | |
8 version="1.0"> | |
9 | |
10 <!-- ******************************************************************** | |
11 $Id: chunk-code.xsl 9328 2012-05-03 16:28:23Z bobstayton $ | |
12 ******************************************************************** | |
13 | |
14 This file is part of the XSL DocBook Stylesheet distribution. | |
15 See ../README or http://docbook.sf.net/release/xsl/current/ for | |
16 copyright and other information. | |
17 | |
18 ******************************************************************** --> | |
19 | |
20 <!-- ==================================================================== --> | |
21 | |
22 | |
23 <xsl:template match="*" mode="chunk-filename"> | |
24 <!-- returns the filename of a chunk --> | |
25 <xsl:variable name="ischunk"> | |
26 <xsl:call-template name="chunk"/> | |
27 </xsl:variable> | |
28 | |
29 <xsl:variable name="fn"> | |
30 <xsl:apply-templates select="." mode="recursive-chunk-filename"/> | |
31 </xsl:variable> | |
32 | |
33 <!-- | |
34 <xsl:message> | |
35 <xsl:value-of select="$ischunk"/> | |
36 <xsl:text> (</xsl:text> | |
37 <xsl:value-of select="local-name(.)"/> | |
38 <xsl:text>) </xsl:text> | |
39 <xsl:value-of select="$fn"/> | |
40 <xsl:text>, </xsl:text> | |
41 <xsl:call-template name="dbhtml-dir"/> | |
42 </xsl:message> | |
43 --> | |
44 | |
45 <!-- 2003-11-25 by ndw: | |
46 The following test used to read test="$ischunk != 0 and $fn != ''" | |
47 I've removed the ischunk part of the test so that href.to.uri and | |
48 href.from.uri will be fully qualified even if the source or target | |
49 isn't a chunk. I *think* that if $fn != '' then it's appropriate | |
50 to put the directory on the front, even if the element isn't a | |
51 chunk. I could be wrong. --> | |
52 | |
53 <xsl:if test="$fn != ''"> | |
54 <xsl:call-template name="dbhtml-dir"/> | |
55 </xsl:if> | |
56 | |
57 <xsl:value-of select="$chunked.filename.prefix"/> | |
58 | |
59 <xsl:value-of select="$fn"/> | |
60 <!-- You can't add the html.ext here because dbhtml filename= may already --> | |
61 <!-- have added it. It really does have to be handled in the recursive templat
e --> | |
62 </xsl:template> | |
63 | |
64 <xsl:template match="*" mode="recursive-chunk-filename"> | |
65 <xsl:param name="recursive" select="false()"/> | |
66 | |
67 <!-- returns the filename of a chunk --> | |
68 <xsl:variable name="ischunk"> | |
69 <xsl:call-template name="chunk"/> | |
70 </xsl:variable> | |
71 | |
72 <xsl:variable name="dbhtml-filename"> | |
73 <xsl:call-template name="pi.dbhtml_filename"/> | |
74 </xsl:variable> | |
75 | |
76 <xsl:variable name="filename"> | |
77 <xsl:choose> | |
78 <xsl:when test="$dbhtml-filename != ''"> | |
79 <xsl:value-of select="$dbhtml-filename"/> | |
80 </xsl:when> | |
81 <!-- if this is the root element, use the root.filename --> | |
82 <xsl:when test="not(parent::*) and $root.filename != ''"> | |
83 <xsl:value-of select="$root.filename"/> | |
84 <xsl:value-of select="$html.ext"/> | |
85 </xsl:when> | |
86 <!-- Special case --> | |
87 <xsl:when test="self::legalnotice and not($generate.legalnotice.link = 0)"
> | |
88 <xsl:choose> | |
89 <xsl:when test="(@id or @xml:id) and not($use.id.as.filename = 0)"> | |
90 <!-- * if this legalnotice has an ID, then go ahead and use --> | |
91 <!-- * just the value of that ID as the basename for the file --> | |
92 <!-- * (that is, without prepending an "ln-" too it) --> | |
93 <xsl:value-of select="(@id|@xml:id)[1]"/> | |
94 <xsl:value-of select="$html.ext"/> | |
95 </xsl:when> | |
96 <xsl:otherwise> | |
97 <!-- * otherwise, if this legalnotice does not have an ID, --> | |
98 <!-- * then we generate an ID... --> | |
99 <xsl:variable name="id"> | |
100 <xsl:call-template name="object.id"/> | |
101 </xsl:variable> | |
102 <!-- * ...and then we take that generated ID, prepend an --> | |
103 <!-- * "ln-" to it, and use that as the basename for the file --> | |
104 <xsl:value-of select="concat('ln-',$id,$html.ext)"/> | |
105 </xsl:otherwise> | |
106 </xsl:choose> | |
107 </xsl:when> | |
108 <!-- if there's no dbhtml filename, and if we're to use IDs as --> | |
109 <!-- filenames, then use the ID to generate the filename. --> | |
110 <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0"> | |
111 <xsl:value-of select="(@id|@xml:id)[1]"/> | |
112 <xsl:value-of select="$html.ext"/> | |
113 </xsl:when> | |
114 <xsl:otherwise></xsl:otherwise> | |
115 </xsl:choose> | |
116 </xsl:variable> | |
117 | |
118 <xsl:choose> | |
119 <xsl:when test="$ischunk='0'"> | |
120 <!-- if called on something that isn't a chunk, walk up... --> | |
121 <xsl:choose> | |
122 <xsl:when test="count(parent::*)>0"> | |
123 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
124 <xsl:with-param name="recursive" select="$recursive"/> | |
125 </xsl:apply-templates> | |
126 </xsl:when> | |
127 <!-- unless there is no up, in which case return "" --> | |
128 <xsl:otherwise></xsl:otherwise> | |
129 </xsl:choose> | |
130 </xsl:when> | |
131 | |
132 <xsl:when test="not($recursive) and $filename != ''"> | |
133 <!-- if this chunk has an explicit name, use it --> | |
134 <xsl:value-of select="$filename"/> | |
135 </xsl:when> | |
136 | |
137 <xsl:when test="self::set"> | |
138 <xsl:value-of select="$root.filename"/> | |
139 <xsl:if test="not($recursive)"> | |
140 <xsl:value-of select="$html.ext"/> | |
141 </xsl:if> | |
142 </xsl:when> | |
143 | |
144 <xsl:when test="self::book"> | |
145 <xsl:text>bk</xsl:text> | |
146 <xsl:number level="any" format="01"/> | |
147 <xsl:if test="not($recursive)"> | |
148 <xsl:value-of select="$html.ext"/> | |
149 </xsl:if> | |
150 </xsl:when> | |
151 | |
152 <xsl:when test="self::article"> | |
153 <xsl:if test="/set"> | |
154 <!-- in a set, make sure we inherit the right book info... --> | |
155 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> | |
156 <xsl:with-param name="recursive" select="true()"/> | |
157 </xsl:apply-templates> | |
158 </xsl:if> | |
159 | |
160 <xsl:text>ar</xsl:text> | |
161 <xsl:number level="any" format="01" from="book"/> | |
162 <xsl:if test="not($recursive)"> | |
163 <xsl:value-of select="$html.ext"/> | |
164 </xsl:if> | |
165 </xsl:when> | |
166 | |
167 <xsl:when test="self::preface"> | |
168 <xsl:if test="/set"> | |
169 <!-- in a set, make sure we inherit the right book info... --> | |
170 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> | |
171 <xsl:with-param name="recursive" select="true()"/> | |
172 </xsl:apply-templates> | |
173 </xsl:if> | |
174 | |
175 <xsl:text>pr</xsl:text> | |
176 <xsl:number level="any" format="01" from="book"/> | |
177 <xsl:if test="not($recursive)"> | |
178 <xsl:value-of select="$html.ext"/> | |
179 </xsl:if> | |
180 </xsl:when> | |
181 | |
182 <xsl:when test="self::chapter"> | |
183 <xsl:if test="/set"> | |
184 <!-- in a set, make sure we inherit the right book info... --> | |
185 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> | |
186 <xsl:with-param name="recursive" select="true()"/> | |
187 </xsl:apply-templates> | |
188 </xsl:if> | |
189 | |
190 <xsl:text>ch</xsl:text> | |
191 <xsl:number level="any" format="01" from="book"/> | |
192 <xsl:if test="not($recursive)"> | |
193 <xsl:value-of select="$html.ext"/> | |
194 </xsl:if> | |
195 </xsl:when> | |
196 | |
197 <xsl:when test="self::appendix"> | |
198 <xsl:if test="/set"> | |
199 <!-- in a set, make sure we inherit the right book info... --> | |
200 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> | |
201 <xsl:with-param name="recursive" select="true()"/> | |
202 </xsl:apply-templates> | |
203 </xsl:if> | |
204 | |
205 <xsl:text>ap</xsl:text> | |
206 <xsl:number level="any" format="a" from="book"/> | |
207 <xsl:if test="not($recursive)"> | |
208 <xsl:value-of select="$html.ext"/> | |
209 </xsl:if> | |
210 </xsl:when> | |
211 | |
212 <xsl:when test="self::part"> | |
213 <xsl:choose> | |
214 <xsl:when test="/set"> | |
215 <!-- in a set, make sure we inherit the right book info... --> | |
216 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
217 <xsl:with-param name="recursive" select="true()"/> | |
218 </xsl:apply-templates> | |
219 </xsl:when> | |
220 <xsl:otherwise> | |
221 </xsl:otherwise> | |
222 </xsl:choose> | |
223 | |
224 <xsl:text>pt</xsl:text> | |
225 <xsl:number level="any" format="01" from="book"/> | |
226 <xsl:if test="not($recursive)"> | |
227 <xsl:value-of select="$html.ext"/> | |
228 </xsl:if> | |
229 </xsl:when> | |
230 | |
231 <xsl:when test="self::reference"> | |
232 <xsl:choose> | |
233 <xsl:when test="/set"> | |
234 <!-- in a set, make sure we inherit the right book info... --> | |
235 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
236 <xsl:with-param name="recursive" select="true()"/> | |
237 </xsl:apply-templates> | |
238 </xsl:when> | |
239 <xsl:otherwise> | |
240 </xsl:otherwise> | |
241 </xsl:choose> | |
242 | |
243 <xsl:text>rn</xsl:text> | |
244 <xsl:number level="any" format="01" from="book"/> | |
245 <xsl:if test="not($recursive)"> | |
246 <xsl:value-of select="$html.ext"/> | |
247 </xsl:if> | |
248 </xsl:when> | |
249 | |
250 <xsl:when test="self::refentry"> | |
251 <xsl:choose> | |
252 <xsl:when test="parent::reference"> | |
253 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
254 <xsl:with-param name="recursive" select="true()"/> | |
255 </xsl:apply-templates> | |
256 </xsl:when> | |
257 <xsl:otherwise> | |
258 <xsl:if test="/set"> | |
259 <!-- in a set, make sure we inherit the right book info... --> | |
260 <xsl:apply-templates mode="recursive-chunk-filename" select="parent:
:*"> | |
261 <xsl:with-param name="recursive" select="true()"/> | |
262 </xsl:apply-templates> | |
263 </xsl:if> | |
264 </xsl:otherwise> | |
265 </xsl:choose> | |
266 | |
267 <xsl:text>re</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::colophon"> | |
275 <xsl:choose> | |
276 <xsl:when test="/set"> | |
277 <!-- in a set, make sure we inherit the right book info... --> | |
278 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
279 <xsl:with-param name="recursive" select="true()"/> | |
280 </xsl:apply-templates> | |
281 </xsl:when> | |
282 <xsl:otherwise> | |
283 </xsl:otherwise> | |
284 </xsl:choose> | |
285 | |
286 <xsl:text>co</xsl:text> | |
287 <xsl:number level="any" format="01" from="book"/> | |
288 <xsl:if test="not($recursive)"> | |
289 <xsl:value-of select="$html.ext"/> | |
290 </xsl:if> | |
291 </xsl:when> | |
292 | |
293 <xsl:when test="self::sect1 | |
294 or self::sect2 | |
295 or self::sect3 | |
296 or self::sect4 | |
297 or self::sect5 | |
298 or self::section"> | |
299 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*"> | |
300 <xsl:with-param name="recursive" select="true()"/> | |
301 </xsl:apply-templates> | |
302 <xsl:text>s</xsl:text> | |
303 <xsl:number format="01"/> | |
304 <xsl:if test="not($recursive)"> | |
305 <xsl:value-of select="$html.ext"/> | |
306 </xsl:if> | |
307 </xsl:when> | |
308 | |
309 <xsl:when test="self::bibliography"> | |
310 <xsl:choose> | |
311 <xsl:when test="/set"> | |
312 <!-- in a set, make sure we inherit the right book info... --> | |
313 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
314 <xsl:with-param name="recursive" select="true()"/> | |
315 </xsl:apply-templates> | |
316 </xsl:when> | |
317 <xsl:otherwise> | |
318 </xsl:otherwise> | |
319 </xsl:choose> | |
320 | |
321 <xsl:text>bi</xsl:text> | |
322 <xsl:number level="any" format="01" from="book"/> | |
323 <xsl:if test="not($recursive)"> | |
324 <xsl:value-of select="$html.ext"/> | |
325 </xsl:if> | |
326 </xsl:when> | |
327 | |
328 <xsl:when test="self::glossary"> | |
329 <xsl:choose> | |
330 <xsl:when test="/set"> | |
331 <!-- in a set, make sure we inherit the right book info... --> | |
332 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
333 <xsl:with-param name="recursive" select="true()"/> | |
334 </xsl:apply-templates> | |
335 </xsl:when> | |
336 <xsl:otherwise> | |
337 </xsl:otherwise> | |
338 </xsl:choose> | |
339 | |
340 <xsl:text>go</xsl:text> | |
341 <xsl:number level="any" format="01" from="book"/> | |
342 <xsl:if test="not($recursive)"> | |
343 <xsl:value-of select="$html.ext"/> | |
344 </xsl:if> | |
345 </xsl:when> | |
346 | |
347 <xsl:when test="self::index"> | |
348 <xsl:choose> | |
349 <xsl:when test="/set"> | |
350 <!-- in a set, make sure we inherit the right book info... --> | |
351 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
352 <xsl:with-param name="recursive" select="true()"/> | |
353 </xsl:apply-templates> | |
354 </xsl:when> | |
355 <xsl:otherwise> | |
356 </xsl:otherwise> | |
357 </xsl:choose> | |
358 | |
359 <xsl:text>ix</xsl:text> | |
360 <xsl:number level="any" format="01" from="book"/> | |
361 <xsl:if test="not($recursive)"> | |
362 <xsl:value-of select="$html.ext"/> | |
363 </xsl:if> | |
364 </xsl:when> | |
365 | |
366 <xsl:when test="self::setindex"> | |
367 <xsl:text>si</xsl:text> | |
368 <xsl:number level="any" format="01" from="set"/> | |
369 <xsl:if test="not($recursive)"> | |
370 <xsl:value-of select="$html.ext"/> | |
371 </xsl:if> | |
372 </xsl:when> | |
373 | |
374 <xsl:when test="self::topic"> | |
375 <xsl:choose> | |
376 <xsl:when test="/set"> | |
377 <!-- in a set, make sure we inherit the right book info... --> | |
378 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*
"> | |
379 <xsl:with-param name="recursive" select="true()"/> | |
380 </xsl:apply-templates> | |
381 </xsl:when> | |
382 <xsl:otherwise> | |
383 </xsl:otherwise> | |
384 </xsl:choose> | |
385 | |
386 <xsl:text>to</xsl:text> | |
387 <xsl:number level="any" format="01" from="book"/> | |
388 <xsl:if test="not($recursive)"> | |
389 <xsl:value-of select="$html.ext"/> | |
390 </xsl:if> | |
391 </xsl:when> | |
392 | |
393 <xsl:otherwise> | |
394 <xsl:text>chunk-filename-error-</xsl:text> | |
395 <xsl:value-of select="name(.)"/> | |
396 <xsl:number level="any" format="01" from="set"/> | |
397 <xsl:if test="not($recursive)"> | |
398 <xsl:value-of select="$html.ext"/> | |
399 </xsl:if> | |
400 </xsl:otherwise> | |
401 </xsl:choose> | |
402 </xsl:template> | |
403 | |
404 <!-- ==================================================================== --> | |
405 | |
406 | |
407 | |
408 <xsl:template match="processing-instruction('dbhtml')"> | |
409 <!-- nop --> | |
410 </xsl:template> | |
411 | |
412 <!-- ==================================================================== --> | |
413 | |
414 | |
415 <xsl:template match="*" mode="find.chunks"> | |
416 <xsl:variable name="chunk"> | |
417 <xsl:call-template name="chunk"/> | |
418 </xsl:variable> | |
419 | |
420 <xsl:choose> | |
421 <xsl:when test="$chunk != 0"> | |
422 <cf:div id="{generate-id()}"> | |
423 <xsl:apply-templates select="." mode="class.attribute"/> | |
424 <xsl:apply-templates select="*" mode="find.chunks"/> | |
425 </cf:div> | |
426 </xsl:when> | |
427 <xsl:otherwise> | |
428 <xsl:apply-templates select="*" mode="find.chunks"/> | |
429 </xsl:otherwise> | |
430 </xsl:choose> | |
431 </xsl:template> | |
432 | |
433 <!-- Leave legalnotice chunk out of the list for Next and Prev --> | |
434 <xsl:template match="legalnotice" mode="find.chunks"/> | |
435 | |
436 <xsl:template match="/"> | |
437 <!-- * Get a title for current doc so that we let the user --> | |
438 <!-- * know what document we are processing at this point. --> | |
439 <xsl:variable name="doc.title"> | |
440 <xsl:call-template name="get.doc.title"/> | |
441 </xsl:variable> | |
442 <xsl:choose> | |
443 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document, | |
444 toss the namespace and continue. Use the docbook5 namespaced | |
445 stylesheets for DocBook5 if you don't want to use this feature.--> | |
446 <xsl:when test="$exsl.node.set.available != 0 | |
447 and (*/self::ng:* or */self::db:*)"> | |
448 | |
449 <xsl:call-template name="log.message"> | |
450 <xsl:with-param name="level">Note</xsl:with-param> | |
451 <xsl:with-param name="source" select="$doc.title"/> | |
452 <xsl:with-param name="context-desc"> | |
453 <xsl:text>namesp. cut</xsl:text> | |
454 </xsl:with-param> | |
455 <xsl:with-param name="message"> | |
456 <xsl:text>processing stripped document</xsl:text> | |
457 </xsl:with-param> | |
458 </xsl:call-template> | |
459 | |
460 <xsl:apply-templates select="exsl:node-set($no.namespace)"/> | |
461 </xsl:when> | |
462 <!-- Can't process unless namespace removed --> | |
463 <xsl:when test="*/self::ng:* or */self::db:*"> | |
464 <xsl:message terminate="yes"> | |
465 <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text> | |
466 <xsl:text> cannot proceed.</xsl:text> | |
467 </xsl:message> | |
468 </xsl:when> | |
469 <xsl:otherwise> | |
470 <xsl:choose> | |
471 <xsl:when test="$rootid != ''"> | |
472 <xsl:choose> | |
473 <xsl:when test="count(key('id',$rootid)) = 0"> | |
474 <xsl:message terminate="yes"> | |
475 <xsl:text>ID '</xsl:text> | |
476 <xsl:value-of select="$rootid"/> | |
477 <xsl:text>' not found in document.</xsl:text> | |
478 </xsl:message> | |
479 </xsl:when> | |
480 <xsl:otherwise> | |
481 <xsl:if test="$collect.xref.targets = 'yes' or | |
482 $collect.xref.targets = 'only'"> | |
483 <xsl:apply-templates select="key('id', $rootid)" | |
484 mode="collect.targets"/> | |
485 </xsl:if> | |
486 <xsl:if test="$collect.xref.targets != 'only'"> | |
487 <xsl:apply-templates select="key('id',$rootid)" | |
488 mode="process.root"/> | |
489 <xsl:if test="$tex.math.in.alt != ''"> | |
490 <xsl:apply-templates select="key('id',$rootid)" | |
491 mode="collect.tex.math"/> | |
492 </xsl:if> | |
493 <xsl:if test="$generate.manifest != 0"> | |
494 <xsl:call-template name="generate.manifest"> | |
495 <xsl:with-param name="node" select="key('id',$rootid)"/> | |
496 </xsl:call-template> | |
497 </xsl:if> | |
498 </xsl:if> | |
499 </xsl:otherwise> | |
500 </xsl:choose> | |
501 </xsl:when> | |
502 <xsl:otherwise> | |
503 <xsl:if test="$collect.xref.targets = 'yes' or | |
504 $collect.xref.targets = 'only'"> | |
505 <xsl:apply-templates select="/" mode="collect.targets"/> | |
506 </xsl:if> | |
507 <xsl:if test="$collect.xref.targets != 'only'"> | |
508 <xsl:apply-templates select="/" mode="process.root"/> | |
509 <xsl:if test="$tex.math.in.alt != ''"> | |
510 <xsl:apply-templates select="/" mode="collect.tex.math"/> | |
511 </xsl:if> | |
512 <xsl:if test="$generate.manifest != 0"> | |
513 <xsl:call-template name="generate.manifest"> | |
514 <xsl:with-param name="node" select="/"/> | |
515 </xsl:call-template> | |
516 </xsl:if> | |
517 </xsl:if> | |
518 </xsl:otherwise> | |
519 </xsl:choose> | |
520 </xsl:otherwise> | |
521 </xsl:choose> | |
522 </xsl:template> | |
523 | |
524 <xsl:template match="*" mode="process.root"> | |
525 <xsl:apply-templates select="."/> | |
526 <xsl:call-template name="generate.css.files"/> | |
527 </xsl:template> | |
528 | |
529 <!-- ====================================================================== --> | |
530 | |
531 <xsl:template match="set|book|part|preface|chapter|appendix | |
532 |article | |
533 |topic | |
534 |reference|refentry | |
535 |book/glossary|article/glossary|part/glossary | |
536 |book/bibliography|article/bibliography|part/bibliography | |
537 |colophon"> | |
538 <xsl:choose> | |
539 <xsl:when test="$onechunk != 0 and parent::*"> | |
540 <xsl:apply-imports/> | |
541 </xsl:when> | |
542 <xsl:otherwise> | |
543 <xsl:call-template name="process-chunk-element"/> | |
544 </xsl:otherwise> | |
545 </xsl:choose> | |
546 </xsl:template> | |
547 | |
548 <xsl:template match="sect1|sect2|sect3|sect4|sect5|section"> | |
549 <xsl:variable name="ischunk"> | |
550 <xsl:call-template name="chunk"/> | |
551 </xsl:variable> | |
552 | |
553 <xsl:choose> | |
554 <xsl:when test="not(parent::*)"> | |
555 <xsl:call-template name="process-chunk-element"/> | |
556 </xsl:when> | |
557 <xsl:when test="$ischunk = 0"> | |
558 <xsl:apply-imports/> | |
559 </xsl:when> | |
560 <xsl:otherwise> | |
561 <xsl:call-template name="process-chunk-element"/> | |
562 </xsl:otherwise> | |
563 </xsl:choose> | |
564 </xsl:template> | |
565 | |
566 <xsl:template match="setindex | |
567 |book/index | |
568 |article/index | |
569 |part/index"> | |
570 <!-- some implementations use completely empty index tags to indicate --> | |
571 <!-- where an automatically generated index should be inserted. so --> | |
572 <!-- if the index is completely empty, skip it. --> | |
573 <xsl:if test="count(*)>0 or $generate.index != '0'"> | |
574 <xsl:call-template name="process-chunk-element"/> | |
575 </xsl:if> | |
576 </xsl:template> | |
577 | |
578 <!-- Resolve xml:base attributes --> | |
579 <xsl:template match="@fileref"> | |
580 <!-- need a check for absolute urls --> | |
581 <xsl:choose> | |
582 <xsl:when test="contains(., ':')"> | |
583 <!-- it has a uri scheme so it is an absolute uri --> | |
584 <xsl:value-of select="."/> | |
585 </xsl:when> | |
586 <xsl:when test="$keep.relative.image.uris != 0"> | |
587 <!-- leave it alone --> | |
588 <xsl:value-of select="."/> | |
589 </xsl:when> | |
590 <xsl:otherwise> | |
591 <!-- its a relative uri --> | |
592 <xsl:call-template name="relative-uri"> | |
593 <xsl:with-param name="destdir"> | |
594 <xsl:call-template name="dbhtml-dir"> | |
595 <xsl:with-param name="context" select=".."/> | |
596 </xsl:call-template> | |
597 </xsl:with-param> | |
598 </xsl:call-template> | |
599 </xsl:otherwise> | |
600 </xsl:choose> | |
601 </xsl:template> | |
602 | |
603 <!-- ==================================================================== --> | |
604 <xsl:template match="set|book|part|preface|chapter|appendix | |
605 |article | |
606 |topic | |
607 |reference|refentry | |
608 |sect1|sect2|sect3|sect4|sect5 | |
609 |section | |
610 |book/glossary|article/glossary|part/glossary | |
611 |book/bibliography|article/bibliography|part/bibliography | |
612 |colophon" | |
613 mode="enumerate-files"> | |
614 <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable> | |
615 <xsl:if test="$ischunk='1'"> | |
616 <xsl:call-template name="make-relative-filename"> | |
617 <xsl:with-param name="base.dir"> | |
618 <xsl:if test="$manifest.in.base.dir = 0"> | |
619 <xsl:value-of select="$chunk.base.dir"/> | |
620 </xsl:if> | |
621 </xsl:with-param> | |
622 <xsl:with-param name="base.name"> | |
623 <xsl:apply-templates mode="chunk-filename" select="."/> | |
624 </xsl:with-param> | |
625 </xsl:call-template> | |
626 <xsl:text> </xsl:text> | |
627 </xsl:if> | |
628 <xsl:apply-templates select="*" mode="enumerate-files"/> | |
629 </xsl:template> | |
630 | |
631 <xsl:template match="book/index|article/index|part/index" | |
632 mode="enumerate-files"> | |
633 <xsl:if test="$htmlhelp.output != 1"> | |
634 <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable
> | |
635 <xsl:if test="$ischunk='1'"> | |
636 <xsl:call-template name="make-relative-filename"> | |
637 <xsl:with-param name="base.dir"> | |
638 <xsl:if test="$manifest.in.base.dir = 0"> | |
639 <xsl:value-of select="$chunk.base.dir"/> | |
640 </xsl:if> | |
641 </xsl:with-param> | |
642 <xsl:with-param name="base.name"> | |
643 <xsl:apply-templates mode="chunk-filename" select="."/> | |
644 </xsl:with-param> | |
645 </xsl:call-template> | |
646 <xsl:text> </xsl:text> | |
647 </xsl:if> | |
648 <xsl:apply-templates select="*" mode="enumerate-files"/> | |
649 </xsl:if> | |
650 </xsl:template> | |
651 | |
652 <xsl:template match="legalnotice" mode="enumerate-files"> | |
653 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> | |
654 <xsl:if test="$generate.legalnotice.link != 0"> | |
655 <xsl:call-template name="make-relative-filename"> | |
656 <xsl:with-param name="base.dir"> | |
657 <xsl:if test="$manifest.in.base.dir = 0"> | |
658 <xsl:value-of select="$chunk.base.dir"/> | |
659 </xsl:if> | |
660 </xsl:with-param> | |
661 <xsl:with-param name="base.name"> | |
662 <xsl:apply-templates mode="chunk-filename" select="."/> | |
663 </xsl:with-param> | |
664 </xsl:call-template> | |
665 <xsl:text> </xsl:text> | |
666 </xsl:if> | |
667 </xsl:template> | |
668 | |
669 <xsl:template match="mediaobject[imageobject] | inlinemediaobject[imageobject]"
mode="enumerate-files"> | |
670 <xsl:variable name="longdesc.uri"> | |
671 <xsl:call-template name="longdesc.uri"> | |
672 <xsl:with-param name="mediaobject" | |
673 select="."/> | |
674 </xsl:call-template> | |
675 </xsl:variable> | |
676 <xsl:variable name="mediaobject" select="."/> | |
677 | |
678 <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]"> | |
679 <xsl:call-template name="longdesc.uri"> | |
680 <xsl:with-param name="mediaobject" select="$mediaobject"/> | |
681 </xsl:call-template> | |
682 <xsl:text> </xsl:text> | |
683 </xsl:if> | |
684 </xsl:template> | |
685 | |
686 <xsl:template match="text()" mode="enumerate-files"> | |
687 </xsl:template> | |
688 | |
689 </xsl:stylesheet> | |
OLD | NEW |