Whamcloud - gitweb
LUDOC-120 presentation: build bits for webhelp.
[doc/manual.git] / webhelp / xhtml / chunk-code.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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" version="1.0">
5
6 <!-- ********************************************************************
7      $Id: chunk-code.xsl 9936 2014-08-29 21:34:58Z bobstayton $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18
19 <xsl:template match="*" mode="chunk-filename">
20   <!-- returns the filename of a chunk -->
21   <xsl:variable name="ischunk">
22     <xsl:call-template name="chunk"/>
23   </xsl:variable>
24
25   <xsl:variable name="fn">
26     <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
27   </xsl:variable>
28
29   <!--
30   <xsl:message>
31     <xsl:value-of select="$ischunk"/>
32     <xsl:text> (</xsl:text>
33     <xsl:value-of select="local-name(.)"/>
34     <xsl:text>) </xsl:text>
35     <xsl:value-of select="$fn"/>
36     <xsl:text>, </xsl:text>
37     <xsl:call-template name="dbhtml-dir"/>
38   </xsl:message>
39   -->
40
41   <!-- 2003-11-25 by ndw:
42        The following test used to read test="$ischunk != 0 and $fn != ''"
43        I've removed the ischunk part of the test so that href.to.uri and
44        href.from.uri will be fully qualified even if the source or target
45        isn't a chunk. I *think* that if $fn != '' then it's appropriate
46        to put the directory on the front, even if the element isn't a
47        chunk. I could be wrong. -->
48
49   <xsl:if test="$fn != ''">
50     <xsl:call-template name="dbhtml-dir"/>
51   </xsl:if>
52
53   <xsl:value-of select="$chunked.filename.prefix"/>
54
55   <xsl:value-of select="$fn"/>
56   <!-- You can't add the html.ext here because dbhtml filename= may already -->
57   <!-- have added it. It really does have to be handled in the recursive template -->
58 </xsl:template>
59
60 <xsl:template match="*" mode="recursive-chunk-filename">
61   <xsl:param name="recursive" select="false()"/>
62
63   <!-- returns the filename of a chunk -->
64   <xsl:variable name="ischunk">
65     <xsl:call-template name="chunk"/>
66   </xsl:variable>
67
68   <xsl:variable name="dbhtml-filename">
69     <xsl:call-template name="pi.dbhtml_filename"/>
70   </xsl:variable>
71
72   <xsl:variable name="filename">
73     <xsl:choose>
74       <xsl:when test="$dbhtml-filename != ''">
75         <xsl:value-of select="$dbhtml-filename"/>
76       </xsl:when>
77       <!-- if this is the root element, use the root.filename -->
78       <xsl:when test="not(parent::*) and $root.filename != ''">
79         <xsl:value-of select="$root.filename"/>
80         <xsl:value-of select="$html.ext"/>
81       </xsl:when>
82       <!-- Special case -->
83       <xsl:when test="self::legalnotice and not($generate.legalnotice.link = 0)">
84         <xsl:choose>
85           <xsl:when test="(@id or @xml:id) and not($use.id.as.filename = 0)">
86             <!-- * if this legalnotice has an ID, then go ahead and use -->
87             <!-- * just the value of that ID as the basename for the file -->
88             <!-- * (that is, without prepending an "ln-" too it) -->
89             <xsl:value-of select="(@id|@xml:id)[1]"/>
90             <xsl:value-of select="$html.ext"/>
91           </xsl:when>
92           <xsl:otherwise>
93             <!-- * otherwise, if this legalnotice does not have an ID, -->
94             <!-- * then we generate an ID... -->
95             <xsl:variable name="id">
96               <xsl:call-template name="object.id"/>
97             </xsl:variable>
98             <!-- * ...and then we take that generated ID, prepend an -->
99             <!-- * "ln-" to it, and use that as the basename for the file -->
100             <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
101           </xsl:otherwise>
102         </xsl:choose>
103       </xsl:when>
104       <!-- if there's no dbhtml filename, and if we're to use IDs as -->
105       <!-- filenames, then use the ID to generate the filename. -->
106       <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0">
107         <xsl:value-of select="(@id|@xml:id)[1]"/>
108         <xsl:value-of select="$html.ext"/>
109       </xsl:when>
110       <xsl:otherwise/>
111     </xsl:choose>
112   </xsl:variable>
113
114   <xsl:choose>
115     <xsl:when test="$ischunk='0'">
116       <!-- if called on something that isn't a chunk, walk up... -->
117       <xsl:choose>
118         <xsl:when test="count(parent::*)&gt;0">
119           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
120             <xsl:with-param name="recursive" select="$recursive"/>
121           </xsl:apply-templates>
122         </xsl:when>
123         <!-- unless there is no up, in which case return "" -->
124         <xsl:otherwise/>
125       </xsl:choose>
126     </xsl:when>
127
128     <xsl:when test="not($recursive) and $filename != ''">
129       <!-- if this chunk has an explicit name, use it -->
130       <xsl:value-of select="$filename"/>
131     </xsl:when>
132
133     <!-- treat nested set separate from root -->
134     <xsl:when test="self::set and ancestor::set">
135       <xsl:text>se</xsl:text>
136       <xsl:number level="any" format="01"/>
137       <xsl:if test="not($recursive)">
138         <xsl:value-of select="$html.ext"/>
139       </xsl:if>
140     </xsl:when>
141
142     <xsl:when test="self::set">
143       <xsl:value-of select="$root.filename"/>
144       <xsl:if test="not($recursive)">
145         <xsl:value-of select="$html.ext"/>
146       </xsl:if>
147     </xsl:when>
148
149     <xsl:when test="self::book">
150       <xsl:text>bk</xsl:text>
151       <xsl:number level="any" format="01"/>
152       <xsl:if test="not($recursive)">
153         <xsl:value-of select="$html.ext"/>
154       </xsl:if>
155     </xsl:when>
156
157     <xsl:when test="self::article">
158       <xsl:if test="/set">
159         <!-- in a set, make sure we inherit the right book info... -->
160         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
161           <xsl:with-param name="recursive" select="true()"/>
162         </xsl:apply-templates>
163       </xsl:if>
164
165       <xsl:text>ar</xsl:text>
166       <xsl:number level="any" format="01" from="book"/>
167       <xsl:if test="not($recursive)">
168         <xsl:value-of select="$html.ext"/>
169       </xsl:if>
170     </xsl:when>
171
172     <xsl:when test="self::preface">
173       <xsl:if test="/set">
174         <!-- in a set, make sure we inherit the right book info... -->
175         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
176           <xsl:with-param name="recursive" select="true()"/>
177         </xsl:apply-templates>
178       </xsl:if>
179
180       <xsl:text>pr</xsl:text>
181       <xsl:number level="any" format="01" from="book"/>
182       <xsl:if test="not($recursive)">
183         <xsl:value-of select="$html.ext"/>
184       </xsl:if>
185     </xsl:when>
186
187     <xsl:when test="self::chapter">
188       <xsl:if test="/set">
189         <!-- in a set, make sure we inherit the right book info... -->
190         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
191           <xsl:with-param name="recursive" select="true()"/>
192         </xsl:apply-templates>
193       </xsl:if>
194
195       <xsl:text>ch</xsl:text>
196       <xsl:number level="any" format="01" from="book"/>
197       <xsl:if test="not($recursive)">
198         <xsl:value-of select="$html.ext"/>
199       </xsl:if>
200     </xsl:when>
201
202     <xsl:when test="self::appendix">
203       <xsl:if test="/set">
204         <!-- in a set, make sure we inherit the right book info... -->
205         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
206           <xsl:with-param name="recursive" select="true()"/>
207         </xsl:apply-templates>
208       </xsl:if>
209
210       <xsl:text>ap</xsl:text>
211       <xsl:number level="any" format="a" from="book"/>
212       <xsl:if test="not($recursive)">
213         <xsl:value-of select="$html.ext"/>
214       </xsl:if>
215     </xsl:when>
216
217     <xsl:when test="self::part">
218       <xsl:choose>
219         <xsl:when test="/set">
220           <!-- in a set, make sure we inherit the right book info... -->
221           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
222             <xsl:with-param name="recursive" select="true()"/>
223           </xsl:apply-templates>
224         </xsl:when>
225         <xsl:otherwise>
226         </xsl:otherwise>
227       </xsl:choose>
228
229       <xsl:text>pt</xsl:text>
230       <xsl:number level="any" format="01" from="book"/>
231       <xsl:if test="not($recursive)">
232         <xsl:value-of select="$html.ext"/>
233       </xsl:if>
234     </xsl:when>
235
236     <xsl:when test="self::reference">
237       <xsl:choose>
238         <xsl:when test="/set">
239           <!-- in a set, make sure we inherit the right book info... -->
240           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
241             <xsl:with-param name="recursive" select="true()"/>
242           </xsl:apply-templates>
243         </xsl:when>
244         <xsl:otherwise>
245         </xsl:otherwise>
246       </xsl:choose>
247
248       <xsl:text>rn</xsl:text>
249       <xsl:number level="any" format="01" from="book"/>
250       <xsl:if test="not($recursive)">
251         <xsl:value-of select="$html.ext"/>
252       </xsl:if>
253     </xsl:when>
254
255     <xsl:when test="self::refentry">
256       <xsl:choose>
257         <xsl:when test="parent::reference">
258           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
259             <xsl:with-param name="recursive" select="true()"/>
260           </xsl:apply-templates>
261         </xsl:when>
262         <xsl:otherwise>
263           <xsl:if test="/set">
264             <!-- in a set, make sure we inherit the right book info... -->
265             <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
266               <xsl:with-param name="recursive" select="true()"/>
267             </xsl:apply-templates>
268           </xsl:if>
269         </xsl:otherwise>
270       </xsl:choose>
271
272       <xsl:text>re</xsl:text>
273       <xsl:number level="any" format="01" from="book"/>
274       <xsl:if test="not($recursive)">
275         <xsl:value-of select="$html.ext"/>
276       </xsl:if>
277     </xsl:when>
278
279     <xsl:when test="self::colophon">
280       <xsl:choose>
281         <xsl:when test="/set">
282           <!-- in a set, make sure we inherit the right book info... -->
283           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
284             <xsl:with-param name="recursive" select="true()"/>
285           </xsl:apply-templates>
286         </xsl:when>
287         <xsl:otherwise>
288         </xsl:otherwise>
289       </xsl:choose>
290
291       <xsl:text>co</xsl:text>
292       <xsl:number level="any" format="01" from="book"/>
293       <xsl:if test="not($recursive)">
294         <xsl:value-of select="$html.ext"/>
295       </xsl:if>
296     </xsl:when>
297
298     <xsl:when test="self::sect1                     or self::sect2                     or self::sect3                     or self::sect4                     or self::sect5                     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     <xsl:when test="$exsl.node.set.available != 0 and                    namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
444       <xsl:call-template name="log.message">
445         <xsl:with-param name="level">Note</xsl:with-param>
446         <xsl:with-param name="source" select="$doc.title"/>
447         <xsl:with-param name="context-desc">
448           <xsl:text>namesp. cut</xsl:text>
449         </xsl:with-param>
450         <xsl:with-param name="message">
451           <xsl:text>stripped namespace before processing</xsl:text>
452         </xsl:with-param>
453       </xsl:call-template>
454
455       <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
456     </xsl:when>
457     <!-- Can't process unless namespace fixed with exsl node-set()-->
458     <xsl:when test="namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
459       <xsl:message terminate="yes">
460         <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
461         <xsl:text> cannot proceed.</xsl:text>
462       </xsl:message>
463     </xsl:when>
464     <xsl:otherwise>
465       <xsl:choose>
466         <xsl:when test="$rootid != ''">
467           <xsl:choose>
468             <xsl:when test="count(key('id',$rootid)) = 0">
469               <xsl:message terminate="yes">
470                 <xsl:text>ID '</xsl:text>
471                 <xsl:value-of select="$rootid"/>
472                 <xsl:text>' not found in document.</xsl:text>
473               </xsl:message>
474             </xsl:when>
475             <xsl:otherwise>
476               <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
477                 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
478               </xsl:if>
479               <xsl:if test="$collect.xref.targets != 'only'">
480                 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
481                 <xsl:if test="$tex.math.in.alt != ''">
482                   <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
483                 </xsl:if>
484                 <xsl:if test="$generate.manifest != 0">
485                   <xsl:call-template name="generate.manifest">
486                     <xsl:with-param name="node" select="key('id',$rootid)"/>
487                   </xsl:call-template>
488                 </xsl:if>
489               </xsl:if>
490             </xsl:otherwise>
491           </xsl:choose>
492         </xsl:when>
493         <xsl:otherwise>
494           <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
495             <xsl:apply-templates select="/" mode="collect.targets"/>
496           </xsl:if>
497           <xsl:if test="$collect.xref.targets != 'only'">
498             <xsl:apply-templates select="/" mode="process.root"/>
499             <xsl:if test="$tex.math.in.alt != ''">
500               <xsl:apply-templates select="/" mode="collect.tex.math"/>
501             </xsl:if>
502             <xsl:if test="$generate.manifest != 0">
503               <xsl:call-template name="generate.manifest">
504                 <xsl:with-param name="node" select="/"/>
505               </xsl:call-template>
506             </xsl:if>
507           </xsl:if>
508         </xsl:otherwise>
509       </xsl:choose>
510     </xsl:otherwise>
511   </xsl:choose>
512 </xsl:template>
513
514 <xsl:template match="*" mode="process.root">
515   <xsl:apply-templates select="."/>
516   <xsl:call-template name="generate.css.files"/>
517 </xsl:template>
518
519 <!-- ====================================================================== -->
520
521 <xsl:template match="set|book|part|preface|chapter|appendix                      |article                      |topic                      |reference|refentry                      |book/glossary|article/glossary|part/glossary                      |book/bibliography|article/bibliography|part/bibliography                      |colophon">
522   <xsl:choose>
523     <xsl:when test="$onechunk != 0 and parent::*">
524       <xsl:apply-imports/>
525     </xsl:when>
526     <xsl:otherwise>
527       <xsl:call-template name="process-chunk-element"/>
528     </xsl:otherwise>
529   </xsl:choose>
530 </xsl:template>
531
532 <xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
533   <xsl:variable name="ischunk">
534     <xsl:call-template name="chunk"/>
535   </xsl:variable>
536
537   <xsl:choose>
538     <xsl:when test="not(parent::*)">
539       <xsl:call-template name="process-chunk-element"/>
540     </xsl:when>
541     <xsl:when test="$ischunk = 0">
542       <xsl:apply-imports/>
543     </xsl:when>
544     <xsl:otherwise>
545       <xsl:call-template name="process-chunk-element"/>
546     </xsl:otherwise>
547   </xsl:choose>
548 </xsl:template>
549
550 <xsl:template match="setindex                      |book/index                      |article/index                      |part/index">
551   <!-- some implementations use completely empty index tags to indicate -->
552   <!-- where an automatically generated index should be inserted. so -->
553   <!-- if the index is completely empty, skip it. -->
554   <xsl:if test="count(*)&gt;0 or $generate.index != '0'">
555     <xsl:call-template name="process-chunk-element"/>
556   </xsl:if>
557 </xsl:template>
558
559 <!-- Resolve xml:base attributes -->
560 <xsl:template match="@fileref">
561   <!-- need a check for absolute urls -->
562   <xsl:choose>
563     <xsl:when test="contains(., ':')">
564       <!-- it has a uri scheme so it is an absolute uri -->
565       <xsl:value-of select="."/>
566     </xsl:when>
567     <xsl:when test="$keep.relative.image.uris != 0">
568       <!-- leave it alone -->
569       <xsl:value-of select="."/>
570     </xsl:when>
571     <xsl:otherwise>
572       <!-- its a relative uri -->
573       <xsl:call-template name="relative-uri">
574         <xsl:with-param name="destdir">
575           <xsl:call-template name="dbhtml-dir">
576             <xsl:with-param name="context" select=".."/>
577           </xsl:call-template>
578         </xsl:with-param>
579       </xsl:call-template>
580     </xsl:otherwise>
581   </xsl:choose>
582 </xsl:template>
583
584 <!-- ==================================================================== -->
585 <xsl:template match="set|book|part|preface|chapter|appendix                      |article                      |topic                      |reference|refentry                      |sect1|sect2|sect3|sect4|sect5                      |section                      |book/glossary|article/glossary|part/glossary                      |book/bibliography|article/bibliography|part/bibliography                      |colophon" mode="enumerate-files">
586   <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
587   <xsl:if test="$ischunk='1'">
588     <xsl:call-template name="make-relative-filename">
589       <xsl:with-param name="base.dir">
590         <xsl:if test="$manifest.in.base.dir = 0">
591           <xsl:value-of select="$chunk.base.dir"/>
592         </xsl:if>
593       </xsl:with-param>
594       <xsl:with-param name="base.name">
595         <xsl:apply-templates mode="chunk-filename" select="."/>
596       </xsl:with-param>
597     </xsl:call-template>
598     <xsl:text>
599 </xsl:text>
600   </xsl:if>
601   <xsl:apply-templates select="*" mode="enumerate-files"/>
602 </xsl:template>
603
604 <xsl:template match="book/index|article/index|part/index" mode="enumerate-files">
605   <xsl:if test="$htmlhelp.output != 1">
606     <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
607     <xsl:if test="$ischunk='1'">
608       <xsl:call-template name="make-relative-filename">
609         <xsl:with-param name="base.dir">
610           <xsl:if test="$manifest.in.base.dir = 0">
611             <xsl:value-of select="$chunk.base.dir"/>
612           </xsl:if>
613         </xsl:with-param>
614         <xsl:with-param name="base.name">
615           <xsl:apply-templates mode="chunk-filename" select="."/>
616         </xsl:with-param>
617       </xsl:call-template>
618       <xsl:text>
619 </xsl:text>
620     </xsl:if>
621     <xsl:apply-templates select="*" mode="enumerate-files"/>
622   </xsl:if>
623 </xsl:template>
624
625 <xsl:template match="legalnotice" mode="enumerate-files">
626   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
627   <xsl:if test="$generate.legalnotice.link != 0">
628     <xsl:call-template name="make-relative-filename">
629       <xsl:with-param name="base.dir">
630         <xsl:if test="$manifest.in.base.dir = 0">
631           <xsl:value-of select="$chunk.base.dir"/>
632         </xsl:if>
633       </xsl:with-param>
634       <xsl:with-param name="base.name">
635         <xsl:apply-templates mode="chunk-filename" select="."/>
636       </xsl:with-param>
637     </xsl:call-template>
638     <xsl:text>
639 </xsl:text>
640   </xsl:if>
641 </xsl:template>
642
643 <xsl:template match="revhistory" mode="enumerate-files">
644   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
645   <xsl:if test="$generate.revhistory.link != 0">
646     <xsl:call-template name="make-relative-filename">
647       <xsl:with-param name="base.dir">
648         <xsl:if test="$manifest.in.base.dir = 0">
649           <xsl:value-of select="$chunk.base.dir"/>
650         </xsl:if>
651       </xsl:with-param>
652       <xsl:with-param name="base.name">
653         <xsl:call-template name="ln.or.rh.filename">
654           <xsl:with-param name="is.ln" select="false()"/>
655         </xsl:call-template>
656       </xsl:with-param>
657     </xsl:call-template>
658     <xsl:text>
659 </xsl:text>
660   </xsl:if>
661 </xsl:template>
662
663 <xsl:template match="mediaobject[imageobject] | inlinemediaobject[imageobject]" mode="enumerate-files">
664   <xsl:variable name="longdesc.uri">
665     <xsl:call-template name="longdesc.uri">
666       <xsl:with-param name="mediaobject" select="."/>
667     </xsl:call-template>
668   </xsl:variable>
669   <xsl:variable name="mediaobject" select="."/>
670
671   <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]">
672     <xsl:call-template name="longdesc.uri">
673       <xsl:with-param name="mediaobject" select="$mediaobject"/>
674     </xsl:call-template>
675     <xsl:text>
676 </xsl:text>
677   </xsl:if>
678 </xsl:template>
679
680 <xsl:template match="text()" mode="enumerate-files">
681 </xsl:template>
682
683 </xsl:stylesheet>