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:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="doc"> |
---|
5 | |
---|
6 | <!-- ******************************************************************** |
---|
7 | $Id$ |
---|
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 | <xsl:import href="docbook.xsl"/> |
---|
19 | <xsl:import href="chunk-common.xsl"/> |
---|
20 | |
---|
21 | <xsl:template name="chunk"> |
---|
22 | <xsl:param name="node" select="."/> |
---|
23 | <!-- returns 1 if $node is a chunk --> |
---|
24 | |
---|
25 | <xsl:variable name="id"> |
---|
26 | <xsl:call-template name="object.id"> |
---|
27 | <xsl:with-param name="object" select="$node"/> |
---|
28 | </xsl:call-template> |
---|
29 | </xsl:variable> |
---|
30 | |
---|
31 | <xsl:variable name="chunks" select="document($chunk.toc,/)"/> |
---|
32 | |
---|
33 | <xsl:choose> |
---|
34 | <xsl:when test="$chunks//tocentry[@linkend=$id]">1</xsl:when> |
---|
35 | <xsl:otherwise>0</xsl:otherwise> |
---|
36 | </xsl:choose> |
---|
37 | </xsl:template> |
---|
38 | |
---|
39 | <!-- ==================================================================== --> |
---|
40 | |
---|
41 | <xsl:template match="*" mode="chunk-filename"> |
---|
42 | <!-- returns the filename of a chunk --> |
---|
43 | |
---|
44 | <xsl:variable name="id"> |
---|
45 | <xsl:call-template name="object.id"/> |
---|
46 | </xsl:variable> |
---|
47 | |
---|
48 | <xsl:variable name="chunks" select="document($chunk.toc,/)"/> |
---|
49 | |
---|
50 | <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/> |
---|
51 | <xsl:variable name="filename"> |
---|
52 | <xsl:call-template name="pi.dbhtml_filename"> |
---|
53 | <xsl:with-param name="node" select="$chunk"/> |
---|
54 | </xsl:call-template> |
---|
55 | </xsl:variable> |
---|
56 | |
---|
57 | <xsl:choose> |
---|
58 | <xsl:when test="$chunk"> |
---|
59 | <xsl:value-of select="$filename"/> |
---|
60 | </xsl:when> |
---|
61 | <xsl:otherwise> |
---|
62 | <xsl:apply-templates select="parent::*" mode="chunk-filename"/> |
---|
63 | </xsl:otherwise> |
---|
64 | </xsl:choose> |
---|
65 | </xsl:template> |
---|
66 | |
---|
67 | <!-- ==================================================================== --> |
---|
68 | |
---|
69 | <xsl:template name="process-chunk"> |
---|
70 | <xsl:variable name="id"> |
---|
71 | <xsl:call-template name="object.id"/> |
---|
72 | </xsl:variable> |
---|
73 | |
---|
74 | <xsl:variable name="chunks" select="document($chunk.toc,/)"/> |
---|
75 | |
---|
76 | <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/> |
---|
77 | <xsl:variable name="prev-id" select="($chunk/preceding::tocentry |$chunk/ancestor::tocentry)[last()]/@linkend"/> |
---|
78 | <xsl:variable name="next-id" select="($chunk/following::tocentry |$chunk/child::tocentry)[1]/@linkend"/> |
---|
79 | |
---|
80 | <xsl:variable name="prev" select="key('id',$prev-id)"/> |
---|
81 | <xsl:variable name="next" select="key('id',$next-id)"/> |
---|
82 | |
---|
83 | <xsl:variable name="ischunk"> |
---|
84 | <xsl:call-template name="chunk"/> |
---|
85 | </xsl:variable> |
---|
86 | |
---|
87 | <xsl:variable name="chunkfn"> |
---|
88 | <xsl:if test="$ischunk='1'"> |
---|
89 | <xsl:apply-templates mode="chunk-filename" select="."/> |
---|
90 | </xsl:if> |
---|
91 | </xsl:variable> |
---|
92 | |
---|
93 | <xsl:variable name="filename"> |
---|
94 | <xsl:call-template name="make-relative-filename"> |
---|
95 | <xsl:with-param name="base.dir" select="$base.dir"/> |
---|
96 | <xsl:with-param name="base.name" select="$chunkfn"/> |
---|
97 | </xsl:call-template> |
---|
98 | </xsl:variable> |
---|
99 | |
---|
100 | <xsl:choose> |
---|
101 | <xsl:when test="$ischunk = 0"> |
---|
102 | <xsl:apply-imports/> |
---|
103 | </xsl:when> |
---|
104 | |
---|
105 | <xsl:otherwise> |
---|
106 | <xsl:call-template name="write.chunk"> |
---|
107 | <xsl:with-param name="filename" select="$filename"/> |
---|
108 | <xsl:with-param name="content"> |
---|
109 | <xsl:call-template name="chunk-element-content"> |
---|
110 | <xsl:with-param name="prev" select="$prev"/> |
---|
111 | <xsl:with-param name="next" select="$next"/> |
---|
112 | </xsl:call-template> |
---|
113 | </xsl:with-param> |
---|
114 | <xsl:with-param name="quiet" select="$chunk.quietly"/> |
---|
115 | </xsl:call-template> |
---|
116 | </xsl:otherwise> |
---|
117 | </xsl:choose> |
---|
118 | </xsl:template> |
---|
119 | |
---|
120 | <!-- ==================================================================== --> |
---|
121 | |
---|
122 | <xsl:template match="set"> |
---|
123 | <xsl:call-template name="process-chunk"/> |
---|
124 | </xsl:template> |
---|
125 | |
---|
126 | <xsl:template match="book"> |
---|
127 | <xsl:call-template name="process-chunk"/> |
---|
128 | </xsl:template> |
---|
129 | |
---|
130 | <xsl:template match="book/appendix"> |
---|
131 | <xsl:call-template name="process-chunk"/> |
---|
132 | </xsl:template> |
---|
133 | |
---|
134 | <xsl:template match="book/glossary"> |
---|
135 | <xsl:call-template name="process-chunk"/> |
---|
136 | </xsl:template> |
---|
137 | |
---|
138 | <xsl:template match="book/bibliography"> |
---|
139 | <xsl:call-template name="process-chunk"/> |
---|
140 | </xsl:template> |
---|
141 | |
---|
142 | <xsl:template match="dedication" mode="dedication"> |
---|
143 | <xsl:call-template name="process-chunk"/> |
---|
144 | </xsl:template> |
---|
145 | |
---|
146 | <xsl:template match="preface|chapter"> |
---|
147 | <xsl:call-template name="process-chunk"/> |
---|
148 | </xsl:template> |
---|
149 | |
---|
150 | <xsl:template match="part|reference"> |
---|
151 | <xsl:call-template name="process-chunk"/> |
---|
152 | </xsl:template> |
---|
153 | |
---|
154 | <xsl:template match="refentry"> |
---|
155 | <xsl:call-template name="process-chunk"/> |
---|
156 | </xsl:template> |
---|
157 | |
---|
158 | <xsl:template match="colophon"> |
---|
159 | <xsl:call-template name="process-chunk"/> |
---|
160 | </xsl:template> |
---|
161 | |
---|
162 | <xsl:template match="article"> |
---|
163 | <xsl:call-template name="process-chunk"/> |
---|
164 | </xsl:template> |
---|
165 | |
---|
166 | <xsl:template match="article/appendix"> |
---|
167 | <xsl:call-template name="process-chunk"/> |
---|
168 | </xsl:template> |
---|
169 | |
---|
170 | <xsl:template match="article/glossary"> |
---|
171 | <xsl:call-template name="process-chunk"/> |
---|
172 | </xsl:template> |
---|
173 | |
---|
174 | <xsl:template match="article/bibliography"> |
---|
175 | <xsl:call-template name="process-chunk"/> |
---|
176 | </xsl:template> |
---|
177 | |
---|
178 | <xsl:template match="sect1|sect2|sect3|sect4|sect5|section"> |
---|
179 | <xsl:variable name="ischunk"> |
---|
180 | <xsl:call-template name="chunk"/> |
---|
181 | </xsl:variable> |
---|
182 | |
---|
183 | <xsl:choose> |
---|
184 | <xsl:when test="$ischunk != 0"> |
---|
185 | <xsl:call-template name="process-chunk"/> |
---|
186 | </xsl:when> |
---|
187 | <xsl:otherwise> |
---|
188 | <xsl:apply-imports/> |
---|
189 | </xsl:otherwise> |
---|
190 | </xsl:choose> |
---|
191 | </xsl:template> |
---|
192 | |
---|
193 | <xsl:template match="setindex |book/index |article/index"> |
---|
194 | <!-- some implementations use completely empty index tags to indicate --> |
---|
195 | <!-- where an automatically generated index should be inserted. so --> |
---|
196 | <!-- if the index is completely empty, skip it. --> |
---|
197 | <xsl:if test="count(*)>0 or $generate.index != '0'"> |
---|
198 | <xsl:call-template name="process-chunk"/> |
---|
199 | </xsl:if> |
---|
200 | </xsl:template> |
---|
201 | |
---|
202 | <!-- ==================================================================== --> |
---|
203 | |
---|
204 | <xsl:template match="/"> |
---|
205 | <xsl:choose> |
---|
206 | <xsl:when test="$chunk.toc = ''"> |
---|
207 | <xsl:message terminate="yes"> |
---|
208 | <xsl:text>The chunk.toc file is not set.</xsl:text> |
---|
209 | </xsl:message> |
---|
210 | </xsl:when> |
---|
211 | |
---|
212 | <xsl:when test="$rootid != ''"> |
---|
213 | <xsl:choose> |
---|
214 | <xsl:when test="count(key('id',$rootid)) = 0"> |
---|
215 | <xsl:message terminate="yes"> |
---|
216 | <xsl:text>ID '</xsl:text> |
---|
217 | <xsl:value-of select="$rootid"/> |
---|
218 | <xsl:text>' not found in document.</xsl:text> |
---|
219 | </xsl:message> |
---|
220 | </xsl:when> |
---|
221 | <xsl:otherwise> |
---|
222 | <xsl:apply-templates select="key('id',$rootid)"/> |
---|
223 | </xsl:otherwise> |
---|
224 | </xsl:choose> |
---|
225 | </xsl:when> |
---|
226 | |
---|
227 | <xsl:otherwise> |
---|
228 | <xsl:apply-templates select="/" mode="process.root"/> |
---|
229 | </xsl:otherwise> |
---|
230 | </xsl:choose> |
---|
231 | </xsl:template> |
---|
232 | |
---|
233 | <xsl:template match="*" mode="process.root"> |
---|
234 | <xsl:apply-templates select="."/> |
---|
235 | </xsl:template> |
---|
236 | |
---|
237 | <xsl:template name="make.lots"> |
---|
238 | <xsl:param name="toc.params" select="''"/> |
---|
239 | <xsl:param name="toc"/> |
---|
240 | |
---|
241 | <xsl:variable name="lots"> |
---|
242 | <xsl:if test="contains($toc.params, 'toc')"> |
---|
243 | <xsl:copy-of select="$toc"/> |
---|
244 | </xsl:if> |
---|
245 | |
---|
246 | <xsl:if test="contains($toc.params, 'figure')"> |
---|
247 | <xsl:choose> |
---|
248 | <xsl:when test="$chunk.separate.lots != '0'"> |
---|
249 | <xsl:call-template name="make.lot.chunk"> |
---|
250 | <xsl:with-param name="type" select="'figure'"/> |
---|
251 | <xsl:with-param name="lot"> |
---|
252 | <xsl:call-template name="list.of.titles"> |
---|
253 | <xsl:with-param name="titles" select="'figure'"/> |
---|
254 | <xsl:with-param name="nodes" select=".//figure"/> |
---|
255 | </xsl:call-template> |
---|
256 | </xsl:with-param> |
---|
257 | </xsl:call-template> |
---|
258 | </xsl:when> |
---|
259 | <xsl:otherwise> |
---|
260 | <xsl:call-template name="list.of.titles"> |
---|
261 | <xsl:with-param name="titles" select="'figure'"/> |
---|
262 | <xsl:with-param name="nodes" select=".//figure"/> |
---|
263 | </xsl:call-template> |
---|
264 | </xsl:otherwise> |
---|
265 | </xsl:choose> |
---|
266 | </xsl:if> |
---|
267 | |
---|
268 | <xsl:if test="contains($toc.params, 'table')"> |
---|
269 | <xsl:choose> |
---|
270 | <xsl:when test="$chunk.separate.lots != '0'"> |
---|
271 | <xsl:call-template name="make.lot.chunk"> |
---|
272 | <xsl:with-param name="type" select="'table'"/> |
---|
273 | <xsl:with-param name="lot"> |
---|
274 | <xsl:call-template name="list.of.titles"> |
---|
275 | <xsl:with-param name="titles" select="'table'"/> |
---|
276 | <xsl:with-param name="nodes" select=".//table"/> |
---|
277 | </xsl:call-template> |
---|
278 | </xsl:with-param> |
---|
279 | </xsl:call-template> |
---|
280 | </xsl:when> |
---|
281 | <xsl:otherwise> |
---|
282 | <xsl:call-template name="list.of.titles"> |
---|
283 | <xsl:with-param name="titles" select="'table'"/> |
---|
284 | <xsl:with-param name="nodes" select=".//table"/> |
---|
285 | </xsl:call-template> |
---|
286 | </xsl:otherwise> |
---|
287 | </xsl:choose> |
---|
288 | </xsl:if> |
---|
289 | |
---|
290 | <xsl:if test="contains($toc.params, 'example')"> |
---|
291 | <xsl:choose> |
---|
292 | <xsl:when test="$chunk.separate.lots != '0'"> |
---|
293 | <xsl:call-template name="make.lot.chunk"> |
---|
294 | <xsl:with-param name="type" select="'example'"/> |
---|
295 | <xsl:with-param name="lot"> |
---|
296 | <xsl:call-template name="list.of.titles"> |
---|
297 | <xsl:with-param name="titles" select="'example'"/> |
---|
298 | <xsl:with-param name="nodes" select=".//example"/> |
---|
299 | </xsl:call-template> |
---|
300 | </xsl:with-param> |
---|
301 | </xsl:call-template> |
---|
302 | </xsl:when> |
---|
303 | <xsl:otherwise> |
---|
304 | <xsl:call-template name="list.of.titles"> |
---|
305 | <xsl:with-param name="titles" select="'example'"/> |
---|
306 | <xsl:with-param name="nodes" select=".//example"/> |
---|
307 | </xsl:call-template> |
---|
308 | </xsl:otherwise> |
---|
309 | </xsl:choose> |
---|
310 | </xsl:if> |
---|
311 | |
---|
312 | <xsl:if test="contains($toc.params, 'equation')"> |
---|
313 | <xsl:choose> |
---|
314 | <xsl:when test="$chunk.separate.lots != '0'"> |
---|
315 | <xsl:call-template name="make.lot.chunk"> |
---|
316 | <xsl:with-param name="type" select="'equation'"/> |
---|
317 | <xsl:with-param name="lot"> |
---|
318 | <xsl:call-template name="list.of.titles"> |
---|
319 | <xsl:with-param name="titles" select="'equation'"/> |
---|
320 | <xsl:with-param name="nodes" select=".//equation"/> |
---|
321 | </xsl:call-template> |
---|
322 | </xsl:with-param> |
---|
323 | </xsl:call-template> |
---|
324 | </xsl:when> |
---|
325 | <xsl:otherwise> |
---|
326 | <xsl:call-template name="list.of.titles"> |
---|
327 | <xsl:with-param name="titles" select="'equation'"/> |
---|
328 | <xsl:with-param name="nodes" select=".//equation"/> |
---|
329 | </xsl:call-template> |
---|
330 | </xsl:otherwise> |
---|
331 | </xsl:choose> |
---|
332 | </xsl:if> |
---|
333 | |
---|
334 | <xsl:if test="contains($toc.params, 'procedure')"> |
---|
335 | <xsl:choose> |
---|
336 | <xsl:when test="$chunk.separate.lots != '0'"> |
---|
337 | <xsl:call-template name="make.lot.chunk"> |
---|
338 | <xsl:with-param name="type" select="'procedure'"/> |
---|
339 | <xsl:with-param name="lot"> |
---|
340 | <xsl:call-template name="list.of.titles"> |
---|
341 | <xsl:with-param name="titles" select="'procedure'"/> |
---|
342 | <xsl:with-param name="nodes" select=".//procedure[title]"/> |
---|
343 | </xsl:call-template> |
---|
344 | </xsl:with-param> |
---|
345 | </xsl:call-template> |
---|
346 | </xsl:when> |
---|
347 | <xsl:otherwise> |
---|
348 | <xsl:call-template name="list.of.titles"> |
---|
349 | <xsl:with-param name="titles" select="'procedure'"/> |
---|
350 | <xsl:with-param name="nodes" select=".//procedure[title]"/> |
---|
351 | </xsl:call-template> |
---|
352 | </xsl:otherwise> |
---|
353 | </xsl:choose> |
---|
354 | </xsl:if> |
---|
355 | </xsl:variable> |
---|
356 | |
---|
357 | <xsl:if test="string($lots) != ''"> |
---|
358 | <xsl:choose> |
---|
359 | <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)"> |
---|
360 | <xsl:call-template name="write.chunk"> |
---|
361 | <xsl:with-param name="filename"> |
---|
362 | <xsl:call-template name="make-relative-filename"> |
---|
363 | <xsl:with-param name="base.dir" select="$base.dir"/> |
---|
364 | <xsl:with-param name="base.name"> |
---|
365 | <xsl:call-template name="dbhtml-dir"/> |
---|
366 | <xsl:apply-templates select="." mode="recursive-chunk-filename"> |
---|
367 | <xsl:with-param name="recursive" select="true()"/> |
---|
368 | </xsl:apply-templates> |
---|
369 | <xsl:text>-toc</xsl:text> |
---|
370 | <xsl:value-of select="$html.ext"/> |
---|
371 | </xsl:with-param> |
---|
372 | </xsl:call-template> |
---|
373 | </xsl:with-param> |
---|
374 | <xsl:with-param name="content"> |
---|
375 | <xsl:call-template name="chunk-element-content"> |
---|
376 | <xsl:with-param name="prev" select="/foo"/> |
---|
377 | <xsl:with-param name="next" select="/foo"/> |
---|
378 | <xsl:with-param name="nav.context" select="'toc'"/> |
---|
379 | <xsl:with-param name="content"> |
---|
380 | <h1> |
---|
381 | <xsl:apply-templates select="." mode="object.title.markup"/> |
---|
382 | </h1> |
---|
383 | <xsl:copy-of select="$lots"/> |
---|
384 | </xsl:with-param> |
---|
385 | </xsl:call-template> |
---|
386 | </xsl:with-param> |
---|
387 | <xsl:with-param name="quiet" select="$chunk.quietly"/> |
---|
388 | </xsl:call-template> |
---|
389 | </xsl:when> |
---|
390 | <xsl:otherwise> |
---|
391 | <xsl:copy-of select="$lots"/> |
---|
392 | </xsl:otherwise> |
---|
393 | </xsl:choose> |
---|
394 | </xsl:if> |
---|
395 | </xsl:template> |
---|
396 | |
---|
397 | <xsl:template name="make.lot.chunk"> |
---|
398 | <xsl:param name="type" select="''"/> |
---|
399 | <xsl:param name="lot"/> |
---|
400 | |
---|
401 | <xsl:if test="string($lot) != ''"> |
---|
402 | <xsl:variable name="filename"> |
---|
403 | <xsl:call-template name="make-relative-filename"> |
---|
404 | <xsl:with-param name="base.dir" select="$base.dir"/> |
---|
405 | <xsl:with-param name="base.name"> |
---|
406 | <xsl:call-template name="dbhtml-dir"/> |
---|
407 | <xsl:value-of select="$type"/> |
---|
408 | <xsl:text>-toc</xsl:text> |
---|
409 | <xsl:value-of select="$html.ext"/> |
---|
410 | </xsl:with-param> |
---|
411 | </xsl:call-template> |
---|
412 | </xsl:variable> |
---|
413 | |
---|
414 | <xsl:variable name="href"> |
---|
415 | <xsl:call-template name="make-relative-filename"> |
---|
416 | <xsl:with-param name="base.name"> |
---|
417 | <xsl:call-template name="dbhtml-dir"/> |
---|
418 | <xsl:value-of select="$type"/> |
---|
419 | <xsl:text>-toc</xsl:text> |
---|
420 | <xsl:value-of select="$html.ext"/> |
---|
421 | </xsl:with-param> |
---|
422 | </xsl:call-template> |
---|
423 | </xsl:variable> |
---|
424 | |
---|
425 | <xsl:call-template name="write.chunk"> |
---|
426 | <xsl:with-param name="filename" select="$filename"/> |
---|
427 | <xsl:with-param name="content"> |
---|
428 | <xsl:call-template name="chunk-element-content"> |
---|
429 | <xsl:with-param name="prev" select="/foo"/> |
---|
430 | <xsl:with-param name="next" select="/foo"/> |
---|
431 | <xsl:with-param name="nav.context" select="'toc'"/> |
---|
432 | <xsl:with-param name="content"> |
---|
433 | <xsl:copy-of select="$lot"/> |
---|
434 | </xsl:with-param> |
---|
435 | </xsl:call-template> |
---|
436 | </xsl:with-param> |
---|
437 | <xsl:with-param name="quiet" select="$chunk.quietly"/> |
---|
438 | </xsl:call-template> |
---|
439 | <!-- And output a link to this file --> |
---|
440 | <div> |
---|
441 | <xsl:attribute name="class"> |
---|
442 | <xsl:text>ListofTitles</xsl:text> |
---|
443 | </xsl:attribute> |
---|
444 | <a href="{$href}"> |
---|
445 | <xsl:call-template name="gentext"> |
---|
446 | <xsl:with-param name="key"> |
---|
447 | <xsl:choose> |
---|
448 | <xsl:when test="$type='table'">ListofTables</xsl:when> |
---|
449 | <xsl:when test="$type='figure'">ListofFigures</xsl:when> |
---|
450 | <xsl:when test="$type='equation'">ListofEquations</xsl:when> |
---|
451 | <xsl:when test="$type='example'">ListofExamples</xsl:when> |
---|
452 | <xsl:when test="$type='procedure'">ListofProcedures</xsl:when> |
---|
453 | <xsl:otherwise>ListofUnknown</xsl:otherwise> |
---|
454 | </xsl:choose> |
---|
455 | </xsl:with-param> |
---|
456 | </xsl:call-template> |
---|
457 | </a> |
---|
458 | </div> |
---|
459 | </xsl:if> |
---|
460 | </xsl:template> |
---|
461 | |
---|
462 | </xsl:stylesheet> |
---|