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