source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/chunk-common.xsl@ c48546a

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c48546a was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 74.0 KB
Line 
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:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl cf ng db">
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:param name="onechunk" select="0"/>
19<xsl:param name="refentry.separator" select="0"/>
20<xsl:param name="chunk.fast" select="0"/>
21
22<xsl:key name="genid" match="*" use="generate-id()"/>
23
24<!-- ==================================================================== -->
25
26<xsl:variable name="chunk.hierarchy">
27 <xsl:if test="$chunk.fast != 0">
28 <xsl:choose>
29 <xsl:when test="function-available('exsl:node-set')">
30 <xsl:message>Computing chunks...</xsl:message>
31 <xsl:apply-templates select="/*" mode="find.chunks"/>
32 </xsl:when>
33 <xsl:otherwise>
34 <xsl:message>
35 <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
36 <xsl:text>Using "slow" chunking.</xsl:text>
37 </xsl:message>
38 </xsl:otherwise>
39 </xsl:choose>
40 </xsl:if>
41</xsl:variable>
42
43<!-- ==================================================================== -->
44
45<xsl:template name="process-chunk-element">
46 <xsl:param name="content">
47 <xsl:apply-imports/>
48 </xsl:param>
49
50 <xsl:choose>
51 <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
52 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
53 <xsl:variable name="genid" select="generate-id()"/>
54
55 <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
56
57 <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
58 <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
59
60 <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
61 <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
62
63 <xsl:choose>
64 <xsl:when test="$onechunk != 0 and parent::*">
65 <xsl:copy-of select="$content"/>
66 </xsl:when>
67 <xsl:otherwise>
68 <xsl:call-template name="process-chunk">
69 <xsl:with-param name="prev" select="$prev"/>
70 <xsl:with-param name="next" select="$next"/>
71 <xsl:with-param name="content" select="$content"/>
72 </xsl:call-template>
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:when>
76 <xsl:otherwise>
77 <xsl:choose>
78 <xsl:when test="$onechunk != 0 and not(parent::*)">
79 <xsl:call-template name="chunk-all-sections">
80 <xsl:with-param name="content" select="$content"/>
81 </xsl:call-template>
82 </xsl:when>
83 <xsl:when test="$onechunk != 0">
84 <xsl:copy-of select="$content"/>
85 </xsl:when>
86 <xsl:when test="$chunk.first.sections = 0">
87 <xsl:call-template name="chunk-first-section-with-parent">
88 <xsl:with-param name="content" select="$content"/>
89 </xsl:call-template>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:call-template name="chunk-all-sections">
93 <xsl:with-param name="content" select="$content"/>
94 </xsl:call-template>
95 </xsl:otherwise>
96 </xsl:choose>
97 </xsl:otherwise>
98 </xsl:choose>
99</xsl:template>
100
101<xsl:template name="process-chunk">
102 <xsl:param name="prev" select="."/>
103 <xsl:param name="next" select="."/>
104 <xsl:param name="content">
105 <xsl:apply-imports/>
106 </xsl:param>
107
108 <xsl:variable name="ischunk">
109 <xsl:call-template name="chunk"/>
110 </xsl:variable>
111
112 <xsl:variable name="chunkfn">
113 <xsl:if test="$ischunk='1'">
114 <xsl:apply-templates mode="chunk-filename" select="."/>
115 </xsl:if>
116 </xsl:variable>
117
118 <xsl:if test="$ischunk='0'">
119 <xsl:message>
120 <xsl:text>Error </xsl:text>
121 <xsl:value-of select="name(.)"/>
122 <xsl:text> is not a chunk!</xsl:text>
123 </xsl:message>
124 </xsl:if>
125
126 <xsl:variable name="filename">
127 <xsl:call-template name="make-relative-filename">
128 <xsl:with-param name="base.dir" select="$base.dir"/>
129 <xsl:with-param name="base.name" select="$chunkfn"/>
130 </xsl:call-template>
131 </xsl:variable>
132
133 <xsl:call-template name="write.chunk">
134 <xsl:with-param name="filename" select="$filename"/>
135 <xsl:with-param name="content">
136 <xsl:call-template name="chunk-element-content">
137 <xsl:with-param name="prev" select="$prev"/>
138 <xsl:with-param name="next" select="$next"/>
139 <xsl:with-param name="content" select="$content"/>
140 </xsl:call-template>
141 </xsl:with-param>
142 <xsl:with-param name="quiet" select="$chunk.quietly"/>
143 </xsl:call-template>
144</xsl:template>
145
146<xsl:template name="chunk-first-section-with-parent">
147 <xsl:param name="content">
148 <xsl:apply-imports/>
149 </xsl:param>
150
151 <!-- These xpath expressions are really hairy. The trick is to pick sections -->
152 <!-- that are not first children and are not the children of first children -->
153
154 <!-- Break these variables into pieces to work around
155 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
156
157 <xsl:variable name="prev-v1" select="(ancestor::sect1[$chunk.section.depth &gt; 0 and preceding-sibling::sect1][1] |ancestor::sect2[$chunk.section.depth &gt; 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |ancestor::sect3[$chunk.section.depth &gt; 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect4[$chunk.section.depth &gt; 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect5[$chunk.section.depth &gt; 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
158
159 <xsl:variable name="prev-v2" select="(preceding::sect1[$chunk.section.depth &gt; 0 and preceding-sibling::sect1][1] |preceding::sect2[$chunk.section.depth &gt; 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |preceding::sect3[$chunk.section.depth &gt; 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect4[$chunk.section.depth &gt; 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect5[$chunk.section.depth &gt; 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::section[$chunk.section.depth &gt; count(ancestor::section) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
160
161 <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |$prev-v1 |$prev-v2)[last()]"/>
162
163 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth &gt; 0 and preceding-sibling::sect1][1] |following::sect2[$chunk.section.depth &gt; 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |following::sect3[$chunk.section.depth &gt; 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect4[$chunk.section.depth &gt; 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect5[$chunk.section.depth &gt; 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::section[$chunk.section.depth &gt; count(ancestor::section) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
164
165 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth &gt; 0 and preceding-sibling::sect1][1] |descendant::sect2[$chunk.section.depth &gt; 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |descendant::sect3[$chunk.section.depth &gt; 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect4[$chunk.section.depth &gt; 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect5[$chunk.section.depth &gt; 4 and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::section[$chunk.section.depth &gt; count(ancestor::section) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
166
167 <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |following::article[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::bibliography[parent::article or parent::book or parent::part][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
168
169 <xsl:call-template name="process-chunk">
170 <xsl:with-param name="prev" select="$prev"/>
171 <xsl:with-param name="next" select="$next"/>
172 <xsl:with-param name="content" select="$content"/>
173 </xsl:call-template>
174</xsl:template>
175
176<xsl:template name="chunk-all-sections">
177 <xsl:param name="content">
178 <xsl:apply-imports/>
179 </xsl:param>
180
181 <xsl:variable name="prev-v1" select="(preceding::sect1[$chunk.section.depth &gt; 0][1] |preceding::sect2[$chunk.section.depth &gt; 1][1] |preceding::sect3[$chunk.section.depth &gt; 2][1] |preceding::sect4[$chunk.section.depth &gt; 3][1] |preceding::sect5[$chunk.section.depth &gt; 4][1] |preceding::section[$chunk.section.depth &gt; count(ancestor::section)][1])[last()]"/>
182
183 <xsl:variable name="prev-v2" select="(ancestor::sect1[$chunk.section.depth &gt; 0][1] |ancestor::sect2[$chunk.section.depth &gt; 1][1] |ancestor::sect3[$chunk.section.depth &gt; 2][1] |ancestor::sect4[$chunk.section.depth &gt; 3][1] |ancestor::sect5[$chunk.section.depth &gt; 4][1] |ancestor::section[$chunk.section.depth &gt; count(ancestor::section)][1])[last()]"/>
184
185 <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |$prev-v1 |$prev-v2)[last()]"/>
186
187 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth &gt; 0][1] |following::sect2[$chunk.section.depth &gt; 1][1] |following::sect3[$chunk.section.depth &gt; 2][1] |following::sect4[$chunk.section.depth &gt; 3][1] |following::sect5[$chunk.section.depth &gt; 4][1] |following::section[$chunk.section.depth &gt; count(ancestor::section)][1])[1]"/>
188
189 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth &gt; 0][1] |descendant::sect2[$chunk.section.depth &gt; 1][1] |descendant::sect3[$chunk.section.depth &gt; 2][1] |descendant::sect4[$chunk.section.depth &gt; 3][1] |descendant::sect5[$chunk.section.depth &gt; 4][1] |descendant::section[$chunk.section.depth &gt; count(ancestor::section)][1])[1]"/>
190
191 <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book][1] |following::article[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::bibliography[parent::article or parent::book][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
192
193 <xsl:call-template name="process-chunk">
194 <xsl:with-param name="prev" select="$prev"/>
195 <xsl:with-param name="next" select="$next"/>
196 <xsl:with-param name="content" select="$content"/>
197 </xsl:call-template>
198</xsl:template>
199
200<!-- ==================================================================== -->
201
202<!-- ==================================================================== -->
203
204<xsl:template name="make.lots">
205 <xsl:param name="toc.params" select="''"/>
206 <xsl:param name="toc"/>
207
208 <xsl:variable name="lots">
209 <xsl:if test="contains($toc.params, 'toc')">
210 <xsl:copy-of select="$toc"/>
211 </xsl:if>
212
213 <xsl:if test="contains($toc.params, 'figure')">
214 <xsl:choose>
215 <xsl:when test="$chunk.separate.lots != '0'">
216 <xsl:call-template name="make.lot.chunk">
217 <xsl:with-param name="type" select="'figure'"/>
218 <xsl:with-param name="lot">
219 <xsl:call-template name="list.of.titles">
220 <xsl:with-param name="titles" select="'figure'"/>
221 <xsl:with-param name="nodes" select=".//figure"/>
222 </xsl:call-template>
223 </xsl:with-param>
224 </xsl:call-template>
225 </xsl:when>
226 <xsl:otherwise>
227 <xsl:call-template name="list.of.titles">
228 <xsl:with-param name="titles" select="'figure'"/>
229 <xsl:with-param name="nodes" select=".//figure"/>
230 </xsl:call-template>
231 </xsl:otherwise>
232 </xsl:choose>
233 </xsl:if>
234
235 <xsl:if test="contains($toc.params, 'table')">
236 <xsl:choose>
237 <xsl:when test="$chunk.separate.lots != '0'">
238 <xsl:call-template name="make.lot.chunk">
239 <xsl:with-param name="type" select="'table'"/>
240 <xsl:with-param name="lot">
241 <xsl:call-template name="list.of.titles">
242 <xsl:with-param name="titles" select="'table'"/>
243 <xsl:with-param name="nodes" select=".//table"/>
244 </xsl:call-template>
245 </xsl:with-param>
246 </xsl:call-template>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:call-template name="list.of.titles">
250 <xsl:with-param name="titles" select="'table'"/>
251 <xsl:with-param name="nodes" select=".//table"/>
252 </xsl:call-template>
253 </xsl:otherwise>
254 </xsl:choose>
255 </xsl:if>
256
257 <xsl:if test="contains($toc.params, 'example')">
258 <xsl:choose>
259 <xsl:when test="$chunk.separate.lots != '0'">
260 <xsl:call-template name="make.lot.chunk">
261 <xsl:with-param name="type" select="'example'"/>
262 <xsl:with-param name="lot">
263 <xsl:call-template name="list.of.titles">
264 <xsl:with-param name="titles" select="'example'"/>
265 <xsl:with-param name="nodes" select=".//example"/>
266 </xsl:call-template>
267 </xsl:with-param>
268 </xsl:call-template>
269 </xsl:when>
270 <xsl:otherwise>
271 <xsl:call-template name="list.of.titles">
272 <xsl:with-param name="titles" select="'example'"/>
273 <xsl:with-param name="nodes" select=".//example"/>
274 </xsl:call-template>
275 </xsl:otherwise>
276 </xsl:choose>
277 </xsl:if>
278
279 <xsl:if test="contains($toc.params, 'equation')">
280 <xsl:choose>
281 <xsl:when test="$chunk.separate.lots != '0'">
282 <xsl:call-template name="make.lot.chunk">
283 <xsl:with-param name="type" select="'equation'"/>
284 <xsl:with-param name="lot">
285 <xsl:call-template name="list.of.titles">
286 <xsl:with-param name="titles" select="'equation'"/>
287 <xsl:with-param name="nodes" select=".//equation"/>
288 </xsl:call-template>
289 </xsl:with-param>
290 </xsl:call-template>
291 </xsl:when>
292 <xsl:otherwise>
293 <xsl:call-template name="list.of.titles">
294 <xsl:with-param name="titles" select="'equation'"/>
295 <xsl:with-param name="nodes" select=".//equation"/>
296 </xsl:call-template>
297 </xsl:otherwise>
298 </xsl:choose>
299 </xsl:if>
300
301 <xsl:if test="contains($toc.params, 'procedure')">
302 <xsl:choose>
303 <xsl:when test="$chunk.separate.lots != '0'">
304 <xsl:call-template name="make.lot.chunk">
305 <xsl:with-param name="type" select="'procedure'"/>
306 <xsl:with-param name="lot">
307 <xsl:call-template name="list.of.titles">
308 <xsl:with-param name="titles" select="'procedure'"/>
309 <xsl:with-param name="nodes" select=".//procedure[title]"/>
310 </xsl:call-template>
311 </xsl:with-param>
312 </xsl:call-template>
313 </xsl:when>
314 <xsl:otherwise>
315 <xsl:call-template name="list.of.titles">
316 <xsl:with-param name="titles" select="'procedure'"/>
317 <xsl:with-param name="nodes" select=".//procedure[title]"/>
318 </xsl:call-template>
319 </xsl:otherwise>
320 </xsl:choose>
321 </xsl:if>
322 </xsl:variable>
323
324 <xsl:if test="string($lots) != ''">
325 <xsl:choose>
326 <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
327 <xsl:call-template name="write.chunk">
328 <xsl:with-param name="filename">
329 <xsl:call-template name="make-relative-filename">
330 <xsl:with-param name="base.dir" select="$base.dir"/>
331 <xsl:with-param name="base.name">
332 <xsl:call-template name="dbhtml-dir"/>
333 <xsl:apply-templates select="." mode="recursive-chunk-filename">
334 <xsl:with-param name="recursive" select="true()"/>
335 </xsl:apply-templates>
336 <xsl:text>-toc</xsl:text>
337 <xsl:value-of select="$html.ext"/>
338 </xsl:with-param>
339 </xsl:call-template>
340 </xsl:with-param>
341 <xsl:with-param name="content">
342 <xsl:call-template name="chunk-element-content">
343 <xsl:with-param name="prev" select="/foo"/>
344 <xsl:with-param name="next" select="/foo"/>
345 <xsl:with-param name="nav.context" select="'toc'"/>
346 <xsl:with-param name="content">
347 <xsl:if test="$chunk.tocs.and.lots.has.title != 0">
348 <h1>
349 <xsl:apply-templates select="." mode="object.title.markup"/>
350 </h1>
351 </xsl:if>
352 <xsl:copy-of select="$lots"/>
353 </xsl:with-param>
354 </xsl:call-template>
355 </xsl:with-param>
356 <xsl:with-param name="quiet" select="$chunk.quietly"/>
357 </xsl:call-template>
358 </xsl:when>
359 <xsl:otherwise>
360 <xsl:copy-of select="$lots"/>
361 </xsl:otherwise>
362 </xsl:choose>
363 </xsl:if>
364</xsl:template>
365
366<xsl:template name="make.lot.chunk">
367 <xsl:param name="type" select="''"/>
368 <xsl:param name="lot"/>
369
370 <xsl:if test="string($lot) != ''">
371 <xsl:variable name="filename">
372 <xsl:call-template name="make-relative-filename">
373 <xsl:with-param name="base.dir" select="$base.dir"/>
374 <xsl:with-param name="base.name">
375 <xsl:call-template name="dbhtml-dir"/>
376 <xsl:value-of select="$type"/>
377 <xsl:text>-toc</xsl:text>
378 <xsl:value-of select="$html.ext"/>
379 </xsl:with-param>
380 </xsl:call-template>
381 </xsl:variable>
382
383 <xsl:variable name="href">
384 <xsl:call-template name="make-relative-filename">
385 <xsl:with-param name="base.name">
386 <xsl:call-template name="dbhtml-dir"/>
387 <xsl:value-of select="$type"/>
388 <xsl:text>-toc</xsl:text>
389 <xsl:value-of select="$html.ext"/>
390 </xsl:with-param>
391 </xsl:call-template>
392 </xsl:variable>
393
394 <xsl:call-template name="write.chunk">
395 <xsl:with-param name="filename" select="$filename"/>
396 <xsl:with-param name="content">
397 <xsl:call-template name="chunk-element-content">
398 <xsl:with-param name="prev" select="/foo"/>
399 <xsl:with-param name="next" select="/foo"/>
400 <xsl:with-param name="nav.context" select="'toc'"/>
401 <xsl:with-param name="content">
402 <xsl:copy-of select="$lot"/>
403 </xsl:with-param>
404 </xsl:call-template>
405 </xsl:with-param>
406 <xsl:with-param name="quiet" select="$chunk.quietly"/>
407 </xsl:call-template>
408 <!-- And output a link to this file -->
409 <div>
410 <xsl:attribute name="class">
411 <xsl:text>ListofTitles</xsl:text>
412 </xsl:attribute>
413 <a href="{$href}">
414 <xsl:call-template name="gentext">
415 <xsl:with-param name="key">
416 <xsl:choose>
417 <xsl:when test="$type='table'">ListofTables</xsl:when>
418 <xsl:when test="$type='figure'">ListofFigures</xsl:when>
419 <xsl:when test="$type='equation'">ListofEquations</xsl:when>
420 <xsl:when test="$type='example'">ListofExamples</xsl:when>
421 <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
422 <xsl:otherwise>ListofUnknown</xsl:otherwise>
423 </xsl:choose>
424 </xsl:with-param>
425 </xsl:call-template>
426 </a>
427 </div>
428 </xsl:if>
429</xsl:template>
430
431<!-- ==================================================================== -->
432
433<xsl:template name="in.other.chunk">
434 <xsl:param name="chunk" select="."/>
435 <xsl:param name="node" select="."/>
436
437 <xsl:variable name="is.chunk">
438 <xsl:call-template name="chunk">
439 <xsl:with-param name="node" select="$node"/>
440 </xsl:call-template>
441 </xsl:variable>
442
443<!--
444 <xsl:message>
445 <xsl:text>in.other.chunk: </xsl:text>
446 <xsl:value-of select="name($chunk)"/>
447 <xsl:text> </xsl:text>
448 <xsl:value-of select="name($node)"/>
449 <xsl:text> </xsl:text>
450 <xsl:value-of select="$chunk = $node"/>
451 <xsl:text> </xsl:text>
452 <xsl:value-of select="$is.chunk"/>
453 </xsl:message>
454-->
455
456 <xsl:choose>
457 <xsl:when test="$chunk = $node">0</xsl:when>
458 <xsl:when test="$is.chunk = 1">1</xsl:when>
459 <xsl:when test="count($node) = 0">0</xsl:when>
460 <xsl:otherwise>
461 <xsl:call-template name="in.other.chunk">
462 <xsl:with-param name="chunk" select="$chunk"/>
463 <xsl:with-param name="node" select="$node/parent::*"/>
464 </xsl:call-template>
465 </xsl:otherwise>
466 </xsl:choose>
467</xsl:template>
468
469<xsl:template name="count.footnotes.in.this.chunk">
470 <xsl:param name="node" select="."/>
471 <xsl:param name="footnotes" select="$node//footnote"/>
472 <xsl:param name="count" select="0"/>
473
474<!--
475 <xsl:message>
476 <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
477 <xsl:value-of select="name($node)"/>
478 </xsl:message>
479-->
480
481 <xsl:variable name="in.other.chunk">
482 <xsl:call-template name="in.other.chunk">
483 <xsl:with-param name="chunk" select="$node"/>
484 <xsl:with-param name="node" select="$footnotes[1]"/>
485 </xsl:call-template>
486 </xsl:variable>
487
488 <xsl:choose>
489 <xsl:when test="count($footnotes) = 0">
490 <xsl:value-of select="$count"/>
491 </xsl:when>
492 <xsl:otherwise>
493 <xsl:choose>
494 <xsl:when test="$in.other.chunk != 0">
495 <xsl:call-template name="count.footnotes.in.this.chunk">
496 <xsl:with-param name="node" select="$node"/>
497 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
498 <xsl:with-param name="count" select="$count"/>
499 </xsl:call-template>
500 </xsl:when>
501 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
502 <xsl:call-template name="count.footnotes.in.this.chunk">
503 <xsl:with-param name="node" select="$node"/>
504 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
505 <xsl:with-param name="count" select="$count"/>
506 </xsl:call-template>
507 </xsl:when>
508 <xsl:otherwise>
509 <xsl:call-template name="count.footnotes.in.this.chunk">
510 <xsl:with-param name="node" select="$node"/>
511 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
512 <xsl:with-param name="count" select="$count + 1"/>
513 </xsl:call-template>
514 </xsl:otherwise>
515 </xsl:choose>
516 </xsl:otherwise>
517 </xsl:choose>
518</xsl:template>
519
520<xsl:template name="process.footnotes.in.this.chunk">
521 <xsl:param name="node" select="."/>
522 <xsl:param name="footnotes" select="$node//footnote"/>
523
524<!--
525 <xsl:message>process.footnotes.in.this.chunk</xsl:message>
526-->
527
528 <xsl:variable name="in.other.chunk">
529 <xsl:call-template name="in.other.chunk">
530 <xsl:with-param name="chunk" select="$node"/>
531 <xsl:with-param name="node" select="$footnotes[1]"/>
532 </xsl:call-template>
533 </xsl:variable>
534
535 <xsl:choose>
536 <xsl:when test="count($footnotes) = 0">
537 <!-- nop -->
538 </xsl:when>
539 <xsl:otherwise>
540 <xsl:choose>
541 <xsl:when test="$in.other.chunk != 0">
542 <xsl:call-template name="process.footnotes.in.this.chunk">
543 <xsl:with-param name="node" select="$node"/>
544 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
545 </xsl:call-template>
546 </xsl:when>
547 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
548 <xsl:call-template name="process.footnotes.in.this.chunk">
549 <xsl:with-param name="node" select="$node"/>
550 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
551 </xsl:call-template>
552 </xsl:when>
553 <xsl:otherwise>
554 <xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
555 <xsl:call-template name="process.footnotes.in.this.chunk">
556 <xsl:with-param name="node" select="$node"/>
557 <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
558 </xsl:call-template>
559 </xsl:otherwise>
560 </xsl:choose>
561 </xsl:otherwise>
562 </xsl:choose>
563</xsl:template>
564
565<xsl:template name="process.footnotes">
566 <xsl:variable name="footnotes" select=".//footnote"/>
567 <xsl:variable name="fcount">
568 <xsl:call-template name="count.footnotes.in.this.chunk">
569 <xsl:with-param name="node" select="."/>
570 <xsl:with-param name="footnotes" select="$footnotes"/>
571 </xsl:call-template>
572 </xsl:variable>
573
574<!--
575 <xsl:message>
576 <xsl:value-of select="name(.)"/>
577 <xsl:text> fcount: </xsl:text>
578 <xsl:value-of select="$fcount"/>
579 </xsl:message>
580-->
581
582 <!-- Only bother to do this if there's at least one non-table footnote -->
583 <xsl:if test="$fcount &gt; 0">
584 <div class="footnotes">
585 <br/>
586 <hr width="100" align="left"/>
587 <xsl:call-template name="process.footnotes.in.this.chunk">
588 <xsl:with-param name="node" select="."/>
589 <xsl:with-param name="footnotes" select="$footnotes"/>
590 </xsl:call-template>
591 </div>
592 </xsl:if>
593
594 <!-- FIXME: When chunking, only the annotations actually used
595 in this chunk should be referenced. I don't think it
596 does any harm to reference them all, but it adds
597 unnecessary bloat to each chunk. -->
598 <xsl:if test="$annotation.support != 0 and //annotation">
599 <div class="annotation-list">
600 <div class="annotation-nocss">
601 <p>The following annotations are from this essay. You are seeing
602 them here because your browser doesn&#8217;t support the user-interface
603 techniques used to make them appear as &#8216;popups&#8217; on modern browsers.</p>
604 </div>
605
606 <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
607 </div>
608 </xsl:if>
609</xsl:template>
610
611<xsl:template name="process.chunk.footnotes">
612 <xsl:variable name="is.chunk">
613 <xsl:call-template name="chunk"/>
614 </xsl:variable>
615 <xsl:if test="$is.chunk = 1">
616 <xsl:call-template name="process.footnotes"/>
617 </xsl:if>
618</xsl:template>
619
620<!-- ====================================================================== -->
621
622<xsl:template name="chunk">
623 <xsl:param name="node" select="."/>
624 <!-- returns 1 if $node is a chunk -->
625
626 <!-- ==================================================================== -->
627 <!-- What's a chunk?
628
629 The root element
630 appendix
631 article
632 bibliography in article or part or book
633 book
634 chapter
635 colophon
636 glossary in article or part or book
637 index in article or part or book
638 part
639 preface
640 refentry
641 reference
642 sect{1,2,3,4,5} if position()>1 && depth < chunk.section.depth
643 section if position()>1 && depth < chunk.section.depth
644 set
645 setindex
646 -->
647 <!-- ==================================================================== -->
648
649<!--
650 <xsl:message>
651 <xsl:text>chunk: </xsl:text>
652 <xsl:value-of select="name($node)"/>
653 <xsl:text>(</xsl:text>
654 <xsl:value-of select="$node/@id"/>
655 <xsl:text>)</xsl:text>
656 <xsl:text> csd: </xsl:text>
657 <xsl:value-of select="$chunk.section.depth"/>
658 <xsl:text> cfs: </xsl:text>
659 <xsl:value-of select="$chunk.first.sections"/>
660 <xsl:text> ps: </xsl:text>
661 <xsl:value-of select="count($node/parent::section)"/>
662 <xsl:text> prs: </xsl:text>
663 <xsl:value-of select="count($node/preceding-sibling::section)"/>
664 </xsl:message>
665-->
666
667 <xsl:choose>
668 <xsl:when test="not($node/parent::*)">1</xsl:when>
669
670 <xsl:when test="local-name($node) = 'sect1' and $chunk.section.depth &gt;= 1 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect1) &gt; 0)">
671 <xsl:text>1</xsl:text>
672 </xsl:when>
673 <xsl:when test="local-name($node) = 'sect2' and $chunk.section.depth &gt;= 2 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect2) &gt; 0)">
674 <xsl:call-template name="chunk">
675 <xsl:with-param name="node" select="$node/parent::*"/>
676 </xsl:call-template>
677 </xsl:when>
678 <xsl:when test="local-name($node) = 'sect3' and $chunk.section.depth &gt;= 3 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect3) &gt; 0)">
679 <xsl:call-template name="chunk">
680 <xsl:with-param name="node" select="$node/parent::*"/>
681 </xsl:call-template>
682 </xsl:when>
683 <xsl:when test="local-name($node) = 'sect4' and $chunk.section.depth &gt;= 4 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect4) &gt; 0)">
684 <xsl:call-template name="chunk">
685 <xsl:with-param name="node" select="$node/parent::*"/>
686 </xsl:call-template>
687 </xsl:when>
688 <xsl:when test="local-name($node) = 'sect5' and $chunk.section.depth &gt;= 5 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect5) &gt; 0)">
689 <xsl:call-template name="chunk">
690 <xsl:with-param name="node" select="$node/parent::*"/>
691 </xsl:call-template>
692 </xsl:when>
693 <xsl:when test="local-name($node) = 'section' and $chunk.section.depth &gt;= count($node/ancestor::section)+1 and ($chunk.first.sections != 0 or count($node/preceding-sibling::section) &gt; 0)">
694 <xsl:call-template name="chunk">
695 <xsl:with-param name="node" select="$node/parent::*"/>
696 </xsl:call-template>
697 </xsl:when>
698
699 <xsl:when test="local-name($node)='preface'">1</xsl:when>
700 <xsl:when test="local-name($node)='chapter'">1</xsl:when>
701 <xsl:when test="local-name($node)='appendix'">1</xsl:when>
702 <xsl:when test="local-name($node)='article'">1</xsl:when>
703 <xsl:when test="local-name($node)='part'">1</xsl:when>
704 <xsl:when test="local-name($node)='reference'">1</xsl:when>
705 <xsl:when test="local-name($node)='refentry'">1</xsl:when>
706 <xsl:when test="local-name($node)='index' and ($generate.index != 0 or count($node/*) &gt; 0) and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
707 <xsl:when test="local-name($node)='bibliography' and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
708 <xsl:when test="local-name($node)='glossary' and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
709 <xsl:when test="local-name($node)='colophon'">1</xsl:when>
710 <xsl:when test="local-name($node)='book'">1</xsl:when>
711 <xsl:when test="local-name($node)='set'">1</xsl:when>
712 <xsl:when test="local-name($node)='setindex'">1</xsl:when>
713 <xsl:when test="local-name($node)='legalnotice' and $generate.legalnotice.link != 0">1</xsl:when>
714 <xsl:otherwise>0</xsl:otherwise>
715 </xsl:choose>
716</xsl:template>
717
718<!-- ==================================================================== -->
719<xsl:template name="href.target.uri">
720 <xsl:param name="object" select="."/>
721 <xsl:variable name="ischunk">
722 <xsl:call-template name="chunk">
723 <xsl:with-param name="node" select="$object"/>
724 </xsl:call-template>
725 </xsl:variable>
726
727 <xsl:apply-templates mode="chunk-filename" select="$object"/>
728
729 <xsl:if test="$ischunk='0'">
730 <xsl:text>#</xsl:text>
731 <xsl:call-template name="object.id">
732 <xsl:with-param name="object" select="$object"/>
733 </xsl:call-template>
734 </xsl:if>
735</xsl:template>
736
737<xsl:template name="href.target">
738 <xsl:param name="context" select="."/>
739 <xsl:param name="object" select="."/>
740 <xsl:param name="toc-context" select="."/>
741 <!-- * If $toc-context contains some node other than the current node, -->
742 <!-- * it means we're processing a link in a TOC. In that case, to -->
743 <!-- * ensure the link will work correctly, we need to take a look at -->
744 <!-- * where the file containing the TOC will get written, and where -->
745 <!-- * the file that's being linked to will get written. -->
746 <xsl:variable name="toc-output-dir">
747 <xsl:if test="not($toc-context = .)">
748 <!-- * Get the $toc-context node and all its ancestors, look down -->
749 <!-- * through them to find the last/closest node to the -->
750 <!-- * toc-context node that has a "dbhtml dir" PI, and get the -->
751 <!-- * directory name from that. That's the name of the directory -->
752 <!-- * to which the current toc output file will get written. -->
753 <xsl:call-template name="dbhtml-dir">
754 <xsl:with-param name="context" select="$toc-context/ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
755 </xsl:call-template>
756 </xsl:if>
757 </xsl:variable>
758 <xsl:variable name="linked-file-output-dir">
759 <xsl:if test="not($toc-context = .)">
760 <!-- * Get the current node and all its ancestors, look down -->
761 <!-- * through them to find the last/closest node to the current -->
762 <!-- * node that has a "dbhtml dir" PI, and get the directory name -->
763 <!-- * from that. That's the name of the directory to which the -->
764 <!-- * file that's being linked to will get written. -->
765 <xsl:call-template name="dbhtml-dir">
766 <xsl:with-param name="context" select="ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
767 </xsl:call-template>
768 </xsl:if>
769 </xsl:variable>
770 <xsl:variable name="href.to.uri">
771 <xsl:call-template name="href.target.uri">
772 <xsl:with-param name="object" select="$object"/>
773 </xsl:call-template>
774 </xsl:variable>
775 <xsl:variable name="href.from.uri">
776 <xsl:call-template name="href.target.uri">
777 <xsl:with-param name="object" select="$context"/>
778 </xsl:call-template>
779 </xsl:variable>
780 <!-- * <xsl:message>toc-context: <xsl:value-of select="local-name($toc-context)"/></xsl:message> -->
781 <!-- * <xsl:message>node: <xsl:value-of select="local-name(.)"/></xsl:message> -->
782 <!-- * <xsl:message>context: <xsl:value-of select="local-name($context)"/></xsl:message> -->
783 <!-- * <xsl:message>object: <xsl:value-of select="local-name($object)"/></xsl:message> -->
784 <!-- * <xsl:message>toc-output-dir: <xsl:value-of select="$toc-output-dir"/></xsl:message> -->
785 <!-- * <xsl:message>linked-file-output-dir: <xsl:value-of select="$linked-file-output-dir"/></xsl:message> -->
786 <!-- * <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message> -->
787 <!-- * <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message> -->
788 <xsl:variable name="href.to">
789 <xsl:choose>
790 <!-- * 2007-07-19, MikeSmith: Added the following conditional to -->
791 <!-- * deal with a problem case for links in TOCs. It checks to see -->
792 <!-- * if the output dir that a TOC will get written to is -->
793 <!-- * different from the output dir of the file being linked to. -->
794 <!-- * If it is different, we do not call trim.common.uri.paths. -->
795 <!-- * -->
796 <!-- * Reason why I added that conditional is: I ran into a bug for -->
797 <!-- * this case: -->
798 <!-- * -->
799 <!-- * 1. we are chunking into separate dirs -->
800 <!-- * -->
801 <!-- * 2. output for the TOC is written to current dir, but the file -->
802 <!-- * being linked to is written to some subdir "foo". -->
803 <!-- * -->
804 <!-- * For that case, links to that file in that TOC did not show -->
805 <!-- * the correct path - they omitted the "foo". -->
806 <!-- * -->
807 <!-- * The cause of that problem was that the trim.common.uri.paths -->
808 <!-- * template[1] was being called under all conditions. But it's -->
809 <!-- * apparent that we don't want to call trim.common.uri.paths in -->
810 <!-- * the case where a linked file is being written to a different -->
811 <!-- * directory than the TOC that contains the link, because doing -->
812 <!-- * so will cause a necessary (not redundant) directory-name -->
813 <!-- * part of the link to get inadvertently trimmed, resulting in -->
814 <!-- * a broken link to that file. Thus, added the conditional. -->
815 <!-- * -->
816 <!-- * [1] The purpose of the trim.common.uri.paths template is to -->
817 <!-- * prevent cases where, if we didn't call it, we end up with -->
818 <!-- * unnecessary, redundant directory names getting output; for -->
819 <!-- * example, "foo/foo/refname.html". -->
820 <xsl:when test="not($toc-output-dir = $linked-file-output-dir)">
821 <xsl:value-of select="$href.to.uri"/>
822 </xsl:when>
823 <xsl:otherwise>
824 <xsl:call-template name="trim.common.uri.paths">
825 <xsl:with-param name="uriA" select="$href.to.uri"/>
826 <xsl:with-param name="uriB" select="$href.from.uri"/>
827 <xsl:with-param name="return" select="'A'"/>
828 </xsl:call-template>
829 </xsl:otherwise>
830 </xsl:choose>
831 </xsl:variable>
832 <xsl:variable name="href.from">
833 <xsl:call-template name="trim.common.uri.paths">
834 <xsl:with-param name="uriA" select="$href.to.uri"/>
835 <xsl:with-param name="uriB" select="$href.from.uri"/>
836 <xsl:with-param name="return" select="'B'"/>
837 </xsl:call-template>
838 </xsl:variable>
839 <xsl:variable name="depth">
840 <xsl:call-template name="count.uri.path.depth">
841 <xsl:with-param name="filename" select="$href.from"/>
842 </xsl:call-template>
843 </xsl:variable>
844 <xsl:variable name="href">
845 <xsl:call-template name="copy-string">
846 <xsl:with-param name="string" select="'../'"/>
847 <xsl:with-param name="count" select="$depth"/>
848 </xsl:call-template>
849 <xsl:value-of select="$href.to"/>
850 </xsl:variable>
851 <!--
852 <xsl:message>
853 <xsl:text>In </xsl:text>
854 <xsl:value-of select="name(.)"/>
855 <xsl:text> (</xsl:text>
856 <xsl:value-of select="$href.from"/>
857 <xsl:text>,</xsl:text>
858 <xsl:value-of select="$depth"/>
859 <xsl:text>) </xsl:text>
860 <xsl:value-of select="name($object)"/>
861 <xsl:text> href=</xsl:text>
862 <xsl:value-of select="$href"/>
863 </xsl:message>
864 -->
865 <xsl:value-of select="$href"/>
866</xsl:template>
867
868<!-- Returns the complete olink href value if found -->
869<!-- Must take into account any dbhtml dir of the chunk containing the olink -->
870<xsl:template name="make.olink.href">
871 <xsl:param name="olink.key" select="''"/>
872 <xsl:param name="target.database"/>
873
874 <xsl:if test="$olink.key != ''">
875 <xsl:variable name="target.href">
876 <xsl:for-each select="$target.database">
877 <xsl:value-of select="key('targetptr-key', $olink.key)/@href"/>
878 </xsl:for-each>
879 </xsl:variable>
880
881 <!-- an olink starting point may be in a subdirectory, so need
882 the "from" reference point to compute a relative path -->
883
884 <xsl:variable name="from.href">
885 <xsl:call-template name="olink.from.uri">
886 <xsl:with-param name="target.database" select="$target.database"/>
887 <xsl:with-param name="object" select="."/>
888 <xsl:with-param name="object.targetdoc" select="$current.docid"/>
889 </xsl:call-template>
890 </xsl:variable>
891
892 <!-- If the from.href has directory path, then must "../" upward
893 to document level -->
894 <xsl:variable name="upward.from.path">
895 <xsl:call-template name="upward.path">
896 <xsl:with-param name="path" select="$from.href"/>
897 </xsl:call-template>
898 </xsl:variable>
899
900 <xsl:variable name="targetdoc">
901 <xsl:value-of select="substring-before($olink.key, '/')"/>
902 </xsl:variable>
903
904 <!-- Does the target database use a sitemap? -->
905 <xsl:variable name="use.sitemap">
906 <xsl:choose>
907 <xsl:when test="$target.database//sitemap">1</xsl:when>
908 <xsl:otherwise>0</xsl:otherwise>
909 </xsl:choose>
910 </xsl:variable>
911
912
913 <!-- Get the baseuri for this targetptr -->
914 <xsl:variable name="baseuri">
915 <xsl:choose>
916 <!-- Does the database use a sitemap? -->
917 <xsl:when test="$use.sitemap != 0">
918 <xsl:choose>
919 <!-- Was current.docid parameter set? -->
920 <xsl:when test="$current.docid != ''">
921 <!-- Was it found in the database? -->
922 <xsl:variable name="currentdoc.key">
923 <xsl:for-each select="$target.database">
924 <xsl:value-of select="key('targetdoc-key', $current.docid)/@targetdoc"/>
925 </xsl:for-each>
926 </xsl:variable>
927 <xsl:choose>
928 <xsl:when test="$currentdoc.key != ''">
929 <xsl:for-each select="$target.database">
930 <xsl:call-template name="targetpath">
931 <xsl:with-param name="dirnode" select="key('targetdoc-key', $current.docid)/parent::dir"/>
932 <xsl:with-param name="targetdoc" select="$targetdoc"/>
933 </xsl:call-template>
934 </xsl:for-each>
935 </xsl:when>
936 <xsl:otherwise>
937 <xsl:message>
938 <xsl:text>Olink error: cannot compute relative </xsl:text>
939 <xsl:text>sitemap path because $current.docid '</xsl:text>
940 <xsl:value-of select="$current.docid"/>
941 <xsl:text>' not found in target database.</xsl:text>
942 </xsl:message>
943 </xsl:otherwise>
944 </xsl:choose>
945 </xsl:when>
946 <xsl:otherwise>
947 <xsl:message>
948 <xsl:text>Olink warning: cannot compute relative </xsl:text>
949 <xsl:text>sitemap path without $current.docid parameter</xsl:text>
950 </xsl:message>
951 </xsl:otherwise>
952 </xsl:choose>
953 <!-- In either case, add baseuri from its document entry-->
954 <xsl:variable name="docbaseuri">
955 <xsl:for-each select="$target.database">
956 <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri"/>
957 </xsl:for-each>
958 </xsl:variable>
959 <xsl:if test="$docbaseuri != ''">
960 <xsl:value-of select="$docbaseuri"/>
961 </xsl:if>
962 </xsl:when>
963 <!-- No database sitemap in use -->
964 <xsl:otherwise>
965 <!-- Just use any baseuri from its document entry -->
966 <xsl:variable name="docbaseuri">
967 <xsl:for-each select="$target.database">
968 <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri"/>
969 </xsl:for-each>
970 </xsl:variable>
971 <xsl:if test="$docbaseuri != ''">
972 <xsl:value-of select="$docbaseuri"/>
973 </xsl:if>
974 </xsl:otherwise>
975 </xsl:choose>
976 </xsl:variable>
977
978 <!-- Form the href information -->
979 <xsl:if test="not(contains($baseuri, ':'))">
980 <!-- if not an absolute uri, add upward path from olink chunk -->
981 <xsl:value-of select="$upward.from.path"/>
982 </xsl:if>
983
984 <xsl:if test="$baseuri != ''">
985 <xsl:value-of select="$baseuri"/>
986 <xsl:if test="substring($target.href,1,1) != '#'">
987 <!--xsl:text>/</xsl:text-->
988 </xsl:if>
989 </xsl:if>
990 <!-- optionally turn off frag for PDF references -->
991 <xsl:if test="not($insert.olink.pdf.frag = 0 and translate(substring($baseuri, string-length($baseuri) - 3), 'PDF', 'pdf') = '.pdf' and starts-with($target.href, '#') )">
992 <xsl:value-of select="$target.href"/>
993 </xsl:if>
994 </xsl:if>
995</xsl:template>
996
997<!-- Computes "../" to reach top -->
998<xsl:template name="upward.path">
999 <xsl:param name="path" select="''"/>
1000 <xsl:choose>
1001 <!-- Don't bother with absolute uris -->
1002 <xsl:when test="contains($path, ':')"/>
1003 <xsl:when test="starts-with($path, '/')"/>
1004 <xsl:when test="contains($path, '/')">
1005 <xsl:text>../</xsl:text>
1006 <xsl:call-template name="upward.path">
1007 <xsl:with-param name="path" select="substring-after($path, '/')"/>
1008 </xsl:call-template>
1009 </xsl:when>
1010 </xsl:choose>
1011
1012</xsl:template>
1013
1014<!-- ==================================================================== -->
1015
1016<xsl:template name="html.head">
1017 <xsl:param name="prev" select="/foo"/>
1018 <xsl:param name="next" select="/foo"/>
1019 <xsl:variable name="this" select="."/>
1020 <xsl:variable name="home" select="/*[1]"/>
1021 <xsl:variable name="up" select="parent::*"/>
1022
1023 <head>
1024 <xsl:call-template name="system.head.content"/>
1025 <xsl:call-template name="head.content"/>
1026
1027 <xsl:if test="$home">
1028 <link rel="start">
1029 <xsl:attribute name="href">
1030 <xsl:call-template name="href.target">
1031 <xsl:with-param name="object" select="$home"/>
1032 </xsl:call-template>
1033 </xsl:attribute>
1034 <xsl:attribute name="title">
1035 <xsl:apply-templates select="$home" mode="object.title.markup.textonly"/>
1036 </xsl:attribute>
1037 </link>
1038 </xsl:if>
1039
1040 <xsl:if test="$up">
1041 <link rel="up">
1042 <xsl:attribute name="href">
1043 <xsl:call-template name="href.target">
1044 <xsl:with-param name="object" select="$up"/>
1045 </xsl:call-template>
1046 </xsl:attribute>
1047 <xsl:attribute name="title">
1048 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
1049 </xsl:attribute>
1050 </link>
1051 </xsl:if>
1052
1053 <xsl:if test="$prev">
1054 <link rel="prev">
1055 <xsl:attribute name="href">
1056 <xsl:call-template name="href.target">
1057 <xsl:with-param name="object" select="$prev"/>
1058 </xsl:call-template>
1059 </xsl:attribute>
1060 <xsl:attribute name="title">
1061 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
1062 </xsl:attribute>
1063 </link>
1064 </xsl:if>
1065
1066 <xsl:if test="$next">
1067 <link rel="next">
1068 <xsl:attribute name="href">
1069 <xsl:call-template name="href.target">
1070 <xsl:with-param name="object" select="$next"/>
1071 </xsl:call-template>
1072 </xsl:attribute>
1073 <xsl:attribute name="title">
1074 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
1075 </xsl:attribute>
1076 </link>
1077 </xsl:if>
1078
1079 <xsl:if test="$html.extra.head.links != 0">
1080 <xsl:for-each select="//part |//reference |//preface |//chapter |//article |//refentry |//appendix[not(parent::article)]|appendix |//glossary[not(parent::article)]|glossary |//index[not(parent::article)]|index">
1081 <link rel="{local-name(.)}">
1082 <xsl:attribute name="href">
1083 <xsl:call-template name="href.target">
1084 <xsl:with-param name="context" select="$this"/>
1085 <xsl:with-param name="object" select="."/>
1086 </xsl:call-template>
1087 </xsl:attribute>
1088 <xsl:attribute name="title">
1089 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1090 </xsl:attribute>
1091 </link>
1092 </xsl:for-each>
1093
1094 <xsl:for-each select="section|sect1|refsection|refsect1">
1095 <link>
1096 <xsl:attribute name="rel">
1097 <xsl:choose>
1098 <xsl:when test="local-name($this) = 'section' or local-name($this) = 'refsection'">
1099 <xsl:value-of select="'subsection'"/>
1100 </xsl:when>
1101 <xsl:otherwise>
1102 <xsl:value-of select="'section'"/>
1103 </xsl:otherwise>
1104 </xsl:choose>
1105 </xsl:attribute>
1106 <xsl:attribute name="href">
1107 <xsl:call-template name="href.target">
1108 <xsl:with-param name="context" select="$this"/>
1109 <xsl:with-param name="object" select="."/>
1110 </xsl:call-template>
1111 </xsl:attribute>
1112 <xsl:attribute name="title">
1113 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1114 </xsl:attribute>
1115 </link>
1116 </xsl:for-each>
1117
1118 <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
1119 <link rel="subsection">
1120 <xsl:attribute name="href">
1121 <xsl:call-template name="href.target">
1122 <xsl:with-param name="context" select="$this"/>
1123 <xsl:with-param name="object" select="."/>
1124 </xsl:call-template>
1125 </xsl:attribute>
1126 <xsl:attribute name="title">
1127 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1128 </xsl:attribute>
1129 </link>
1130 </xsl:for-each>
1131 </xsl:if>
1132
1133 <!-- * if we have a legalnotice and user wants it output as a -->
1134 <!-- * separate page and $html.head.legalnotice.link.types is -->
1135 <!-- * non-empty, we generate a link or links for each value in -->
1136 <!-- * $html.head.legalnotice.link.types -->
1137 <xsl:if test="//legalnotice and not($generate.legalnotice.link = 0) and not($html.head.legalnotice.link.types = '')">
1138 <xsl:call-template name="make.legalnotice.head.links"/>
1139 </xsl:if>
1140
1141 <xsl:call-template name="user.head.content"/>
1142 </head>
1143</xsl:template>
1144
1145<!-- ==================================================================== -->
1146
1147<xsl:template name="header.navigation">
1148 <xsl:param name="prev" select="/foo"/>
1149 <xsl:param name="next" select="/foo"/>
1150 <xsl:param name="nav.context"/>
1151
1152 <xsl:variable name="home" select="/*[1]"/>
1153 <xsl:variable name="up" select="parent::*"/>
1154
1155 <xsl:variable name="row1" select="$navig.showtitles != 0"/>
1156 <xsl:variable name="row2" select="count($prev) &gt; 0 or (count($up) &gt; 0 and generate-id($up) != generate-id($home) and $navig.showtitles != 0) or count($next) &gt; 0"/>
1157
1158 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
1159 <div class="navheader">
1160 <xsl:if test="$row1 or $row2">
1161 <table width="100%" summary="Navigation header">
1162 <xsl:if test="$row1">
1163 <tr>
1164 <th colspan="3" align="center">
1165 <xsl:apply-templates select="." mode="object.title.markup"/>
1166 </th>
1167 </tr>
1168 </xsl:if>
1169
1170 <xsl:if test="$row2">
1171 <tr>
1172 <td width="20%" align="left">
1173 <xsl:if test="count($prev)&gt;0">
1174 <a accesskey="p">
1175 <xsl:attribute name="href">
1176 <xsl:call-template name="href.target">
1177 <xsl:with-param name="object" select="$prev"/>
1178 </xsl:call-template>
1179 </xsl:attribute>
1180 <xsl:call-template name="navig.content">
1181 <xsl:with-param name="direction" select="'prev'"/>
1182 </xsl:call-template>
1183 </a>
1184 </xsl:if>
1185 <xsl:text>&#160;</xsl:text>
1186 </td>
1187 <th width="60%" align="center">
1188 <xsl:choose>
1189 <xsl:when test="count($up) &gt; 0 and generate-id($up) != generate-id($home) and $navig.showtitles != 0">
1190 <xsl:apply-templates select="$up" mode="object.title.markup"/>
1191 </xsl:when>
1192 <xsl:otherwise>&#160;</xsl:otherwise>
1193 </xsl:choose>
1194 </th>
1195 <td width="20%" align="right">
1196 <xsl:text>&#160;</xsl:text>
1197 <xsl:if test="count($next)&gt;0">
1198 <a accesskey="n">
1199 <xsl:attribute name="href">
1200 <xsl:call-template name="href.target">
1201 <xsl:with-param name="object" select="$next"/>
1202 </xsl:call-template>
1203 </xsl:attribute>
1204 <xsl:call-template name="navig.content">
1205 <xsl:with-param name="direction" select="'next'"/>
1206 </xsl:call-template>
1207 </a>
1208 </xsl:if>
1209 </td>
1210 </tr>
1211 </xsl:if>
1212 </table>
1213 </xsl:if>
1214 <xsl:if test="$header.rule != 0">
1215 <hr/>
1216 </xsl:if>
1217 </div>
1218 </xsl:if>
1219</xsl:template>
1220
1221<!-- ==================================================================== -->
1222
1223<xsl:template name="footer.navigation">
1224 <xsl:param name="prev" select="/foo"/>
1225 <xsl:param name="next" select="/foo"/>
1226 <xsl:param name="nav.context"/>
1227
1228 <xsl:variable name="home" select="/*[1]"/>
1229 <xsl:variable name="up" select="parent::*"/>
1230
1231 <xsl:variable name="row1" select="count($prev) &gt; 0 or count($up) &gt; 0 or count($next) &gt; 0"/>
1232
1233 <xsl:variable name="row2" select="($prev and $navig.showtitles != 0) or (generate-id($home) != generate-id(.) or $nav.context = 'toc') or ($chunk.tocs.and.lots != 0 and $nav.context != 'toc') or ($next and $navig.showtitles != 0)"/>
1234
1235 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
1236 <div class="navfooter">
1237 <xsl:if test="$footer.rule != 0">
1238 <hr/>
1239 </xsl:if>
1240
1241 <xsl:if test="$row1 or $row2">
1242 <table width="100%" summary="Navigation footer">
1243 <xsl:if test="$row1">
1244 <tr>
1245 <td width="40%" align="left">
1246 <xsl:if test="count($prev)&gt;0">
1247 <a accesskey="p">
1248 <xsl:attribute name="href">
1249 <xsl:call-template name="href.target">
1250 <xsl:with-param name="object" select="$prev"/>
1251 </xsl:call-template>
1252 </xsl:attribute>
1253 <xsl:call-template name="navig.content">
1254 <xsl:with-param name="direction" select="'prev'"/>
1255 </xsl:call-template>
1256 </a>
1257 </xsl:if>
1258 <xsl:text>&#160;</xsl:text>
1259 </td>
1260 <td width="20%" align="center">
1261 <xsl:choose>
1262 <xsl:when test="count($up)&gt;0 and generate-id($up) != generate-id($home)">
1263 <a accesskey="u">
1264 <xsl:attribute name="href">
1265 <xsl:call-template name="href.target">
1266 <xsl:with-param name="object" select="$up"/>
1267 </xsl:call-template>
1268 </xsl:attribute>
1269 <xsl:call-template name="navig.content">
1270 <xsl:with-param name="direction" select="'up'"/>
1271 </xsl:call-template>
1272 </a>
1273 </xsl:when>
1274 <xsl:otherwise>&#160;</xsl:otherwise>
1275 </xsl:choose>
1276 </td>
1277 <td width="40%" align="right">
1278 <xsl:text>&#160;</xsl:text>
1279 <xsl:if test="count($next)&gt;0">
1280 <a accesskey="n">
1281 <xsl:attribute name="href">
1282 <xsl:call-template name="href.target">
1283 <xsl:with-param name="object" select="$next"/>
1284 </xsl:call-template>
1285 </xsl:attribute>
1286 <xsl:call-template name="navig.content">
1287 <xsl:with-param name="direction" select="'next'"/>
1288 </xsl:call-template>
1289 </a>
1290 </xsl:if>
1291 </td>
1292 </tr>
1293 </xsl:if>
1294
1295 <xsl:if test="$row2">
1296 <tr>
1297 <td width="40%" align="left" valign="top">
1298 <xsl:if test="$navig.showtitles != 0">
1299 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
1300 </xsl:if>
1301 <xsl:text>&#160;</xsl:text>
1302 </td>
1303 <td width="20%" align="center">
1304 <xsl:choose>
1305 <xsl:when test="$home != . or $nav.context = 'toc'">
1306 <a accesskey="h">
1307 <xsl:attribute name="href">
1308 <xsl:call-template name="href.target">
1309 <xsl:with-param name="object" select="$home"/>
1310 </xsl:call-template>
1311 </xsl:attribute>
1312 <xsl:call-template name="navig.content">
1313 <xsl:with-param name="direction" select="'home'"/>
1314 </xsl:call-template>
1315 </a>
1316 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1317 <xsl:text>&#160;|&#160;</xsl:text>
1318 </xsl:if>
1319 </xsl:when>
1320 <xsl:otherwise>&#160;</xsl:otherwise>
1321 </xsl:choose>
1322
1323 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1324 <a accesskey="t">
1325 <xsl:attribute name="href">
1326 <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename">
1327 <xsl:with-param name="recursive" select="true()"/>
1328 </xsl:apply-templates>
1329 <xsl:text>-toc</xsl:text>
1330 <xsl:value-of select="$html.ext"/>
1331 </xsl:attribute>
1332 <xsl:call-template name="gentext">
1333 <xsl:with-param name="key" select="'nav-toc'"/>
1334 </xsl:call-template>
1335 </a>
1336 </xsl:if>
1337 </td>
1338 <td width="40%" align="right" valign="top">
1339 <xsl:text>&#160;</xsl:text>
1340 <xsl:if test="$navig.showtitles != 0">
1341 <xsl:apply-templates select="$next" mode="object.title.markup"/>
1342 </xsl:if>
1343 </td>
1344 </tr>
1345 </xsl:if>
1346 </table>
1347 </xsl:if>
1348 </div>
1349 </xsl:if>
1350</xsl:template>
1351
1352<!-- ==================================================================== -->
1353
1354<xsl:template name="navig.content">
1355 <xsl:param name="direction" select="next"/>
1356 <xsl:variable name="navtext">
1357 <xsl:choose>
1358 <xsl:when test="$direction = 'prev'">
1359 <xsl:call-template name="gentext.nav.prev"/>
1360 </xsl:when>
1361 <xsl:when test="$direction = 'next'">
1362 <xsl:call-template name="gentext.nav.next"/>
1363 </xsl:when>
1364 <xsl:when test="$direction = 'up'">
1365 <xsl:call-template name="gentext.nav.up"/>
1366 </xsl:when>
1367 <xsl:when test="$direction = 'home'">
1368 <xsl:call-template name="gentext.nav.home"/>
1369 </xsl:when>
1370 <xsl:otherwise>
1371 <xsl:text>xxx</xsl:text>
1372 </xsl:otherwise>
1373 </xsl:choose>
1374 </xsl:variable>
1375
1376 <xsl:choose>
1377 <xsl:when test="$navig.graphics != 0">
1378 <img>
1379 <xsl:attribute name="src">
1380 <xsl:value-of select="$navig.graphics.path"/>
1381 <xsl:value-of select="$direction"/>
1382 <xsl:value-of select="$navig.graphics.extension"/>
1383 </xsl:attribute>
1384 <xsl:attribute name="alt">
1385 <xsl:value-of select="$navtext"/>
1386 </xsl:attribute>
1387 </img>
1388 </xsl:when>
1389 <xsl:otherwise>
1390 <xsl:value-of select="$navtext"/>
1391 </xsl:otherwise>
1392 </xsl:choose>
1393</xsl:template>
1394
1395<!-- ==================================================================== -->
1396
1397<!-- * The following template assumes that the first legalnotice -->
1398<!-- * instance found in a document applies to the contents of the -->
1399<!-- * entire document. It generates an HTML link in each chunk, back -->
1400<!-- * to the file containing the contents of the first legalnotice. -->
1401<!-- * -->
1402<!-- * Actually, it may generate multiple link instances in each chunk, -->
1403<!-- * because it walks through the space-separated list of link -->
1404<!-- * types specified in the $html.head.legalnotice.link.types param, -->
1405<!-- * popping off link types and generating links for them until it -->
1406<!-- * depletes the list. -->
1407
1408<xsl:template name="make.legalnotice.head.links">
1409 <!-- * the following ID is used as part of the legalnotice filename; -->
1410 <!-- * we need it in order to construct the filename for use in the -->
1411 <!-- * value of the href attribute on the link -->
1412 <xsl:param name="id">
1413 <xsl:call-template name="object.id">
1414 <xsl:with-param name="object" select="(//legalnotice)[1]"/>
1415 </xsl:call-template>
1416 </xsl:param>
1417 <xsl:param name="linktype">
1418 <xsl:choose>
1419 <xsl:when test="contains($html.head.legalnotice.link.types, ' ')">
1420 <xsl:value-of select="normalize-space( substring-before($html.head.legalnotice.link.types, ' '))"/>
1421 </xsl:when>
1422 <xsl:otherwise>
1423 <xsl:value-of select="$html.head.legalnotice.link.types"/>
1424 </xsl:otherwise>
1425 </xsl:choose>
1426 </xsl:param>
1427 <xsl:param name="remaining.linktypes" select="concat( normalize-space( substring-after($html.head.legalnotice.link.types, ' ')),' ')"/>
1428 <xsl:if test="not($linktype = '')">
1429 <link rel="{$linktype}">
1430 <xsl:attribute name="href">
1431 <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
1432 </xsl:attribute>
1433 <xsl:attribute name="title">
1434 <xsl:apply-templates select="(//legalnotice)[1]" mode="object.title.markup.textonly"/>
1435 </xsl:attribute>
1436 </link>
1437 <xsl:call-template name="make.legalnotice.head.links">
1438 <!-- * pop the next value off the list of link types -->
1439 <xsl:with-param name="linktype" select="substring-before($remaining.linktypes, ' ')"/>
1440 <!-- * remove the link type from the list of remaining link types -->
1441 <xsl:with-param name="remaining.linktypes" select="substring-after($remaining.linktypes, ' ')"/>
1442 </xsl:call-template>
1443 </xsl:if>
1444</xsl:template>
1445
1446<!-- ==================================================================== -->
1447<xsl:template name="chunk-element-content">
1448 <xsl:param name="prev"/>
1449 <xsl:param name="next"/>
1450 <xsl:param name="nav.context"/>
1451 <xsl:param name="content">
1452 <xsl:apply-imports/>
1453 </xsl:param>
1454
1455 <xsl:call-template name="user.preroot"/>
1456
1457 <html>
1458 <xsl:call-template name="html.head">
1459 <xsl:with-param name="prev" select="$prev"/>
1460 <xsl:with-param name="next" select="$next"/>
1461 </xsl:call-template>
1462
1463 <body>
1464 <xsl:call-template name="body.attributes"/>
1465 <xsl:call-template name="user.header.navigation"/>
1466
1467 <xsl:call-template name="header.navigation">
1468 <xsl:with-param name="prev" select="$prev"/>
1469 <xsl:with-param name="next" select="$next"/>
1470 <xsl:with-param name="nav.context" select="$nav.context"/>
1471 </xsl:call-template>
1472
1473 <xsl:call-template name="user.header.content"/>
1474
1475 <xsl:copy-of select="$content"/>
1476
1477 <xsl:call-template name="user.footer.content"/>
1478
1479 <xsl:call-template name="footer.navigation">
1480 <xsl:with-param name="prev" select="$prev"/>
1481 <xsl:with-param name="next" select="$next"/>
1482 <xsl:with-param name="nav.context" select="$nav.context"/>
1483 </xsl:call-template>
1484
1485 <xsl:call-template name="user.footer.navigation"/>
1486 </body>
1487 </html>
1488 <xsl:value-of select="$chunk.append"/>
1489</xsl:template>
1490
1491<!-- ==================================================================== -->
1492<xsl:template name="generate.manifest">
1493 <xsl:param name="node" select="/"/>
1494 <xsl:call-template name="write.text.chunk">
1495 <xsl:with-param name="filename">
1496 <xsl:if test="$manifest.in.base.dir != 0">
1497 <xsl:value-of select="$base.dir"/>
1498 </xsl:if>
1499 <xsl:value-of select="$manifest"/>
1500 </xsl:with-param>
1501 <xsl:with-param name="method" select="'text'"/>
1502 <xsl:with-param name="content">
1503 <xsl:apply-templates select="$node" mode="enumerate-files"/>
1504 </xsl:with-param>
1505 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
1506 </xsl:call-template>
1507</xsl:template>
1508
1509<!-- ==================================================================== -->
1510
1511<xsl:template name="dbhtml-dir">
1512 <xsl:param name="context" select="."/>
1513 <!-- directories are now inherited from previous levels -->
1514 <xsl:variable name="ppath">
1515 <xsl:if test="$context/parent::*">
1516 <xsl:call-template name="dbhtml-dir">
1517 <xsl:with-param name="context" select="$context/parent::*"/>
1518 </xsl:call-template>
1519 </xsl:if>
1520 </xsl:variable>
1521 <xsl:variable name="path">
1522 <xsl:call-template name="pi.dbhtml_dir">
1523 <xsl:with-param name="node" select="$context"/>
1524 </xsl:call-template>
1525 </xsl:variable>
1526 <xsl:choose>
1527 <xsl:when test="$path = ''">
1528 <xsl:if test="$ppath != ''">
1529 <xsl:value-of select="$ppath"/>
1530 </xsl:if>
1531 </xsl:when>
1532 <xsl:otherwise>
1533 <xsl:if test="$ppath != ''">
1534 <xsl:value-of select="$ppath"/>
1535 <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
1536 <xsl:text>/</xsl:text>
1537 </xsl:if>
1538 </xsl:if>
1539 <xsl:value-of select="$path"/>
1540 <xsl:text>/</xsl:text>
1541 </xsl:otherwise>
1542 </xsl:choose>
1543</xsl:template>
1544
1545</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.