]> git.lyx.org Git - lyx.git/blob - lib/docbook/xhtml/chunk-code.xsl
Release notes
[lyx.git] / lib / docbook / xhtml / chunk-code.xsl
1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl cf d" version="1.0">
2
3 <!-- ********************************************************************
4
5      This file is part of the XSL DocBook Stylesheet distribution.
6      See ../README or http://cdn.docbook.org/release/xsl/current/ for
7      copyright and other information.
8
9      ******************************************************************** -->
10
11 <!-- ==================================================================== -->
12
13
14 <xsl:template match="*" mode="chunk-filename">
15   <!-- returns the filename of a chunk -->
16   <xsl:variable name="ischunk">
17     <xsl:call-template name="chunk"/>
18   </xsl:variable>
19
20   <xsl:variable name="fn">
21     <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
22   </xsl:variable>
23
24   <!--
25   <xsl:message>
26     <xsl:value-of select="$ischunk"/>
27     <xsl:text> (</xsl:text>
28     <xsl:value-of select="local-name(.)"/>
29     <xsl:text>) </xsl:text>
30     <xsl:value-of select="$fn"/>
31     <xsl:text>, </xsl:text>
32     <xsl:call-template name="dbhtml-dir"/>
33   </xsl:message>
34   -->
35
36   <!-- 2003-11-25 by ndw:
37        The following test used to read test="$ischunk != 0 and $fn != ''"
38        I've removed the ischunk part of the test so that href.to.uri and
39        href.from.uri will be fully qualified even if the source or target
40        isn't a chunk. I *think* that if $fn != '' then it's appropriate
41        to put the directory on the front, even if the element isn't a
42        chunk. I could be wrong. -->
43
44   <xsl:if test="$fn != ''">
45     <xsl:call-template name="dbhtml-dir"/>
46   </xsl:if>
47
48   <xsl:value-of select="$chunked.filename.prefix"/>
49
50   <xsl:value-of select="$fn"/>
51   <!-- You can't add the html.ext here because dbhtml filename= may already -->
52   <!-- have added it. It really does have to be handled in the recursive template -->
53 </xsl:template>
54
55 <xsl:template match="*" mode="recursive-chunk-filename">
56   <xsl:param name="recursive" select="false()"/>
57
58   <!-- returns the filename of a chunk -->
59   <xsl:variable name="ischunk">
60     <xsl:call-template name="chunk"/>
61   </xsl:variable>
62
63   <xsl:variable name="dbhtml-filename">
64     <xsl:call-template name="pi.dbhtml_filename"/>
65   </xsl:variable>
66
67   <xsl:variable name="filename">
68     <xsl:choose>
69       <xsl:when test="$dbhtml-filename != ''">
70         <xsl:value-of select="$dbhtml-filename"/>
71       </xsl:when>
72       <!-- if this is the root element, use the root.filename -->
73       <xsl:when test="not(parent::*) and $root.filename != ''">
74         <xsl:value-of select="$root.filename"/>
75         <xsl:value-of select="$html.ext"/>
76       </xsl:when>
77       <!-- Special case -->
78       <xsl:when test="self::d:legalnotice and not($generate.legalnotice.link = 0)">
79         <xsl:choose>
80           <xsl:when test="(@id or @xml:id) and not($use.id.as.filename = 0)">
81             <!-- * if this legalnotice has an ID, then go ahead and use -->
82             <!-- * just the value of that ID as the basename for the file -->
83             <!-- * (that is, without prepending an "ln-" too it) -->
84             <xsl:value-of select="(@id|@xml:id)[1]"/>
85             <xsl:value-of select="$html.ext"/>
86           </xsl:when>
87           <xsl:otherwise>
88             <!-- * otherwise, if this legalnotice does not have an ID, -->
89             <!-- * then we generate an ID... -->
90             <xsl:variable name="id">
91               <xsl:call-template name="object.id"/>
92             </xsl:variable>
93             <!-- * ...and then we take that generated ID, prepend an -->
94             <!-- * "ln-" to it, and use that as the basename for the file -->
95             <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
96           </xsl:otherwise>
97         </xsl:choose>
98       </xsl:when>
99       <!-- if there's no dbhtml filename, and if we're to use IDs as -->
100       <!-- filenames, then use the ID to generate the filename. -->
101       <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0">
102         <xsl:value-of select="(@id|@xml:id)[1]"/>
103         <xsl:value-of select="$html.ext"/>
104       </xsl:when>
105       <xsl:otherwise/>
106     </xsl:choose>
107   </xsl:variable>
108
109   <xsl:choose>
110     <xsl:when test="$ischunk='0'">
111       <!-- if called on something that isn't a chunk, walk up... -->
112       <xsl:choose>
113         <xsl:when test="count(parent::*)&gt;0">
114           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
115             <xsl:with-param name="recursive" select="$recursive"/>
116           </xsl:apply-templates>
117         </xsl:when>
118         <!-- unless there is no up, in which case return "" -->
119         <xsl:otherwise/>
120       </xsl:choose>
121     </xsl:when>
122
123     <xsl:when test="not($recursive) and $filename != ''">
124       <!-- if this chunk has an explicit name, use it -->
125       <xsl:value-of select="$filename"/>
126     </xsl:when>
127
128     <!-- treat nested set separate from root -->
129     <xsl:when test="self::d:set and ancestor::d:set">
130       <xsl:text>se</xsl:text>
131       <xsl:number level="any" format="01"/>
132       <xsl:if test="not($recursive)">
133         <xsl:value-of select="$html.ext"/>
134       </xsl:if>
135     </xsl:when>
136
137     <xsl:when test="self::d: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::d: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::d:article">
153       <xsl:if test="/d: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="d: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::d:preface">
168       <xsl:if test="/d: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="d: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::d:chapter">
183       <xsl:if test="/d: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="d: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::d:appendix">
198       <xsl:if test="/d: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="d: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::d:part">
213       <xsl:choose>
214         <xsl:when test="/d: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="d: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::d:reference">
232       <xsl:choose>
233         <xsl:when test="/d: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="d: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::d:refentry">
251       <xsl:choose>
252         <xsl:when test="parent::d: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="/d: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="d: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::d:colophon">
275       <xsl:choose>
276         <xsl:when test="/d: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="d: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::d:sect1                     or self::d:sect2                     or self::d:sect3                     or self::d:sect4                     or self::d:sect5                     or self::d:section">
294       <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
295         <xsl:with-param name="recursive" select="true()"/>
296       </xsl:apply-templates>
297       <xsl:text>s</xsl:text>
298       <xsl:number format="01"/>
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::d:bibliography">
305       <xsl:choose>
306         <xsl:when test="/d:set">
307           <!-- in a set, make sure we inherit the right book info... -->
308           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
309             <xsl:with-param name="recursive" select="true()"/>
310           </xsl:apply-templates>
311         </xsl:when>
312         <xsl:otherwise>
313         </xsl:otherwise>
314       </xsl:choose>
315
316       <xsl:text>bi</xsl:text>
317       <xsl:number level="any" format="01" from="d:book"/>
318       <xsl:if test="not($recursive)">
319         <xsl:value-of select="$html.ext"/>
320       </xsl:if>
321     </xsl:when>
322
323     <xsl:when test="self::d:glossary">
324       <xsl:choose>
325         <xsl:when test="/d:set">
326           <!-- in a set, make sure we inherit the right book info... -->
327           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
328             <xsl:with-param name="recursive" select="true()"/>
329           </xsl:apply-templates>
330         </xsl:when>
331         <xsl:otherwise>
332         </xsl:otherwise>
333       </xsl:choose>
334
335       <xsl:text>go</xsl:text>
336       <xsl:number level="any" format="01" from="d:book"/>
337       <xsl:if test="not($recursive)">
338         <xsl:value-of select="$html.ext"/>
339       </xsl:if>
340     </xsl:when>
341
342     <xsl:when test="self::d:index">
343       <xsl:choose>
344         <xsl:when test="/d:set">
345           <!-- in a set, make sure we inherit the right book info... -->
346           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
347             <xsl:with-param name="recursive" select="true()"/>
348           </xsl:apply-templates>
349         </xsl:when>
350         <xsl:otherwise>
351         </xsl:otherwise>
352       </xsl:choose>
353
354       <xsl:text>ix</xsl:text>
355       <xsl:number level="any" format="01" from="d:book"/>
356       <xsl:if test="not($recursive)">
357         <xsl:value-of select="$html.ext"/>
358       </xsl:if>
359     </xsl:when>
360
361     <xsl:when test="self::d:setindex">
362       <xsl:text>si</xsl:text>
363       <xsl:number level="any" format="01" from="d:set"/>
364       <xsl:if test="not($recursive)">
365         <xsl:value-of select="$html.ext"/>
366       </xsl:if>
367     </xsl:when>
368
369     <xsl:when test="self::d:topic">
370       <xsl:choose>
371         <xsl:when test="/d:set">
372           <!-- in a set, make sure we inherit the right book info... -->
373           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
374             <xsl:with-param name="recursive" select="true()"/>
375           </xsl:apply-templates>
376         </xsl:when>
377         <xsl:otherwise>
378         </xsl:otherwise>
379       </xsl:choose>
380
381       <xsl:text>to</xsl:text>
382       <xsl:number level="any" format="01" from="d:book"/>
383       <xsl:if test="not($recursive)">
384         <xsl:value-of select="$html.ext"/>
385       </xsl:if>
386     </xsl:when>
387
388     <xsl:otherwise>
389       <xsl:text>chunk-filename-error-</xsl:text>
390       <xsl:value-of select="name(.)"/>
391       <xsl:number level="any" format="01" from="d:set"/>
392       <xsl:if test="not($recursive)">
393         <xsl:value-of select="$html.ext"/>
394       </xsl:if>
395     </xsl:otherwise>
396   </xsl:choose>
397 </xsl:template>
398
399 <!-- ==================================================================== -->
400
401
402
403 <xsl:template match="processing-instruction('dbhtml')">
404   <!-- nop -->
405 </xsl:template>
406
407 <!-- ==================================================================== -->
408
409
410 <xsl:template match="*" mode="find.chunks">
411   <xsl:variable name="chunk">
412     <xsl:call-template name="chunk"/>
413   </xsl:variable>
414
415   <xsl:choose>
416     <xsl:when test="$chunk != 0">
417       <cf:div id="{generate-id()}">
418         <xsl:apply-templates select="." mode="class.attribute"/>
419         <xsl:apply-templates select="*" mode="find.chunks"/>
420       </cf:div>
421     </xsl:when>
422     <xsl:otherwise>
423       <xsl:apply-templates select="*" mode="find.chunks"/>
424     </xsl:otherwise>
425   </xsl:choose>
426 </xsl:template>
427
428 <!-- Leave legalnotice chunk out of the list for Next and Prev -->
429 <xsl:template match="d:legalnotice" mode="find.chunks"/>
430
431 <xsl:template match="/">
432   <!-- * Get a title for current doc so that we let the user -->
433   <!-- * know what document we are processing at this point. -->
434   <xsl:variable name="doc.title">
435     <xsl:call-template name="get.doc.title"/>
436   </xsl:variable>
437   <xsl:choose>
438     <xsl:when test="$exsl.node.set.available != 0 and                    namespace-uri(/*) != 'http://docbook.org/ns/docbook'">
439       <xsl:call-template name="log.message">
440         <xsl:with-param name="level">Note</xsl:with-param>
441         <xsl:with-param name="source" select="$doc.title"/>
442         <xsl:with-param name="context-desc">
443           <xsl:text>namesp. add</xsl:text>
444         </xsl:with-param>
445         <xsl:with-param name="message">
446           <xsl:text>added namespace before processing</xsl:text>
447         </xsl:with-param>
448       </xsl:call-template>
449
450       <xsl:apply-templates select="exsl:node-set($with.namespace)"/>
451     </xsl:when>
452     <!-- Can't process unless namespace fixed with exsl node-set()-->
453     <xsl:when test="namespace-uri(/*) != 'http://docbook.org/ns/docbook'">
454       <xsl:message terminate="yes">
455         <xsl:text>Unable to add the namespace from DB4 document,</xsl:text>
456         <xsl:text> cannot proceed.</xsl:text>
457       </xsl:message>
458     </xsl:when>
459     <xsl:otherwise>
460       <xsl:choose>
461         <xsl:when test="$rootid != ''">
462           <xsl:choose>
463             <xsl:when test="count(key('id',$rootid)) = 0">
464               <xsl:message terminate="yes">
465                 <xsl:text>ID '</xsl:text>
466                 <xsl:value-of select="$rootid"/>
467                 <xsl:text>' not found in document.</xsl:text>
468               </xsl:message>
469             </xsl:when>
470             <xsl:otherwise>
471               <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
472                 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
473               </xsl:if>
474               <xsl:if test="$collect.xref.targets != 'only'">
475                 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
476                 <xsl:if test="$tex.math.in.alt != ''">
477                   <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
478                 </xsl:if>
479                 <xsl:if test="$generate.manifest != 0">
480                   <xsl:call-template name="generate.manifest">
481                     <xsl:with-param name="node" select="key('id',$rootid)"/>
482                   </xsl:call-template>
483                 </xsl:if>
484               </xsl:if>
485             </xsl:otherwise>
486           </xsl:choose>
487         </xsl:when>
488         <xsl:otherwise>
489           <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
490             <xsl:apply-templates select="/" mode="collect.targets"/>
491           </xsl:if>
492           <xsl:if test="$collect.xref.targets != 'only'">
493             <xsl:apply-templates select="/" mode="process.root"/>
494             <xsl:if test="$tex.math.in.alt != ''">
495               <xsl:apply-templates select="/" mode="collect.tex.math"/>
496             </xsl:if>
497             <xsl:if test="$generate.manifest != 0">
498               <xsl:call-template name="generate.manifest">
499                 <xsl:with-param name="node" select="/"/>
500               </xsl:call-template>
501             </xsl:if>
502           </xsl:if>
503         </xsl:otherwise>
504       </xsl:choose>
505     </xsl:otherwise>
506   </xsl:choose>
507 </xsl:template>
508
509 <xsl:template match="*" mode="process.root">
510   <xsl:apply-templates select="."/>
511   <xsl:call-template name="generate.css.files"/>
512 </xsl:template>
513
514 <!-- ====================================================================== -->
515
516 <xsl:template match="d:set|d:book|d:part|d:preface|d:chapter|d:appendix                      |d:article                      |d:topic                      |d:reference|d:refentry                      |d:book/d:glossary|d:article/d:glossary|d:part/d:glossary                      |d:book/d:bibliography|d:article/d:bibliography|d:part/d:bibliography                      |d:colophon">
517   <xsl:choose>
518     <xsl:when test="$onechunk != 0 and parent::*">
519       <xsl:apply-imports/>
520     </xsl:when>
521     <xsl:otherwise>
522       <xsl:call-template name="process-chunk-element"/>
523     </xsl:otherwise>
524   </xsl:choose>
525 </xsl:template>
526
527 <xsl:template match="d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d:section">
528   <xsl:variable name="ischunk">
529     <xsl:call-template name="chunk"/>
530   </xsl:variable>
531
532   <xsl:choose>
533     <xsl:when test="not(parent::*)">
534       <xsl:call-template name="process-chunk-element"/>
535     </xsl:when>
536     <xsl:when test="$ischunk = 0">
537       <xsl:apply-imports/>
538     </xsl:when>
539     <xsl:otherwise>
540       <xsl:call-template name="process-chunk-element"/>
541     </xsl:otherwise>
542   </xsl:choose>
543 </xsl:template>
544
545 <xsl:template match="d:setindex                      |d:book/d:index                      |d:article/d:index                      |d:part/d:index">
546   <!-- some implementations use completely empty index tags to indicate -->
547   <!-- where an automatically generated index should be inserted. so -->
548   <!-- if the index is completely empty, skip it. -->
549   <xsl:if test="count(*)&gt;0 or $generate.index != '0'">
550     <xsl:call-template name="process-chunk-element"/>
551   </xsl:if>
552 </xsl:template>
553
554 <!-- Resolve xml:base attributes -->
555 <xsl:template match="@fileref">
556   <!-- need a check for absolute urls -->
557   <xsl:choose>
558     <xsl:when test="contains(., ':')">
559       <!-- it has a uri scheme so it is an absolute uri -->
560       <xsl:value-of select="."/>
561     </xsl:when>
562     <xsl:when test="$keep.relative.image.uris != 0">
563       <!-- leave it alone -->
564       <xsl:value-of select="."/>
565     </xsl:when>
566     <xsl:otherwise>
567       <!-- its a relative uri -->
568       <xsl:call-template name="relative-uri">
569         <xsl:with-param name="destdir">
570           <xsl:call-template name="dbhtml-dir">
571             <xsl:with-param name="context" select=".."/>
572           </xsl:call-template>
573         </xsl:with-param>
574       </xsl:call-template>
575     </xsl:otherwise>
576   </xsl:choose>
577 </xsl:template>
578
579 <!-- ==================================================================== -->
580 <xsl:template match="d:set|d:book|d:part|d:preface|d:chapter|d:appendix                      |d:article                      |d:topic                      |d:reference|d:refentry                      |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5                      |d:section                      |d:book/d:glossary|d:article/d:glossary|d:part/d:glossary                      |d:book/d:bibliography|d:article/d:bibliography|d:part/d:bibliography                      |d:colophon" mode="enumerate-files">
581   <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
582   <xsl:if test="$ischunk='1'">
583     <xsl:call-template name="make-relative-filename">
584       <xsl:with-param name="base.dir">
585         <xsl:if test="$manifest.in.base.dir = 0">
586           <xsl:value-of select="$chunk.base.dir"/>
587         </xsl:if>
588       </xsl:with-param>
589       <xsl:with-param name="base.name">
590         <xsl:apply-templates mode="chunk-filename" select="."/>
591       </xsl:with-param>
592     </xsl:call-template>
593     <xsl:text>
594 </xsl:text>
595   </xsl:if>
596   <xsl:apply-templates select="*" mode="enumerate-files"/>
597 </xsl:template>
598
599 <xsl:template match="d:book/d:index|d:article/d:index|d:part/d:index" mode="enumerate-files">
600   <xsl:if test="$htmlhelp.output != 1">
601     <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
602     <xsl:if test="$ischunk='1'">
603       <xsl:call-template name="make-relative-filename">
604         <xsl:with-param name="base.dir">
605           <xsl:if test="$manifest.in.base.dir = 0">
606             <xsl:value-of select="$chunk.base.dir"/>
607           </xsl:if>
608         </xsl:with-param>
609         <xsl:with-param name="base.name">
610           <xsl:apply-templates mode="chunk-filename" select="."/>
611         </xsl:with-param>
612       </xsl:call-template>
613       <xsl:text>
614 </xsl:text>
615     </xsl:if>
616     <xsl:apply-templates select="*" mode="enumerate-files"/>
617   </xsl:if>
618 </xsl:template>
619
620 <xsl:template match="d:legalnotice" mode="enumerate-files">
621   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
622   <xsl:if test="$generate.legalnotice.link != 0">
623     <xsl:call-template name="make-relative-filename">
624       <xsl:with-param name="base.dir">
625         <xsl:if test="$manifest.in.base.dir = 0">
626           <xsl:value-of select="$chunk.base.dir"/>
627         </xsl:if>
628       </xsl:with-param>
629       <xsl:with-param name="base.name">
630         <xsl:apply-templates mode="chunk-filename" select="."/>
631       </xsl:with-param>
632     </xsl:call-template>
633     <xsl:text>
634 </xsl:text>
635   </xsl:if>
636 </xsl:template>
637
638 <xsl:template match="d:revhistory" mode="enumerate-files">
639   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
640   <xsl:if test="$generate.revhistory.link != 0">
641     <xsl:call-template name="make-relative-filename">
642       <xsl:with-param name="base.dir">
643         <xsl:if test="$manifest.in.base.dir = 0">
644           <xsl:value-of select="$chunk.base.dir"/>
645         </xsl:if>
646       </xsl:with-param>
647       <xsl:with-param name="base.name">
648         <xsl:call-template name="ln.or.rh.filename">
649           <xsl:with-param name="is.ln" select="false()"/>
650         </xsl:call-template>
651       </xsl:with-param>
652     </xsl:call-template>
653     <xsl:text>
654 </xsl:text>
655   </xsl:if>
656 </xsl:template>
657
658 <xsl:template match="d:mediaobject[d:imageobject] | d:inlinemediaobject[d:imageobject]" mode="enumerate-files">
659   <xsl:variable name="longdesc.uri">
660     <xsl:call-template name="longdesc.uri">
661       <xsl:with-param name="mediaobject" select="."/>
662     </xsl:call-template>
663   </xsl:variable>
664   <xsl:variable name="mediaobject" select="."/>
665
666   <xsl:if test="$html.longdesc != 0 and $mediaobject/d:textobject[not(d:phrase)]">
667     <xsl:call-template name="longdesc.uri">
668       <xsl:with-param name="mediaobject" select="$mediaobject"/>
669     </xsl:call-template>
670     <xsl:text>
671 </xsl:text>
672   </xsl:if>
673 </xsl:template>
674
675 <xsl:template match="text()" mode="enumerate-files">
676 </xsl:template>
677
678 </xsl:stylesheet>