1 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
2 | xmlns:exsl="http://exslt.org/common"
|
---|
3 | xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
|
---|
4 | xmlns:ng="http://docbook.org/docbook-ng"
|
---|
5 | xmlns:db="http://docbook.org/ns/docbook"
|
---|
6 | version="1.0"
|
---|
7 | exclude-result-prefixes="exsl cf ng db">
|
---|
8 |
|
---|
9 | <!-- ********************************************************************
|
---|
10 | $Id: chunk-common.xsl 9717 2013-01-25 18:13:36Z bobstayton $
|
---|
11 | ********************************************************************
|
---|
12 |
|
---|
13 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
14 | See ../README or http://docbook.sf.net/release/xsl/current/ for
|
---|
15 | copyright and other information.
|
---|
16 |
|
---|
17 | ******************************************************************** -->
|
---|
18 |
|
---|
19 | <!-- ==================================================================== -->
|
---|
20 |
|
---|
21 | <xsl:param name="onechunk" select="0"/>
|
---|
22 | <xsl:param name="refentry.separator" select="0"/>
|
---|
23 | <xsl:param name="chunk.fast" select="0"/>
|
---|
24 |
|
---|
25 | <xsl:key name="genid" match="*" use="generate-id()"/>
|
---|
26 |
|
---|
27 | <!-- ==================================================================== -->
|
---|
28 |
|
---|
29 | <xsl:variable name="chunk.hierarchy">
|
---|
30 | <xsl:if test="$chunk.fast != 0">
|
---|
31 | <xsl:choose>
|
---|
32 | <!-- Are we handling a docbook5 document? -->
|
---|
33 | <xsl:when test="$exsl.node.set.available != 0
|
---|
34 | and (*/self::ng:* or */self::db:*)">
|
---|
35 | <xsl:if test="$chunk.quietly = 0">
|
---|
36 | <xsl:message>Computing stripped namespace chunks...</xsl:message>
|
---|
37 | </xsl:if>
|
---|
38 | <xsl:apply-templates mode="find.chunks" select="exsl:node-set($no.namespace)"/>
|
---|
39 | </xsl:when>
|
---|
40 | <xsl:when test="$exsl.node.set.available != 0">
|
---|
41 | <xsl:if test="$chunk.quietly = 0">
|
---|
42 | <xsl:message>Computing chunks...</xsl:message>
|
---|
43 | </xsl:if>
|
---|
44 |
|
---|
45 | <xsl:apply-templates select="/*" mode="find.chunks"/>
|
---|
46 | </xsl:when>
|
---|
47 | <xsl:otherwise>
|
---|
48 | <xsl:if test="$chunk.quietly = 0">
|
---|
49 | <xsl:message>
|
---|
50 | <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
|
---|
51 | <xsl:text>Using "slow" chunking.</xsl:text>
|
---|
52 | </xsl:message>
|
---|
53 | </xsl:if>
|
---|
54 | </xsl:otherwise>
|
---|
55 | </xsl:choose>
|
---|
56 | </xsl:if>
|
---|
57 | </xsl:variable>
|
---|
58 |
|
---|
59 | <!-- ==================================================================== -->
|
---|
60 |
|
---|
61 | <xsl:template name="process-chunk-element">
|
---|
62 | <xsl:param name="content">
|
---|
63 | <xsl:apply-imports/>
|
---|
64 | </xsl:param>
|
---|
65 |
|
---|
66 | <xsl:choose>
|
---|
67 | <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
|
---|
68 | <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
|
---|
69 | <xsl:variable name="genid" select="generate-id()"/>
|
---|
70 |
|
---|
71 | <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
|
---|
72 |
|
---|
73 | <xsl:variable name="prevdiv"
|
---|
74 | select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
|
---|
75 | <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
|
---|
76 |
|
---|
77 | <xsl:variable name="nextdiv"
|
---|
78 | select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
|
---|
79 | <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
|
---|
80 |
|
---|
81 | <xsl:choose>
|
---|
82 | <xsl:when test="$onechunk != 0 and parent::*">
|
---|
83 | <xsl:copy-of select="$content"/>
|
---|
84 | </xsl:when>
|
---|
85 | <xsl:otherwise>
|
---|
86 | <xsl:call-template name="process-chunk">
|
---|
87 | <xsl:with-param name="prev" select="$prev"/>
|
---|
88 | <xsl:with-param name="next" select="$next"/>
|
---|
89 | <xsl:with-param name="content" select="$content"/>
|
---|
90 | </xsl:call-template>
|
---|
91 | </xsl:otherwise>
|
---|
92 | </xsl:choose>
|
---|
93 | </xsl:when>
|
---|
94 | <xsl:otherwise>
|
---|
95 | <xsl:choose>
|
---|
96 | <xsl:when test="$onechunk != 0 and not(parent::*)">
|
---|
97 | <xsl:call-template name="chunk-all-sections">
|
---|
98 | <xsl:with-param name="content" select="$content"/>
|
---|
99 | </xsl:call-template>
|
---|
100 | </xsl:when>
|
---|
101 | <xsl:when test="$onechunk != 0">
|
---|
102 | <xsl:copy-of select="$content"/>
|
---|
103 | </xsl:when>
|
---|
104 | <xsl:when test="$chunk.first.sections = 0">
|
---|
105 | <xsl:call-template name="chunk-first-section-with-parent">
|
---|
106 | <xsl:with-param name="content" select="$content"/>
|
---|
107 | </xsl:call-template>
|
---|
108 | </xsl:when>
|
---|
109 | <xsl:otherwise>
|
---|
110 | <xsl:call-template name="chunk-all-sections">
|
---|
111 | <xsl:with-param name="content" select="$content"/>
|
---|
112 | </xsl:call-template>
|
---|
113 | </xsl:otherwise>
|
---|
114 | </xsl:choose>
|
---|
115 | </xsl:otherwise>
|
---|
116 | </xsl:choose>
|
---|
117 | </xsl:template>
|
---|
118 |
|
---|
119 | <xsl:template name="process-chunk">
|
---|
120 | <xsl:param name="prev" select="."/>
|
---|
121 | <xsl:param name="next" select="."/>
|
---|
122 | <xsl:param name="content">
|
---|
123 | <xsl:apply-imports/>
|
---|
124 | </xsl:param>
|
---|
125 |
|
---|
126 | <xsl:variable name="ischunk">
|
---|
127 | <xsl:call-template name="chunk"/>
|
---|
128 | </xsl:variable>
|
---|
129 |
|
---|
130 | <xsl:variable name="chunkfn">
|
---|
131 | <xsl:if test="$ischunk='1'">
|
---|
132 | <xsl:apply-templates mode="chunk-filename" select="."/>
|
---|
133 | </xsl:if>
|
---|
134 | </xsl:variable>
|
---|
135 |
|
---|
136 | <xsl:if test="$ischunk='0'">
|
---|
137 | <xsl:message>
|
---|
138 | <xsl:text>Error </xsl:text>
|
---|
139 | <xsl:value-of select="name(.)"/>
|
---|
140 | <xsl:text> is not a chunk!</xsl:text>
|
---|
141 | </xsl:message>
|
---|
142 | </xsl:if>
|
---|
143 |
|
---|
144 | <xsl:variable name="filename">
|
---|
145 | <xsl:call-template name="make-relative-filename">
|
---|
146 | <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
|
---|
147 | <xsl:with-param name="base.name" select="$chunkfn"/>
|
---|
148 | </xsl:call-template>
|
---|
149 | </xsl:variable>
|
---|
150 |
|
---|
151 | <xsl:call-template name="write.chunk">
|
---|
152 | <xsl:with-param name="filename" select="$filename"/>
|
---|
153 | <xsl:with-param name="content">
|
---|
154 | <xsl:call-template name="chunk-element-content">
|
---|
155 | <xsl:with-param name="prev" select="$prev"/>
|
---|
156 | <xsl:with-param name="next" select="$next"/>
|
---|
157 | <xsl:with-param name="content" select="$content"/>
|
---|
158 | </xsl:call-template>
|
---|
159 | </xsl:with-param>
|
---|
160 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
161 | </xsl:call-template>
|
---|
162 | </xsl:template>
|
---|
163 |
|
---|
164 | <xsl:template name="chunk-first-section-with-parent">
|
---|
165 | <xsl:param name="content">
|
---|
166 | <xsl:apply-imports/>
|
---|
167 | </xsl:param>
|
---|
168 |
|
---|
169 | <!-- These xpath expressions are really hairy. The trick is to pick sections -->
|
---|
170 | <!-- that are not first children and are not the children of first children -->
|
---|
171 |
|
---|
172 | <!-- Break these variables into pieces to work around
|
---|
173 | http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
|
---|
174 |
|
---|
175 | <xsl:variable name="prev-v1"
|
---|
176 | select="(ancestor::sect1[$chunk.section.depth > 0
|
---|
177 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
178 | and preceding-sibling::sect1][1]
|
---|
179 |
|
---|
180 | |ancestor::sect2[$chunk.section.depth > 1
|
---|
181 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
182 | and preceding-sibling::sect2
|
---|
183 | and parent::sect1[preceding-sibling::sect1]][1]
|
---|
184 |
|
---|
185 | |ancestor::sect3[$chunk.section.depth > 2
|
---|
186 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
187 | and preceding-sibling::sect3
|
---|
188 | and parent::sect2[preceding-sibling::sect2]
|
---|
189 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
190 |
|
---|
191 | |ancestor::sect4[$chunk.section.depth > 3
|
---|
192 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
193 | and preceding-sibling::sect4
|
---|
194 | and parent::sect3[preceding-sibling::sect3]
|
---|
195 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
196 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
197 |
|
---|
198 | |ancestor::sect5[$chunk.section.depth > 4
|
---|
199 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
200 | and preceding-sibling::sect5
|
---|
201 | and parent::sect4[preceding-sibling::sect4]
|
---|
202 | and ancestor::sect3[preceding-sibling::sect3]
|
---|
203 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
204 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
205 |
|
---|
206 | |ancestor::section[$chunk.section.depth > count(ancestor::section)
|
---|
207 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
208 | and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
|
---|
209 |
|
---|
210 | <xsl:variable name="prev-v2"
|
---|
211 | select="(preceding::sect1[$chunk.section.depth > 0
|
---|
212 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
213 | and preceding-sibling::sect1][1]
|
---|
214 |
|
---|
215 | |preceding::sect2[$chunk.section.depth > 1
|
---|
216 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
217 | and preceding-sibling::sect2
|
---|
218 | and parent::sect1[preceding-sibling::sect1]][1]
|
---|
219 |
|
---|
220 | |preceding::sect3[$chunk.section.depth > 2
|
---|
221 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
222 | and preceding-sibling::sect3
|
---|
223 | and parent::sect2[preceding-sibling::sect2]
|
---|
224 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
225 |
|
---|
226 | |preceding::sect4[$chunk.section.depth > 3
|
---|
227 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
228 | and preceding-sibling::sect4
|
---|
229 | and parent::sect3[preceding-sibling::sect3]
|
---|
230 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
231 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
232 |
|
---|
233 | |preceding::sect5[$chunk.section.depth > 4
|
---|
234 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
235 | and preceding-sibling::sect5
|
---|
236 | and parent::sect4[preceding-sibling::sect4]
|
---|
237 | and ancestor::sect3[preceding-sibling::sect3]
|
---|
238 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
239 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
240 |
|
---|
241 | |preceding::section[$chunk.section.depth > count(ancestor::section)
|
---|
242 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
243 | and preceding-sibling::section
|
---|
244 | and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
|
---|
245 |
|
---|
246 | <xsl:variable name="prev"
|
---|
247 | select="(preceding::book[1]
|
---|
248 | |preceding::preface[1]
|
---|
249 | |preceding::chapter[1]
|
---|
250 | |preceding::appendix[1]
|
---|
251 | |preceding::part[1]
|
---|
252 | |preceding::reference[1]
|
---|
253 | |preceding::refentry[1]
|
---|
254 | |preceding::colophon[1]
|
---|
255 | |preceding::article[1]
|
---|
256 | |preceding::topic[1]
|
---|
257 | |preceding::bibliography[parent::article or parent::book or parent::part][1]
|
---|
258 | |preceding::glossary[parent::article or parent::book or parent::part][1]
|
---|
259 | |preceding::index[$generate.index != 0]
|
---|
260 | [parent::article or parent::book or parent::part][1]
|
---|
261 | |preceding::setindex[$generate.index != 0][1]
|
---|
262 | |ancestor::set
|
---|
263 | |ancestor::book[1]
|
---|
264 | |ancestor::preface[1]
|
---|
265 | |ancestor::chapter[1]
|
---|
266 | |ancestor::appendix[1]
|
---|
267 | |ancestor::part[1]
|
---|
268 | |ancestor::reference[1]
|
---|
269 | |ancestor::article[1]
|
---|
270 | |ancestor::topic[1]
|
---|
271 | |$prev-v1
|
---|
272 | |$prev-v2)[last()]"/>
|
---|
273 |
|
---|
274 | <xsl:variable name="next-v1"
|
---|
275 | select="(following::sect1[$chunk.section.depth > 0
|
---|
276 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
277 | and preceding-sibling::sect1][1]
|
---|
278 |
|
---|
279 | |following::sect2[$chunk.section.depth > 1
|
---|
280 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
281 | and preceding-sibling::sect2
|
---|
282 | and parent::sect1[preceding-sibling::sect1]][1]
|
---|
283 |
|
---|
284 | |following::sect3[$chunk.section.depth > 2
|
---|
285 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
286 | and preceding-sibling::sect3
|
---|
287 | and parent::sect2[preceding-sibling::sect2]
|
---|
288 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
289 |
|
---|
290 | |following::sect4[$chunk.section.depth > 3
|
---|
291 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
292 | and preceding-sibling::sect4
|
---|
293 | and parent::sect3[preceding-sibling::sect3]
|
---|
294 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
295 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
296 |
|
---|
297 | |following::sect5[$chunk.section.depth > 4
|
---|
298 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
299 | and preceding-sibling::sect5
|
---|
300 | and parent::sect4[preceding-sibling::sect4]
|
---|
301 | and ancestor::sect3[preceding-sibling::sect3]
|
---|
302 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
303 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
304 |
|
---|
305 | |following::section[$chunk.section.depth > count(ancestor::section)
|
---|
306 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
307 | and preceding-sibling::section
|
---|
308 | and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
|
---|
309 |
|
---|
310 | <xsl:variable name="next-v2"
|
---|
311 | select="(descendant::sect1[$chunk.section.depth > 0
|
---|
312 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
313 | and preceding-sibling::sect1][1]
|
---|
314 |
|
---|
315 | |descendant::sect2[$chunk.section.depth > 1
|
---|
316 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
317 | and preceding-sibling::sect2
|
---|
318 | and parent::sect1[preceding-sibling::sect1]][1]
|
---|
319 |
|
---|
320 | |descendant::sect3[$chunk.section.depth > 2
|
---|
321 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
322 | and preceding-sibling::sect3
|
---|
323 | and parent::sect2[preceding-sibling::sect2]
|
---|
324 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
325 |
|
---|
326 | |descendant::sect4[$chunk.section.depth > 3
|
---|
327 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
328 | and preceding-sibling::sect4
|
---|
329 | and parent::sect3[preceding-sibling::sect3]
|
---|
330 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
331 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
332 |
|
---|
333 | |descendant::sect5[$chunk.section.depth > 4
|
---|
334 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
335 | and preceding-sibling::sect5
|
---|
336 | and parent::sect4[preceding-sibling::sect4]
|
---|
337 | and ancestor::sect3[preceding-sibling::sect3]
|
---|
338 | and ancestor::sect2[preceding-sibling::sect2]
|
---|
339 | and ancestor::sect1[preceding-sibling::sect1]][1]
|
---|
340 |
|
---|
341 | |descendant::section[$chunk.section.depth > count(ancestor::section)
|
---|
342 | and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
|
---|
343 | and preceding-sibling::section
|
---|
344 | and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
|
---|
345 |
|
---|
346 | <xsl:variable name="next"
|
---|
347 | select="(following::book[1]
|
---|
348 | |following::preface[1]
|
---|
349 | |following::chapter[1]
|
---|
350 | |following::appendix[1]
|
---|
351 | |following::part[1]
|
---|
352 | |following::reference[1]
|
---|
353 | |following::refentry[1]
|
---|
354 | |following::colophon[1]
|
---|
355 | |following::bibliography[parent::article or parent::book or parent::part][1]
|
---|
356 | |following::glossary[parent::article or parent::book or parent::part][1]
|
---|
357 | |following::index[$generate.index != 0]
|
---|
358 | [parent::article or parent::book or parent::part][1]
|
---|
359 | |following::article[1]
|
---|
360 | |following::topic[1]
|
---|
361 | |following::setindex[$generate.index != 0][1]
|
---|
362 | |descendant::book[1]
|
---|
363 | |descendant::preface[1]
|
---|
364 | |descendant::chapter[1]
|
---|
365 | |descendant::appendix[1]
|
---|
366 | |descendant::article[1]
|
---|
367 | |descendant::topic[1]
|
---|
368 | |descendant::bibliography[parent::article or parent::book or parent::part][1]
|
---|
369 | |descendant::glossary[parent::article or parent::book or parent::part][1]
|
---|
370 | |descendant::index[$generate.index != 0]
|
---|
371 | [parent::article or parent::book or parent::part][1]
|
---|
372 | |descendant::colophon[1]
|
---|
373 | |descendant::setindex[$generate.index != 0][1]
|
---|
374 | |descendant::part[1]
|
---|
375 | |descendant::reference[1]
|
---|
376 | |descendant::refentry[1]
|
---|
377 | |$next-v1
|
---|
378 | |$next-v2)[1]"/>
|
---|
379 |
|
---|
380 | <xsl:call-template name="process-chunk">
|
---|
381 | <xsl:with-param name="prev" select="$prev"/>
|
---|
382 | <xsl:with-param name="next" select="$next"/>
|
---|
383 | <xsl:with-param name="content" select="$content"/>
|
---|
384 | </xsl:call-template>
|
---|
385 | </xsl:template>
|
---|
386 |
|
---|
387 | <xsl:template name="chunk-all-sections">
|
---|
388 | <xsl:param name="content">
|
---|
389 | <xsl:apply-imports/>
|
---|
390 | </xsl:param>
|
---|
391 |
|
---|
392 | <xsl:variable name="prev-v1"
|
---|
393 | select="(preceding::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
394 | |preceding::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
395 | |preceding::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
396 | |preceding::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
397 | |preceding::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
398 | |preceding::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
|
---|
399 |
|
---|
400 | <xsl:variable name="prev-v2"
|
---|
401 | select="(ancestor::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
402 | |ancestor::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
403 | |ancestor::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
404 | |ancestor::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
405 | |ancestor::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
406 | |ancestor::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
|
---|
407 |
|
---|
408 | <xsl:variable name="prev"
|
---|
409 | select="(preceding::book[1]
|
---|
410 | |preceding::preface[1]
|
---|
411 | |preceding::chapter[1]
|
---|
412 | |preceding::appendix[1]
|
---|
413 | |preceding::part[1]
|
---|
414 | |preceding::reference[1]
|
---|
415 | |preceding::refentry[1]
|
---|
416 | |preceding::colophon[1]
|
---|
417 | |preceding::article[1]
|
---|
418 | |preceding::topic[1]
|
---|
419 | |preceding::bibliography[parent::article or parent::book or parent::part][1]
|
---|
420 | |preceding::glossary[parent::article or parent::book or parent::part][1]
|
---|
421 | |preceding::index[$generate.index != 0]
|
---|
422 | [parent::article or parent::book or parent::part][1]
|
---|
423 | |preceding::setindex[$generate.index != 0][1]
|
---|
424 | |ancestor::set
|
---|
425 | |ancestor::book[1]
|
---|
426 | |ancestor::preface[1]
|
---|
427 | |ancestor::chapter[1]
|
---|
428 | |ancestor::appendix[1]
|
---|
429 | |ancestor::part[1]
|
---|
430 | |ancestor::reference[1]
|
---|
431 | |ancestor::article[1]
|
---|
432 | |ancestor::topic[1]
|
---|
433 | |$prev-v1
|
---|
434 | |$prev-v2)[last()]"/>
|
---|
435 |
|
---|
436 | <xsl:variable name="next-v1"
|
---|
437 | select="(following::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
438 | |following::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
439 | |following::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
440 | |following::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
441 | |following::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
442 | |following::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
|
---|
443 |
|
---|
444 | <xsl:variable name="next-v2"
|
---|
445 | select="(descendant::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
446 | |descendant::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
447 | |descendant::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
448 | |descendant::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
449 | |descendant::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
|
---|
450 | |descendant::section[$chunk.section.depth
|
---|
451 | > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
|
---|
452 |
|
---|
453 | <xsl:variable name="next"
|
---|
454 | select="(following::book[1]
|
---|
455 | |following::preface[1]
|
---|
456 | |following::chapter[1]
|
---|
457 | |following::appendix[1]
|
---|
458 | |following::part[1]
|
---|
459 | |following::reference[1]
|
---|
460 | |following::refentry[1]
|
---|
461 | |following::colophon[1]
|
---|
462 | |following::bibliography[parent::article or parent::book or parent::part][1]
|
---|
463 | |following::glossary[parent::article or parent::book or parent::part][1]
|
---|
464 | |following::index[$generate.index != 0]
|
---|
465 | [parent::article or parent::book][1]
|
---|
466 | |following::article[1]
|
---|
467 | |following::topic[1]
|
---|
468 | |following::setindex[$generate.index != 0][1]
|
---|
469 | |descendant::book[1]
|
---|
470 | |descendant::preface[1]
|
---|
471 | |descendant::chapter[1]
|
---|
472 | |descendant::appendix[1]
|
---|
473 | |descendant::article[1]
|
---|
474 | |descendant::topic[1]
|
---|
475 | |descendant::bibliography[parent::article or parent::book][1]
|
---|
476 | |descendant::glossary[parent::article or parent::book or parent::part][1]
|
---|
477 | |descendant::index[$generate.index != 0]
|
---|
478 | [parent::article or parent::book][1]
|
---|
479 | |descendant::colophon[1]
|
---|
480 | |descendant::setindex[$generate.index != 0][1]
|
---|
481 | |descendant::part[1]
|
---|
482 | |descendant::reference[1]
|
---|
483 | |descendant::refentry[1]
|
---|
484 | |$next-v1
|
---|
485 | |$next-v2)[1]"/>
|
---|
486 |
|
---|
487 | <xsl:call-template name="process-chunk">
|
---|
488 | <xsl:with-param name="prev" select="$prev"/>
|
---|
489 | <xsl:with-param name="next" select="$next"/>
|
---|
490 | <xsl:with-param name="content" select="$content"/>
|
---|
491 | </xsl:call-template>
|
---|
492 | </xsl:template>
|
---|
493 |
|
---|
494 | <!-- ==================================================================== -->
|
---|
495 |
|
---|
496 | <!-- ==================================================================== -->
|
---|
497 |
|
---|
498 | <xsl:template name="make.lots">
|
---|
499 | <xsl:param name="toc.params" select="''"/>
|
---|
500 | <xsl:param name="toc"/>
|
---|
501 |
|
---|
502 | <xsl:variable name="lots">
|
---|
503 | <xsl:if test="contains($toc.params, 'toc')">
|
---|
504 | <xsl:copy-of select="$toc"/>
|
---|
505 | </xsl:if>
|
---|
506 |
|
---|
507 | <xsl:if test="contains($toc.params, 'figure')">
|
---|
508 | <xsl:choose>
|
---|
509 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
510 | <xsl:call-template name="make.lot.chunk">
|
---|
511 | <xsl:with-param name="type" select="'figure'"/>
|
---|
512 | <xsl:with-param name="lot">
|
---|
513 | <xsl:call-template name="list.of.titles">
|
---|
514 | <xsl:with-param name="titles" select="'figure'"/>
|
---|
515 | <xsl:with-param name="nodes" select=".//figure"/>
|
---|
516 | </xsl:call-template>
|
---|
517 | </xsl:with-param>
|
---|
518 | </xsl:call-template>
|
---|
519 | </xsl:when>
|
---|
520 | <xsl:otherwise>
|
---|
521 | <xsl:call-template name="list.of.titles">
|
---|
522 | <xsl:with-param name="titles" select="'figure'"/>
|
---|
523 | <xsl:with-param name="nodes" select=".//figure"/>
|
---|
524 | </xsl:call-template>
|
---|
525 | </xsl:otherwise>
|
---|
526 | </xsl:choose>
|
---|
527 | </xsl:if>
|
---|
528 |
|
---|
529 | <xsl:if test="contains($toc.params, 'table')">
|
---|
530 | <xsl:choose>
|
---|
531 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
532 | <xsl:call-template name="make.lot.chunk">
|
---|
533 | <xsl:with-param name="type" select="'table'"/>
|
---|
534 | <xsl:with-param name="lot">
|
---|
535 | <xsl:call-template name="list.of.titles">
|
---|
536 | <xsl:with-param name="titles" select="'table'"/>
|
---|
537 | <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
|
---|
538 | </xsl:call-template>
|
---|
539 | </xsl:with-param>
|
---|
540 | </xsl:call-template>
|
---|
541 | </xsl:when>
|
---|
542 | <xsl:otherwise>
|
---|
543 | <xsl:call-template name="list.of.titles">
|
---|
544 | <xsl:with-param name="titles" select="'table'"/>
|
---|
545 | <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
|
---|
546 | </xsl:call-template>
|
---|
547 | </xsl:otherwise>
|
---|
548 | </xsl:choose>
|
---|
549 | </xsl:if>
|
---|
550 |
|
---|
551 | <xsl:if test="contains($toc.params, 'example')">
|
---|
552 | <xsl:choose>
|
---|
553 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
554 | <xsl:call-template name="make.lot.chunk">
|
---|
555 | <xsl:with-param name="type" select="'example'"/>
|
---|
556 | <xsl:with-param name="lot">
|
---|
557 | <xsl:call-template name="list.of.titles">
|
---|
558 | <xsl:with-param name="titles" select="'example'"/>
|
---|
559 | <xsl:with-param name="nodes" select=".//example"/>
|
---|
560 | </xsl:call-template>
|
---|
561 | </xsl:with-param>
|
---|
562 | </xsl:call-template>
|
---|
563 | </xsl:when>
|
---|
564 | <xsl:otherwise>
|
---|
565 | <xsl:call-template name="list.of.titles">
|
---|
566 | <xsl:with-param name="titles" select="'example'"/>
|
---|
567 | <xsl:with-param name="nodes" select=".//example"/>
|
---|
568 | </xsl:call-template>
|
---|
569 | </xsl:otherwise>
|
---|
570 | </xsl:choose>
|
---|
571 | </xsl:if>
|
---|
572 |
|
---|
573 | <xsl:if test="contains($toc.params, 'equation')">
|
---|
574 | <xsl:choose>
|
---|
575 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
576 | <xsl:call-template name="make.lot.chunk">
|
---|
577 | <xsl:with-param name="type" select="'equation'"/>
|
---|
578 | <xsl:with-param name="lot">
|
---|
579 | <xsl:call-template name="list.of.titles">
|
---|
580 | <xsl:with-param name="titles" select="'equation'"/>
|
---|
581 | <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
|
---|
582 | </xsl:call-template>
|
---|
583 | </xsl:with-param>
|
---|
584 | </xsl:call-template>
|
---|
585 | </xsl:when>
|
---|
586 | <xsl:otherwise>
|
---|
587 | <xsl:call-template name="list.of.titles">
|
---|
588 | <xsl:with-param name="titles" select="'equation'"/>
|
---|
589 | <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
|
---|
590 | </xsl:call-template>
|
---|
591 | </xsl:otherwise>
|
---|
592 | </xsl:choose>
|
---|
593 | </xsl:if>
|
---|
594 |
|
---|
595 | <xsl:if test="contains($toc.params, 'procedure')">
|
---|
596 | <xsl:choose>
|
---|
597 | <xsl:when test="$chunk.separate.lots != '0'">
|
---|
598 | <xsl:call-template name="make.lot.chunk">
|
---|
599 | <xsl:with-param name="type" select="'procedure'"/>
|
---|
600 | <xsl:with-param name="lot">
|
---|
601 | <xsl:call-template name="list.of.titles">
|
---|
602 | <xsl:with-param name="titles" select="'procedure'"/>
|
---|
603 | <xsl:with-param name="nodes" select=".//procedure[title]"/>
|
---|
604 | </xsl:call-template>
|
---|
605 | </xsl:with-param>
|
---|
606 | </xsl:call-template>
|
---|
607 | </xsl:when>
|
---|
608 | <xsl:otherwise>
|
---|
609 | <xsl:call-template name="list.of.titles">
|
---|
610 | <xsl:with-param name="titles" select="'procedure'"/>
|
---|
611 | <xsl:with-param name="nodes" select=".//procedure[title]"/>
|
---|
612 | </xsl:call-template>
|
---|
613 | </xsl:otherwise>
|
---|
614 | </xsl:choose>
|
---|
615 | </xsl:if>
|
---|
616 | </xsl:variable>
|
---|
617 |
|
---|
618 | <xsl:if test="string($lots) != ''">
|
---|
619 | <xsl:choose>
|
---|
620 | <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
|
---|
621 | <xsl:call-template name="write.chunk">
|
---|
622 | <xsl:with-param name="filename">
|
---|
623 | <xsl:call-template name="make-relative-filename">
|
---|
624 | <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
|
---|
625 | <xsl:with-param name="base.name">
|
---|
626 | <xsl:call-template name="dbhtml-dir"/>
|
---|
627 | <xsl:value-of select="$chunked.filename.prefix"/>
|
---|
628 | <xsl:apply-templates select="." mode="recursive-chunk-filename">
|
---|
629 | <xsl:with-param name="recursive" select="true()"/>
|
---|
630 | </xsl:apply-templates>
|
---|
631 | <xsl:text>-toc</xsl:text>
|
---|
632 | <xsl:value-of select="$html.ext"/>
|
---|
633 | </xsl:with-param>
|
---|
634 | </xsl:call-template>
|
---|
635 | </xsl:with-param>
|
---|
636 | <xsl:with-param name="content">
|
---|
637 | <xsl:call-template name="chunk-element-content">
|
---|
638 | <xsl:with-param name="prev" select="/foo"/>
|
---|
639 | <xsl:with-param name="next" select="/foo"/>
|
---|
640 | <xsl:with-param name="nav.context" select="'toc'"/>
|
---|
641 | <xsl:with-param name="content">
|
---|
642 | <xsl:if test="$chunk.tocs.and.lots.has.title != 0">
|
---|
643 | <h1>
|
---|
644 | <xsl:apply-templates select="." mode="object.title.markup"/>
|
---|
645 | </h1>
|
---|
646 | </xsl:if>
|
---|
647 | <xsl:copy-of select="$lots"/>
|
---|
648 | </xsl:with-param>
|
---|
649 | </xsl:call-template>
|
---|
650 | </xsl:with-param>
|
---|
651 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
652 | </xsl:call-template>
|
---|
653 | </xsl:when>
|
---|
654 | <xsl:otherwise>
|
---|
655 | <xsl:copy-of select="$lots"/>
|
---|
656 | </xsl:otherwise>
|
---|
657 | </xsl:choose>
|
---|
658 | </xsl:if>
|
---|
659 | </xsl:template>
|
---|
660 |
|
---|
661 | <xsl:template name="make.lot.chunk">
|
---|
662 | <xsl:param name="type" select="''"/>
|
---|
663 | <xsl:param name="lot"/>
|
---|
664 |
|
---|
665 | <xsl:if test="string($lot) != ''">
|
---|
666 | <xsl:variable name="filename">
|
---|
667 | <xsl:call-template name="make-relative-filename">
|
---|
668 | <xsl:with-param name="base.dir" select="$chunk.base.dir"/>
|
---|
669 | <xsl:with-param name="base.name">
|
---|
670 | <xsl:call-template name="dbhtml-dir"/>
|
---|
671 | <xsl:value-of select="$type"/>
|
---|
672 | <xsl:text>-toc</xsl:text>
|
---|
673 | <xsl:value-of select="$html.ext"/>
|
---|
674 | </xsl:with-param>
|
---|
675 | </xsl:call-template>
|
---|
676 | </xsl:variable>
|
---|
677 |
|
---|
678 | <xsl:variable name="href">
|
---|
679 | <xsl:call-template name="make-relative-filename">
|
---|
680 | <xsl:with-param name="base.dir" select="''"/>
|
---|
681 | <xsl:with-param name="base.name">
|
---|
682 | <xsl:call-template name="dbhtml-dir"/>
|
---|
683 | <xsl:value-of select="$type"/>
|
---|
684 | <xsl:text>-toc</xsl:text>
|
---|
685 | <xsl:value-of select="$html.ext"/>
|
---|
686 | </xsl:with-param>
|
---|
687 | </xsl:call-template>
|
---|
688 | </xsl:variable>
|
---|
689 |
|
---|
690 | <xsl:call-template name="write.chunk">
|
---|
691 | <xsl:with-param name="filename" select="$filename"/>
|
---|
692 | <xsl:with-param name="content">
|
---|
693 | <xsl:call-template name="chunk-element-content">
|
---|
694 | <xsl:with-param name="prev" select="/foo"/>
|
---|
695 | <xsl:with-param name="next" select="/foo"/>
|
---|
696 | <xsl:with-param name="nav.context" select="'toc'"/>
|
---|
697 | <xsl:with-param name="content">
|
---|
698 | <xsl:copy-of select="$lot"/>
|
---|
699 | </xsl:with-param>
|
---|
700 | </xsl:call-template>
|
---|
701 | </xsl:with-param>
|
---|
702 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
703 | </xsl:call-template>
|
---|
704 | <!-- And output a link to this file -->
|
---|
705 | <div>
|
---|
706 | <xsl:attribute name="class">
|
---|
707 | <xsl:text>ListofTitles</xsl:text>
|
---|
708 | </xsl:attribute>
|
---|
709 | <a href="{$href}">
|
---|
710 | <xsl:call-template name="gentext">
|
---|
711 | <xsl:with-param name="key">
|
---|
712 | <xsl:choose>
|
---|
713 | <xsl:when test="$type='table'">ListofTables</xsl:when>
|
---|
714 | <xsl:when test="$type='figure'">ListofFigures</xsl:when>
|
---|
715 | <xsl:when test="$type='equation'">ListofEquations</xsl:when>
|
---|
716 | <xsl:when test="$type='example'">ListofExamples</xsl:when>
|
---|
717 | <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
|
---|
718 | <xsl:otherwise>ListofUnknown</xsl:otherwise>
|
---|
719 | </xsl:choose>
|
---|
720 | </xsl:with-param>
|
---|
721 | </xsl:call-template>
|
---|
722 | </a>
|
---|
723 | </div>
|
---|
724 | </xsl:if>
|
---|
725 | </xsl:template>
|
---|
726 |
|
---|
727 | <!-- ==================================================================== -->
|
---|
728 |
|
---|
729 | <xsl:template name="in.other.chunk">
|
---|
730 | <xsl:param name="chunk" select="."/>
|
---|
731 | <xsl:param name="node" select="."/>
|
---|
732 |
|
---|
733 | <xsl:variable name="is.chunk">
|
---|
734 | <xsl:call-template name="chunk">
|
---|
735 | <xsl:with-param name="node" select="$node"/>
|
---|
736 | </xsl:call-template>
|
---|
737 | </xsl:variable>
|
---|
738 |
|
---|
739 | <!--
|
---|
740 | <xsl:message>
|
---|
741 | <xsl:text>in.other.chunk: </xsl:text>
|
---|
742 | <xsl:value-of select="name($chunk)"/>
|
---|
743 | <xsl:text> </xsl:text>
|
---|
744 | <xsl:value-of select="name($node)"/>
|
---|
745 | <xsl:text> </xsl:text>
|
---|
746 | <xsl:value-of select="$chunk = $node"/>
|
---|
747 | <xsl:text> </xsl:text>
|
---|
748 | <xsl:value-of select="$is.chunk"/>
|
---|
749 | </xsl:message>
|
---|
750 | -->
|
---|
751 |
|
---|
752 | <xsl:choose>
|
---|
753 | <xsl:when test="$chunk = $node">0</xsl:when>
|
---|
754 | <xsl:when test="$is.chunk = 1">1</xsl:when>
|
---|
755 | <xsl:when test="count($node) = 0">0</xsl:when>
|
---|
756 | <xsl:otherwise>
|
---|
757 | <xsl:call-template name="in.other.chunk">
|
---|
758 | <xsl:with-param name="chunk" select="$chunk"/>
|
---|
759 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
760 | </xsl:call-template>
|
---|
761 | </xsl:otherwise>
|
---|
762 | </xsl:choose>
|
---|
763 | </xsl:template>
|
---|
764 |
|
---|
765 | <xsl:template name="count.footnotes.in.this.chunk">
|
---|
766 | <xsl:param name="node" select="."/>
|
---|
767 | <xsl:param name="footnotes" select="$node//footnote"/>
|
---|
768 | <xsl:param name="count" select="0"/>
|
---|
769 |
|
---|
770 | <!--
|
---|
771 | <xsl:message>
|
---|
772 | <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
|
---|
773 | <xsl:value-of select="name($node)"/>
|
---|
774 | </xsl:message>
|
---|
775 | -->
|
---|
776 |
|
---|
777 | <xsl:variable name="in.other.chunk">
|
---|
778 | <xsl:call-template name="in.other.chunk">
|
---|
779 | <xsl:with-param name="chunk" select="$node"/>
|
---|
780 | <xsl:with-param name="node" select="$footnotes[1]"/>
|
---|
781 | </xsl:call-template>
|
---|
782 | </xsl:variable>
|
---|
783 |
|
---|
784 | <xsl:choose>
|
---|
785 | <xsl:when test="count($footnotes) = 0">
|
---|
786 | <xsl:value-of select="$count"/>
|
---|
787 | </xsl:when>
|
---|
788 | <xsl:otherwise>
|
---|
789 | <xsl:choose>
|
---|
790 | <xsl:when test="$in.other.chunk != 0">
|
---|
791 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
792 | <xsl:with-param name="node" select="$node"/>
|
---|
793 | <xsl:with-param name="footnotes"
|
---|
794 | select="$footnotes[position() > 1]"/>
|
---|
795 | <xsl:with-param name="count" select="$count"/>
|
---|
796 | </xsl:call-template>
|
---|
797 | </xsl:when>
|
---|
798 | <xsl:when test="$footnotes[1]/ancestor::table
|
---|
799 | |$footnotes[1]/ancestor::informaltable">
|
---|
800 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
801 | <xsl:with-param name="node" select="$node"/>
|
---|
802 | <xsl:with-param name="footnotes"
|
---|
803 | select="$footnotes[position() > 1]"/>
|
---|
804 | <xsl:with-param name="count" select="$count"/>
|
---|
805 | </xsl:call-template>
|
---|
806 | </xsl:when>
|
---|
807 | <xsl:otherwise>
|
---|
808 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
809 | <xsl:with-param name="node" select="$node"/>
|
---|
810 | <xsl:with-param name="footnotes"
|
---|
811 | select="$footnotes[position() > 1]"/>
|
---|
812 | <xsl:with-param name="count" select="$count + 1"/>
|
---|
813 | </xsl:call-template>
|
---|
814 | </xsl:otherwise>
|
---|
815 | </xsl:choose>
|
---|
816 | </xsl:otherwise>
|
---|
817 | </xsl:choose>
|
---|
818 | </xsl:template>
|
---|
819 |
|
---|
820 | <xsl:template name="process.footnotes.in.this.chunk">
|
---|
821 | <xsl:param name="node" select="."/>
|
---|
822 | <xsl:param name="footnotes" select="$node//footnote"/>
|
---|
823 |
|
---|
824 | <!--
|
---|
825 | <xsl:message>process.footnotes.in.this.chunk</xsl:message>
|
---|
826 | -->
|
---|
827 |
|
---|
828 | <xsl:variable name="in.other.chunk">
|
---|
829 | <xsl:call-template name="in.other.chunk">
|
---|
830 | <xsl:with-param name="chunk" select="$node"/>
|
---|
831 | <xsl:with-param name="node" select="$footnotes[1]"/>
|
---|
832 | </xsl:call-template>
|
---|
833 | </xsl:variable>
|
---|
834 |
|
---|
835 | <xsl:choose>
|
---|
836 | <xsl:when test="count($footnotes) = 0">
|
---|
837 | <!-- nop -->
|
---|
838 | </xsl:when>
|
---|
839 | <xsl:otherwise>
|
---|
840 | <xsl:choose>
|
---|
841 | <xsl:when test="$in.other.chunk != 0">
|
---|
842 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
843 | <xsl:with-param name="node" select="$node"/>
|
---|
844 | <xsl:with-param name="footnotes"
|
---|
845 | select="$footnotes[position() > 1]"/>
|
---|
846 | </xsl:call-template>
|
---|
847 | </xsl:when>
|
---|
848 | <xsl:when test="$footnotes[1]/ancestor::table
|
---|
849 | |$footnotes[1]/ancestor::informaltable">
|
---|
850 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
851 | <xsl:with-param name="node" select="$node"/>
|
---|
852 | <xsl:with-param name="footnotes"
|
---|
853 | select="$footnotes[position() > 1]"/>
|
---|
854 | </xsl:call-template>
|
---|
855 | </xsl:when>
|
---|
856 | <xsl:otherwise>
|
---|
857 | <xsl:apply-templates select="$footnotes[1]"
|
---|
858 | mode="process.footnote.mode"/>
|
---|
859 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
860 | <xsl:with-param name="node" select="$node"/>
|
---|
861 | <xsl:with-param name="footnotes"
|
---|
862 | select="$footnotes[position() > 1]"/>
|
---|
863 | </xsl:call-template>
|
---|
864 | </xsl:otherwise>
|
---|
865 | </xsl:choose>
|
---|
866 | </xsl:otherwise>
|
---|
867 | </xsl:choose>
|
---|
868 | </xsl:template>
|
---|
869 |
|
---|
870 | <xsl:template name="process.footnotes">
|
---|
871 | <xsl:variable name="footnotes" select=".//footnote"/>
|
---|
872 | <xsl:variable name="fcount">
|
---|
873 | <xsl:call-template name="count.footnotes.in.this.chunk">
|
---|
874 | <xsl:with-param name="node" select="."/>
|
---|
875 | <xsl:with-param name="footnotes" select="$footnotes"/>
|
---|
876 | </xsl:call-template>
|
---|
877 | </xsl:variable>
|
---|
878 |
|
---|
879 | <!--
|
---|
880 | <xsl:message>
|
---|
881 | <xsl:value-of select="name(.)"/>
|
---|
882 | <xsl:text> fcount: </xsl:text>
|
---|
883 | <xsl:value-of select="$fcount"/>
|
---|
884 | </xsl:message>
|
---|
885 | -->
|
---|
886 |
|
---|
887 | <!-- Only bother to do this if there's at least one non-table footnote -->
|
---|
888 | <xsl:if test="$fcount > 0">
|
---|
889 | <div class="footnotes">
|
---|
890 | <xsl:call-template name="footnotes.attributes"/>
|
---|
891 | <br/>
|
---|
892 | <hr>
|
---|
893 | <xsl:choose>
|
---|
894 | <xsl:when test="$make.clean.html != 0">
|
---|
895 | <xsl:attribute name="class">footnote-hr</xsl:attribute>
|
---|
896 | </xsl:when>
|
---|
897 | <xsl:when test="$css.decoration != 0">
|
---|
898 | <xsl:attribute name="style">
|
---|
899 | <xsl:value-of select="concat('width:100; text-align:',
|
---|
900 | $direction.align.start,
|
---|
901 | ';',
|
---|
902 | 'margin-', $direction.align.start, ': 0')"/>
|
---|
903 | </xsl:attribute>
|
---|
904 | </xsl:when>
|
---|
905 | <xsl:otherwise>
|
---|
906 | <xsl:attribute name="width">100</xsl:attribute>
|
---|
907 | <xsl:attribute name="align"><xsl:value-of
|
---|
908 | select="$direction.align.start"/></xsl:attribute>
|
---|
909 | </xsl:otherwise>
|
---|
910 | </xsl:choose>
|
---|
911 | </hr>
|
---|
912 | <xsl:call-template name="process.footnotes.in.this.chunk">
|
---|
913 | <xsl:with-param name="node" select="."/>
|
---|
914 | <xsl:with-param name="footnotes" select="$footnotes"/>
|
---|
915 | </xsl:call-template>
|
---|
916 | </div>
|
---|
917 | </xsl:if>
|
---|
918 |
|
---|
919 | <!-- FIXME: When chunking, only the annotations actually used
|
---|
920 | in this chunk should be referenced. I don't think it
|
---|
921 | does any harm to reference them all, but it adds
|
---|
922 | unnecessary bloat to each chunk. -->
|
---|
923 | <xsl:if test="$annotation.support != 0 and //annotation">
|
---|
924 | <div class="annotation-list">
|
---|
925 | <div class="annotation-nocss">
|
---|
926 | <p>The following annotations are from this essay. You are seeing
|
---|
927 | them here because your browser doesn’t support the user-interface
|
---|
928 | techniques used to make them appear as ‘popups’ on modern browsers.</p>
|
---|
929 | </div>
|
---|
930 |
|
---|
931 | <xsl:apply-templates select="//annotation"
|
---|
932 | mode="annotation-popup"/>
|
---|
933 | </div>
|
---|
934 | </xsl:if>
|
---|
935 | </xsl:template>
|
---|
936 |
|
---|
937 | <xsl:template name="process.chunk.footnotes">
|
---|
938 | <xsl:variable name="is.chunk">
|
---|
939 | <xsl:call-template name="chunk"/>
|
---|
940 | </xsl:variable>
|
---|
941 | <xsl:if test="$is.chunk = 1">
|
---|
942 | <xsl:call-template name="process.footnotes"/>
|
---|
943 | </xsl:if>
|
---|
944 | </xsl:template>
|
---|
945 |
|
---|
946 | <!-- ====================================================================== -->
|
---|
947 |
|
---|
948 | <xsl:template name="chunk">
|
---|
949 | <xsl:param name="node" select="."/>
|
---|
950 | <!-- returns 1 if $node is a chunk -->
|
---|
951 |
|
---|
952 | <!-- ==================================================================== -->
|
---|
953 | <!-- What's a chunk?
|
---|
954 |
|
---|
955 | The root element
|
---|
956 | appendix
|
---|
957 | article
|
---|
958 | bibliography in article or part or book
|
---|
959 | book
|
---|
960 | chapter
|
---|
961 | colophon
|
---|
962 | glossary in article or part or book
|
---|
963 | index in article or part or book
|
---|
964 | part
|
---|
965 | preface
|
---|
966 | refentry
|
---|
967 | reference
|
---|
968 | sect{1,2,3,4,5} if position()>1 && depth < chunk.section.depth
|
---|
969 | section if position()>1 && depth < chunk.section.depth
|
---|
970 | set
|
---|
971 | setindex
|
---|
972 | topic
|
---|
973 | -->
|
---|
974 | <!-- ==================================================================== -->
|
---|
975 |
|
---|
976 | <!--
|
---|
977 | <xsl:message>
|
---|
978 | <xsl:text>chunk: </xsl:text>
|
---|
979 | <xsl:value-of select="name($node)"/>
|
---|
980 | <xsl:text>(</xsl:text>
|
---|
981 | <xsl:value-of select="$node/@id"/>
|
---|
982 | <xsl:text>)</xsl:text>
|
---|
983 | <xsl:text> csd: </xsl:text>
|
---|
984 | <xsl:value-of select="$chunk.section.depth"/>
|
---|
985 | <xsl:text> cfs: </xsl:text>
|
---|
986 | <xsl:value-of select="$chunk.first.sections"/>
|
---|
987 | <xsl:text> ps: </xsl:text>
|
---|
988 | <xsl:value-of select="count($node/parent::section)"/>
|
---|
989 | <xsl:text> prs: </xsl:text>
|
---|
990 | <xsl:value-of select="count($node/preceding-sibling::section)"/>
|
---|
991 | </xsl:message>
|
---|
992 | -->
|
---|
993 |
|
---|
994 | <xsl:choose>
|
---|
995 | <xsl:when test="$node/parent::*/processing-instruction('dbhtml')[normalize-space(.) = 'stop-chunking']">0</xsl:when>
|
---|
996 | <xsl:when test="not($node/parent::*)">1</xsl:when>
|
---|
997 |
|
---|
998 | <xsl:when test="local-name($node) = 'sect1'
|
---|
999 | and $chunk.section.depth >= 1
|
---|
1000 | and ($chunk.first.sections != 0
|
---|
1001 | or count($node/preceding-sibling::sect1) > 0)">
|
---|
1002 | <xsl:text>1</xsl:text>
|
---|
1003 | </xsl:when>
|
---|
1004 | <xsl:when test="local-name($node) = 'sect2'
|
---|
1005 | and $chunk.section.depth >= 2
|
---|
1006 | and ($chunk.first.sections != 0
|
---|
1007 | or count($node/preceding-sibling::sect2) > 0)">
|
---|
1008 | <xsl:call-template name="chunk">
|
---|
1009 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
1010 | </xsl:call-template>
|
---|
1011 | </xsl:when>
|
---|
1012 | <xsl:when test="local-name($node) = 'sect3'
|
---|
1013 | and $chunk.section.depth >= 3
|
---|
1014 | and ($chunk.first.sections != 0
|
---|
1015 | or count($node/preceding-sibling::sect3) > 0)">
|
---|
1016 | <xsl:call-template name="chunk">
|
---|
1017 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
1018 | </xsl:call-template>
|
---|
1019 | </xsl:when>
|
---|
1020 | <xsl:when test="local-name($node) = 'sect4'
|
---|
1021 | and $chunk.section.depth >= 4
|
---|
1022 | and ($chunk.first.sections != 0
|
---|
1023 | or count($node/preceding-sibling::sect4) > 0)">
|
---|
1024 | <xsl:call-template name="chunk">
|
---|
1025 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
1026 | </xsl:call-template>
|
---|
1027 | </xsl:when>
|
---|
1028 | <xsl:when test="local-name($node) = 'sect5'
|
---|
1029 | and $chunk.section.depth >= 5
|
---|
1030 | and ($chunk.first.sections != 0
|
---|
1031 | or count($node/preceding-sibling::sect5) > 0)">
|
---|
1032 | <xsl:call-template name="chunk">
|
---|
1033 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
1034 | </xsl:call-template>
|
---|
1035 | </xsl:when>
|
---|
1036 | <xsl:when test="local-name($node) = 'section'
|
---|
1037 | and $chunk.section.depth >= count($node/ancestor::section)+1
|
---|
1038 | and ($chunk.first.sections != 0
|
---|
1039 | or count($node/preceding-sibling::section) > 0)">
|
---|
1040 | <xsl:call-template name="chunk">
|
---|
1041 | <xsl:with-param name="node" select="$node/parent::*"/>
|
---|
1042 | </xsl:call-template>
|
---|
1043 | </xsl:when>
|
---|
1044 |
|
---|
1045 | <xsl:when test="local-name($node)='preface'">1</xsl:when>
|
---|
1046 | <xsl:when test="local-name($node)='chapter'">1</xsl:when>
|
---|
1047 | <xsl:when test="local-name($node)='appendix'">1</xsl:when>
|
---|
1048 | <xsl:when test="local-name($node)='article'">1</xsl:when>
|
---|
1049 | <xsl:when test="local-name($node)='topic'">1</xsl:when>
|
---|
1050 | <xsl:when test="local-name($node)='part'">1</xsl:when>
|
---|
1051 | <xsl:when test="local-name($node)='reference'">1</xsl:when>
|
---|
1052 | <xsl:when test="local-name($node)='refentry'">1</xsl:when>
|
---|
1053 | <xsl:when test="local-name($node)='index' and ($generate.index != 0 or count($node/*) > 0)
|
---|
1054 | and (local-name($node/parent::*) = 'article'
|
---|
1055 | or local-name($node/parent::*) = 'book'
|
---|
1056 | or local-name($node/parent::*) = 'part'
|
---|
1057 | )">1</xsl:when>
|
---|
1058 | <xsl:when test="local-name($node)='bibliography'
|
---|
1059 | and (local-name($node/parent::*) = 'article'
|
---|
1060 | or local-name($node/parent::*) = 'book'
|
---|
1061 | or local-name($node/parent::*) = 'part'
|
---|
1062 | )">1</xsl:when>
|
---|
1063 | <xsl:when test="local-name($node)='glossary'
|
---|
1064 | and (local-name($node/parent::*) = 'article'
|
---|
1065 | or local-name($node/parent::*) = 'book'
|
---|
1066 | or local-name($node/parent::*) = 'part'
|
---|
1067 | )">1</xsl:when>
|
---|
1068 | <xsl:when test="local-name($node)='colophon'">1</xsl:when>
|
---|
1069 | <xsl:when test="local-name($node)='book'">1</xsl:when>
|
---|
1070 | <xsl:when test="local-name($node)='set'">1</xsl:when>
|
---|
1071 | <xsl:when test="local-name($node)='setindex'">1</xsl:when>
|
---|
1072 | <xsl:when test="local-name($node)='legalnotice'
|
---|
1073 | and $generate.legalnotice.link != 0">1</xsl:when>
|
---|
1074 | <xsl:otherwise>0</xsl:otherwise>
|
---|
1075 | </xsl:choose>
|
---|
1076 | </xsl:template>
|
---|
1077 |
|
---|
1078 | <!-- ==================================================================== -->
|
---|
1079 | <xsl:template name="href.target.uri">
|
---|
1080 | <xsl:param name="object" select="."/>
|
---|
1081 | <xsl:variable name="ischunk">
|
---|
1082 | <xsl:call-template name="chunk">
|
---|
1083 | <xsl:with-param name="node" select="$object"/>
|
---|
1084 | </xsl:call-template>
|
---|
1085 | </xsl:variable>
|
---|
1086 |
|
---|
1087 | <xsl:apply-templates mode="chunk-filename" select="$object"/>
|
---|
1088 |
|
---|
1089 | <xsl:if test="$ischunk='0'">
|
---|
1090 | <xsl:text>#</xsl:text>
|
---|
1091 | <xsl:call-template name="object.id">
|
---|
1092 | <xsl:with-param name="object" select="$object"/>
|
---|
1093 | </xsl:call-template>
|
---|
1094 | </xsl:if>
|
---|
1095 | </xsl:template>
|
---|
1096 |
|
---|
1097 | <xsl:template name="href.target">
|
---|
1098 | <xsl:param name="context" select="."/>
|
---|
1099 | <xsl:param name="object" select="."/>
|
---|
1100 | <xsl:param name="toc-context" select="."/>
|
---|
1101 | <!-- * If $toc-context contains some node other than the current node, -->
|
---|
1102 | <!-- * it means we're processing a link in a TOC. In that case, to -->
|
---|
1103 | <!-- * ensure the link will work correctly, we need to take a look at -->
|
---|
1104 | <!-- * where the file containing the TOC will get written, and where -->
|
---|
1105 | <!-- * the file that's being linked to will get written. -->
|
---|
1106 | <xsl:variable name="toc-output-dir">
|
---|
1107 | <xsl:if test="not($toc-context = .)">
|
---|
1108 | <!-- * Get the $toc-context node and all its ancestors, look down -->
|
---|
1109 | <!-- * through them to find the last/closest node to the -->
|
---|
1110 | <!-- * toc-context node that has a "dbhtml dir" PI, and get the -->
|
---|
1111 | <!-- * directory name from that. That's the name of the directory -->
|
---|
1112 | <!-- * to which the current toc output file will get written. -->
|
---|
1113 | <xsl:call-template name="dbhtml-dir">
|
---|
1114 | <xsl:with-param name="context"
|
---|
1115 | select="$toc-context/ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
|
---|
1116 | </xsl:call-template>
|
---|
1117 | </xsl:if>
|
---|
1118 | </xsl:variable>
|
---|
1119 | <xsl:variable name="linked-file-output-dir">
|
---|
1120 | <xsl:if test="not($toc-context = .)">
|
---|
1121 | <!-- * Get the current node and all its ancestors, look down -->
|
---|
1122 | <!-- * through them to find the last/closest node to the current -->
|
---|
1123 | <!-- * node that has a "dbhtml dir" PI, and get the directory name -->
|
---|
1124 | <!-- * from that. That's the name of the directory to which the -->
|
---|
1125 | <!-- * file that's being linked to will get written. -->
|
---|
1126 | <xsl:call-template name="dbhtml-dir">
|
---|
1127 | <xsl:with-param name="context"
|
---|
1128 | select="ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
|
---|
1129 | </xsl:call-template>
|
---|
1130 | </xsl:if>
|
---|
1131 | </xsl:variable>
|
---|
1132 | <xsl:variable name="href.to.uri">
|
---|
1133 | <xsl:call-template name="href.target.uri">
|
---|
1134 | <xsl:with-param name="object" select="$object"/>
|
---|
1135 | </xsl:call-template>
|
---|
1136 | </xsl:variable>
|
---|
1137 | <xsl:variable name="href.from.uri">
|
---|
1138 | <xsl:choose>
|
---|
1139 | <xsl:when test="not($toc-context = .)">
|
---|
1140 | <xsl:call-template name="href.target.uri">
|
---|
1141 | <xsl:with-param name="object" select="$toc-context"/>
|
---|
1142 | </xsl:call-template>
|
---|
1143 | </xsl:when>
|
---|
1144 | <xsl:otherwise>
|
---|
1145 | <xsl:call-template name="href.target.uri">
|
---|
1146 | <xsl:with-param name="object" select="$context"/>
|
---|
1147 | </xsl:call-template>
|
---|
1148 | </xsl:otherwise>
|
---|
1149 | </xsl:choose>
|
---|
1150 | </xsl:variable>
|
---|
1151 | <!-- * <xsl:message>toc-context: <xsl:value-of select="local-name($toc-context)"/></xsl:message> -->
|
---|
1152 | <!-- * <xsl:message>node: <xsl:value-of select="local-name(.)"/></xsl:message> -->
|
---|
1153 | <!-- * <xsl:message>context: <xsl:value-of select="local-name($context)"/></xsl:message> -->
|
---|
1154 | <!-- * <xsl:message>object: <xsl:value-of select="local-name($object)"/></xsl:message> -->
|
---|
1155 | <!-- * <xsl:message>toc-output-dir: <xsl:value-of select="$toc-output-dir"/></xsl:message> -->
|
---|
1156 | <!-- * <xsl:message>linked-file-output-dir: <xsl:value-of select="$linked-file-output-dir"/></xsl:message> -->
|
---|
1157 | <!-- * <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message> -->
|
---|
1158 | <!-- * <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message> -->
|
---|
1159 | <xsl:variable name="href.to">
|
---|
1160 | <xsl:choose>
|
---|
1161 | <!-- * 2007-07-19, MikeSmith: Added the following conditional to -->
|
---|
1162 | <!-- * deal with a problem case for links in TOCs. It checks to see -->
|
---|
1163 | <!-- * if the output dir that a TOC will get written to is -->
|
---|
1164 | <!-- * different from the output dir of the file being linked to. -->
|
---|
1165 | <!-- * If it is different, we do not call trim.common.uri.paths. -->
|
---|
1166 | <!-- * -->
|
---|
1167 | <!-- * Reason why I added that conditional is: I ran into a bug for -->
|
---|
1168 | <!-- * this case: -->
|
---|
1169 | <!-- * -->
|
---|
1170 | <!-- * 1. we are chunking into separate dirs -->
|
---|
1171 | <!-- * -->
|
---|
1172 | <!-- * 2. output for the TOC is written to current dir, but the file -->
|
---|
1173 | <!-- * being linked to is written to some subdir "foo". -->
|
---|
1174 | <!-- * -->
|
---|
1175 | <!-- * For that case, links to that file in that TOC did not show -->
|
---|
1176 | <!-- * the correct path - they omitted the "foo". -->
|
---|
1177 | <!-- * -->
|
---|
1178 | <!-- * The cause of that problem was that the trim.common.uri.paths -->
|
---|
1179 | <!-- * template[1] was being called under all conditions. But it's -->
|
---|
1180 | <!-- * apparent that we don't want to call trim.common.uri.paths in -->
|
---|
1181 | <!-- * the case where a linked file is being written to a different -->
|
---|
1182 | <!-- * directory than the TOC that contains the link, because doing -->
|
---|
1183 | <!-- * so will cause a necessary (not redundant) directory-name -->
|
---|
1184 | <!-- * part of the link to get inadvertently trimmed, resulting in -->
|
---|
1185 | <!-- * a broken link to that file. Thus, added the conditional. -->
|
---|
1186 | <!-- * -->
|
---|
1187 | <!-- * [1] The purpose of the trim.common.uri.paths template is to -->
|
---|
1188 | <!-- * prevent cases where, if we didn't call it, we end up with -->
|
---|
1189 | <!-- * unnecessary, redundant directory names getting output; for -->
|
---|
1190 | <!-- * example, "foo/foo/refname.html". -->
|
---|
1191 | <xsl:when test="not($toc-output-dir = $linked-file-output-dir)">
|
---|
1192 | <xsl:value-of select="$href.to.uri"/>
|
---|
1193 | </xsl:when>
|
---|
1194 | <xsl:otherwise>
|
---|
1195 | <xsl:call-template name="trim.common.uri.paths">
|
---|
1196 | <xsl:with-param name="uriA" select="$href.to.uri"/>
|
---|
1197 | <xsl:with-param name="uriB" select="$href.from.uri"/>
|
---|
1198 | <xsl:with-param name="return" select="'A'"/>
|
---|
1199 | </xsl:call-template>
|
---|
1200 | </xsl:otherwise>
|
---|
1201 | </xsl:choose>
|
---|
1202 | </xsl:variable>
|
---|
1203 | <xsl:variable name="href.from">
|
---|
1204 | <xsl:call-template name="trim.common.uri.paths">
|
---|
1205 | <xsl:with-param name="uriA" select="$href.to.uri"/>
|
---|
1206 | <xsl:with-param name="uriB" select="$href.from.uri"/>
|
---|
1207 | <xsl:with-param name="return" select="'B'"/>
|
---|
1208 | </xsl:call-template>
|
---|
1209 | </xsl:variable>
|
---|
1210 | <xsl:variable name="depth">
|
---|
1211 | <xsl:call-template name="count.uri.path.depth">
|
---|
1212 | <xsl:with-param name="filename" select="$href.from"/>
|
---|
1213 | </xsl:call-template>
|
---|
1214 | </xsl:variable>
|
---|
1215 | <xsl:variable name="href">
|
---|
1216 | <xsl:call-template name="copy-string">
|
---|
1217 | <xsl:with-param name="string" select="'../'"/>
|
---|
1218 | <xsl:with-param name="count" select="$depth"/>
|
---|
1219 | </xsl:call-template>
|
---|
1220 | <xsl:value-of select="$href.to"/>
|
---|
1221 | </xsl:variable>
|
---|
1222 | <!--
|
---|
1223 | <xsl:message>
|
---|
1224 | <xsl:text>In </xsl:text>
|
---|
1225 | <xsl:value-of select="name(.)"/>
|
---|
1226 | <xsl:text> (</xsl:text>
|
---|
1227 | <xsl:value-of select="$href.from"/>
|
---|
1228 | <xsl:text>,</xsl:text>
|
---|
1229 | <xsl:value-of select="$depth"/>
|
---|
1230 | <xsl:text>) </xsl:text>
|
---|
1231 | <xsl:value-of select="name($object)"/>
|
---|
1232 | <xsl:text> href=</xsl:text>
|
---|
1233 | <xsl:value-of select="$href"/>
|
---|
1234 | </xsl:message>
|
---|
1235 | -->
|
---|
1236 | <xsl:value-of select="$href"/>
|
---|
1237 | </xsl:template>
|
---|
1238 |
|
---|
1239 | <!-- Returns the complete olink href value if found -->
|
---|
1240 | <!-- Must take into account any dbhtml dir of the chunk containing the olink -->
|
---|
1241 | <xsl:template name="make.olink.href">
|
---|
1242 | <xsl:param name="olink.key" select="''"/>
|
---|
1243 | <xsl:param name="target.database"/>
|
---|
1244 |
|
---|
1245 | <xsl:if test="$olink.key != ''">
|
---|
1246 | <xsl:variable name="target.href" >
|
---|
1247 | <xsl:for-each select="$target.database" >
|
---|
1248 | <xsl:value-of select="key('targetptr-key', $olink.key)[1]/@href" />
|
---|
1249 | </xsl:for-each>
|
---|
1250 | </xsl:variable>
|
---|
1251 |
|
---|
1252 | <!-- an olink starting point may be in a subdirectory, so need
|
---|
1253 | the "from" reference point to compute a relative path -->
|
---|
1254 |
|
---|
1255 | <xsl:variable name="from.href">
|
---|
1256 | <xsl:call-template name="olink.from.uri">
|
---|
1257 | <xsl:with-param name="target.database" select="$target.database"/>
|
---|
1258 | <xsl:with-param name="object" select="."/>
|
---|
1259 | <xsl:with-param name="object.targetdoc" select="$current.docid"/>
|
---|
1260 | </xsl:call-template>
|
---|
1261 | </xsl:variable>
|
---|
1262 |
|
---|
1263 | <!-- If the from.href has directory path, then must "../" upward
|
---|
1264 | to document level -->
|
---|
1265 | <xsl:variable name="upward.from.path">
|
---|
1266 | <xsl:call-template name="upward.path">
|
---|
1267 | <xsl:with-param name="path" select="$from.href"/>
|
---|
1268 | </xsl:call-template>
|
---|
1269 | </xsl:variable>
|
---|
1270 |
|
---|
1271 | <xsl:variable name="targetdoc">
|
---|
1272 | <xsl:value-of select="substring-before($olink.key, '/')"/>
|
---|
1273 | </xsl:variable>
|
---|
1274 |
|
---|
1275 | <!-- Does the target database use a sitemap? -->
|
---|
1276 | <xsl:variable name="use.sitemap">
|
---|
1277 | <xsl:choose>
|
---|
1278 | <xsl:when test="$target.database//sitemap">1</xsl:when>
|
---|
1279 | <xsl:otherwise>0</xsl:otherwise>
|
---|
1280 | </xsl:choose>
|
---|
1281 | </xsl:variable>
|
---|
1282 |
|
---|
1283 |
|
---|
1284 | <!-- Get the baseuri for this targetptr -->
|
---|
1285 | <xsl:variable name="baseuri" >
|
---|
1286 | <xsl:choose>
|
---|
1287 | <!-- Does the database use a sitemap? -->
|
---|
1288 | <xsl:when test="$use.sitemap != 0" >
|
---|
1289 | <xsl:choose>
|
---|
1290 | <!-- Was current.docid parameter set? -->
|
---|
1291 | <xsl:when test="$current.docid != ''">
|
---|
1292 | <!-- Was it found in the database? -->
|
---|
1293 | <xsl:variable name="currentdoc.key" >
|
---|
1294 | <xsl:for-each select="$target.database" >
|
---|
1295 | <xsl:value-of select="key('targetdoc-key',
|
---|
1296 | $current.docid)[1]/@targetdoc" />
|
---|
1297 | </xsl:for-each>
|
---|
1298 | </xsl:variable>
|
---|
1299 | <xsl:choose>
|
---|
1300 | <xsl:when test="$currentdoc.key != ''">
|
---|
1301 | <xsl:for-each select="$target.database" >
|
---|
1302 | <xsl:call-template name="targetpath" >
|
---|
1303 | <xsl:with-param name="dirnode"
|
---|
1304 | select="key('targetdoc-key', $current.docid)[1]/parent::dir"/>
|
---|
1305 | <xsl:with-param name="targetdoc" select="$targetdoc"/>
|
---|
1306 | </xsl:call-template>
|
---|
1307 | </xsl:for-each >
|
---|
1308 | </xsl:when>
|
---|
1309 | <xsl:otherwise>
|
---|
1310 | <xsl:message>
|
---|
1311 | <xsl:text>Olink error: cannot compute relative </xsl:text>
|
---|
1312 | <xsl:text>sitemap path because $current.docid '</xsl:text>
|
---|
1313 | <xsl:value-of select="$current.docid"/>
|
---|
1314 | <xsl:text>' not found in target database.</xsl:text>
|
---|
1315 | </xsl:message>
|
---|
1316 | </xsl:otherwise>
|
---|
1317 | </xsl:choose>
|
---|
1318 | </xsl:when>
|
---|
1319 | <xsl:otherwise>
|
---|
1320 | <xsl:message>
|
---|
1321 | <xsl:text>Olink warning: cannot compute relative </xsl:text>
|
---|
1322 | <xsl:text>sitemap path without $current.docid parameter</xsl:text>
|
---|
1323 | </xsl:message>
|
---|
1324 | </xsl:otherwise>
|
---|
1325 | </xsl:choose>
|
---|
1326 | <!-- In either case, add baseuri from its document entry-->
|
---|
1327 | <xsl:variable name="docbaseuri">
|
---|
1328 | <xsl:for-each select="$target.database" >
|
---|
1329 | <xsl:value-of select="key('targetdoc-key', $targetdoc)[1]/@baseuri" />
|
---|
1330 | </xsl:for-each>
|
---|
1331 | </xsl:variable>
|
---|
1332 | <xsl:if test="$docbaseuri != ''" >
|
---|
1333 | <xsl:value-of select="$docbaseuri"/>
|
---|
1334 | </xsl:if>
|
---|
1335 | </xsl:when>
|
---|
1336 | <!-- No database sitemap in use -->
|
---|
1337 | <xsl:otherwise>
|
---|
1338 | <!-- Just use any baseuri from its document entry -->
|
---|
1339 | <xsl:variable name="docbaseuri">
|
---|
1340 | <xsl:for-each select="$target.database" >
|
---|
1341 | <xsl:value-of select="key('targetdoc-key', $targetdoc)[1]/@baseuri" />
|
---|
1342 | </xsl:for-each>
|
---|
1343 | </xsl:variable>
|
---|
1344 | <xsl:if test="$docbaseuri != ''" >
|
---|
1345 | <xsl:value-of select="$docbaseuri"/>
|
---|
1346 | </xsl:if>
|
---|
1347 | </xsl:otherwise>
|
---|
1348 | </xsl:choose>
|
---|
1349 | </xsl:variable>
|
---|
1350 |
|
---|
1351 | <!-- Is this olink to be active? -->
|
---|
1352 | <xsl:variable name="active.olink">
|
---|
1353 | <xsl:choose>
|
---|
1354 | <xsl:when test="$activate.external.olinks = 0">
|
---|
1355 | <xsl:choose>
|
---|
1356 | <xsl:when test="$current.docid = ''">1</xsl:when>
|
---|
1357 | <xsl:when test="$targetdoc = ''">1</xsl:when>
|
---|
1358 | <xsl:when test="$targetdoc = $current.docid">1</xsl:when>
|
---|
1359 | <xsl:otherwise>0</xsl:otherwise>
|
---|
1360 | </xsl:choose>
|
---|
1361 | </xsl:when>
|
---|
1362 | <xsl:otherwise>1</xsl:otherwise>
|
---|
1363 | </xsl:choose>
|
---|
1364 | </xsl:variable>
|
---|
1365 |
|
---|
1366 | <xsl:if test="$active.olink != 0">
|
---|
1367 | <!-- Form the href information -->
|
---|
1368 | <xsl:if test="not(contains($baseuri, ':'))">
|
---|
1369 | <!-- if not an absolute uri, add upward path from olink chunk -->
|
---|
1370 | <xsl:value-of select="$upward.from.path"/>
|
---|
1371 | </xsl:if>
|
---|
1372 |
|
---|
1373 | <xsl:if test="$baseuri != ''">
|
---|
1374 | <xsl:value-of select="$baseuri"/>
|
---|
1375 | <xsl:if test="substring($target.href,1,1) != '#'">
|
---|
1376 | <!--xsl:text>/</xsl:text-->
|
---|
1377 | </xsl:if>
|
---|
1378 | </xsl:if>
|
---|
1379 | <!-- optionally turn off frag for PDF references -->
|
---|
1380 | <xsl:if test="not($insert.olink.pdf.frag = 0 and
|
---|
1381 | translate(substring($baseuri, string-length($baseuri) - 3),
|
---|
1382 | 'PDF', 'pdf') = '.pdf'
|
---|
1383 | and starts-with($target.href, '#') )">
|
---|
1384 | <xsl:value-of select="$target.href"/>
|
---|
1385 | </xsl:if>
|
---|
1386 | </xsl:if>
|
---|
1387 | </xsl:if>
|
---|
1388 | </xsl:template>
|
---|
1389 |
|
---|
1390 | <!-- Computes "../" to reach top -->
|
---|
1391 | <xsl:template name="upward.path">
|
---|
1392 | <xsl:param name="path" select="''"/>
|
---|
1393 | <xsl:choose>
|
---|
1394 | <!-- Don't bother with absolute uris -->
|
---|
1395 | <xsl:when test="contains($path, ':')"/>
|
---|
1396 | <xsl:when test="starts-with($path, '/')"/>
|
---|
1397 | <xsl:when test="contains($path, '/')">
|
---|
1398 | <xsl:text>../</xsl:text>
|
---|
1399 | <xsl:call-template name="upward.path">
|
---|
1400 | <xsl:with-param name="path" select="substring-after($path, '/')"/>
|
---|
1401 | </xsl:call-template>
|
---|
1402 | </xsl:when>
|
---|
1403 | </xsl:choose>
|
---|
1404 |
|
---|
1405 | </xsl:template>
|
---|
1406 |
|
---|
1407 | <!-- ==================================================================== -->
|
---|
1408 |
|
---|
1409 | <xsl:template name="html.head">
|
---|
1410 | <xsl:param name="prev" select="/foo"/>
|
---|
1411 | <xsl:param name="next" select="/foo"/>
|
---|
1412 | <xsl:variable name="this" select="."/>
|
---|
1413 | <xsl:variable name="home" select="/*[1]"/>
|
---|
1414 | <xsl:variable name="up" select="parent::*"/>
|
---|
1415 |
|
---|
1416 | <head>
|
---|
1417 | <xsl:call-template name="system.head.content"/>
|
---|
1418 | <xsl:call-template name="head.content"/>
|
---|
1419 |
|
---|
1420 | <!-- home link not valid in HTML5 -->
|
---|
1421 | <xsl:if test="$home and $div.element != 'section'">
|
---|
1422 | <link rel="home">
|
---|
1423 | <xsl:attribute name="href">
|
---|
1424 | <xsl:call-template name="href.target">
|
---|
1425 | <xsl:with-param name="object" select="$home"/>
|
---|
1426 | </xsl:call-template>
|
---|
1427 | </xsl:attribute>
|
---|
1428 | <xsl:attribute name="title">
|
---|
1429 | <xsl:apply-templates select="$home"
|
---|
1430 | mode="object.title.markup.textonly"/>
|
---|
1431 | </xsl:attribute>
|
---|
1432 | </link>
|
---|
1433 | </xsl:if>
|
---|
1434 |
|
---|
1435 | <!-- up link not valid in HTML5 -->
|
---|
1436 | <xsl:if test="$up and $div.element != 'section'">
|
---|
1437 | <link rel="up">
|
---|
1438 | <xsl:attribute name="href">
|
---|
1439 | <xsl:call-template name="href.target">
|
---|
1440 | <xsl:with-param name="object" select="$up"/>
|
---|
1441 | </xsl:call-template>
|
---|
1442 | </xsl:attribute>
|
---|
1443 | <xsl:attribute name="title">
|
---|
1444 | <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
|
---|
1445 | </xsl:attribute>
|
---|
1446 | </link>
|
---|
1447 | </xsl:if>
|
---|
1448 |
|
---|
1449 | <xsl:if test="$prev">
|
---|
1450 | <link rel="prev">
|
---|
1451 | <xsl:attribute name="href">
|
---|
1452 | <xsl:call-template name="href.target">
|
---|
1453 | <xsl:with-param name="object" select="$prev"/>
|
---|
1454 | </xsl:call-template>
|
---|
1455 | </xsl:attribute>
|
---|
1456 | <xsl:attribute name="title">
|
---|
1457 | <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
|
---|
1458 | </xsl:attribute>
|
---|
1459 | </link>
|
---|
1460 | </xsl:if>
|
---|
1461 |
|
---|
1462 | <xsl:if test="$next">
|
---|
1463 | <link rel="next">
|
---|
1464 | <xsl:attribute name="href">
|
---|
1465 | <xsl:call-template name="href.target">
|
---|
1466 | <xsl:with-param name="object" select="$next"/>
|
---|
1467 | </xsl:call-template>
|
---|
1468 | </xsl:attribute>
|
---|
1469 | <xsl:attribute name="title">
|
---|
1470 | <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
|
---|
1471 | </xsl:attribute>
|
---|
1472 | </link>
|
---|
1473 | </xsl:if>
|
---|
1474 |
|
---|
1475 | <xsl:if test="$html.extra.head.links != 0">
|
---|
1476 | <xsl:for-each select="//part
|
---|
1477 | |//reference
|
---|
1478 | |//preface
|
---|
1479 | |//chapter
|
---|
1480 | |//article
|
---|
1481 | |//refentry
|
---|
1482 | |//appendix[not(parent::article)]|appendix
|
---|
1483 | |//glossary[not(parent::article)]|glossary
|
---|
1484 | |//index[not(parent::article)]|index">
|
---|
1485 | <link rel="{local-name(.)}">
|
---|
1486 | <xsl:attribute name="href">
|
---|
1487 | <xsl:call-template name="href.target">
|
---|
1488 | <xsl:with-param name="context" select="$this"/>
|
---|
1489 | <xsl:with-param name="object" select="."/>
|
---|
1490 | </xsl:call-template>
|
---|
1491 | </xsl:attribute>
|
---|
1492 | <xsl:attribute name="title">
|
---|
1493 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
|
---|
1494 | </xsl:attribute>
|
---|
1495 | </link>
|
---|
1496 | </xsl:for-each>
|
---|
1497 |
|
---|
1498 | <xsl:for-each select="section|sect1|refsection|refsect1">
|
---|
1499 | <link>
|
---|
1500 | <xsl:attribute name="rel">
|
---|
1501 | <xsl:choose>
|
---|
1502 | <xsl:when test="local-name($this) = 'section'
|
---|
1503 | or local-name($this) = 'refsection'">
|
---|
1504 | <xsl:value-of select="'subsection'"/>
|
---|
1505 | </xsl:when>
|
---|
1506 | <xsl:otherwise>
|
---|
1507 | <xsl:value-of select="'section'"/>
|
---|
1508 | </xsl:otherwise>
|
---|
1509 | </xsl:choose>
|
---|
1510 | </xsl:attribute>
|
---|
1511 | <xsl:attribute name="href">
|
---|
1512 | <xsl:call-template name="href.target">
|
---|
1513 | <xsl:with-param name="context" select="$this"/>
|
---|
1514 | <xsl:with-param name="object" select="."/>
|
---|
1515 | </xsl:call-template>
|
---|
1516 | </xsl:attribute>
|
---|
1517 | <xsl:attribute name="title">
|
---|
1518 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
|
---|
1519 | </xsl:attribute>
|
---|
1520 | </link>
|
---|
1521 | </xsl:for-each>
|
---|
1522 |
|
---|
1523 | <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
|
---|
1524 | <link rel="subsection">
|
---|
1525 | <xsl:attribute name="href">
|
---|
1526 | <xsl:call-template name="href.target">
|
---|
1527 | <xsl:with-param name="context" select="$this"/>
|
---|
1528 | <xsl:with-param name="object" select="."/>
|
---|
1529 | </xsl:call-template>
|
---|
1530 | </xsl:attribute>
|
---|
1531 | <xsl:attribute name="title">
|
---|
1532 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
|
---|
1533 | </xsl:attribute>
|
---|
1534 | </link>
|
---|
1535 | </xsl:for-each>
|
---|
1536 | </xsl:if>
|
---|
1537 |
|
---|
1538 | <!-- * if we have a legalnotice and user wants it output as a -->
|
---|
1539 | <!-- * separate page and $html.head.legalnotice.link.types is -->
|
---|
1540 | <!-- * non-empty, we generate a link or links for each value in -->
|
---|
1541 | <!-- * $html.head.legalnotice.link.types -->
|
---|
1542 | <xsl:if test="//legalnotice
|
---|
1543 | and not($generate.legalnotice.link = 0)
|
---|
1544 | and not($html.head.legalnotice.link.types = '')">
|
---|
1545 | <xsl:call-template name="make.legalnotice.head.links"/>
|
---|
1546 | </xsl:if>
|
---|
1547 |
|
---|
1548 | <xsl:call-template name="user.head.content"/>
|
---|
1549 | </head>
|
---|
1550 | </xsl:template>
|
---|
1551 |
|
---|
1552 | <!-- ==================================================================== -->
|
---|
1553 |
|
---|
1554 | <xsl:template name="header.navigation">
|
---|
1555 | <xsl:param name="prev" select="/foo"/>
|
---|
1556 | <xsl:param name="next" select="/foo"/>
|
---|
1557 | <xsl:param name="nav.context"/>
|
---|
1558 |
|
---|
1559 | <xsl:variable name="home" select="/*[1]"/>
|
---|
1560 | <xsl:variable name="up" select="parent::*"/>
|
---|
1561 |
|
---|
1562 | <xsl:variable name="row1" select="$navig.showtitles != 0"/>
|
---|
1563 | <xsl:variable name="row2" select="count($prev) > 0
|
---|
1564 | or (count($up) > 0
|
---|
1565 | and generate-id($up) != generate-id($home)
|
---|
1566 | and $navig.showtitles != 0)
|
---|
1567 | or count($next) > 0"/>
|
---|
1568 |
|
---|
1569 | <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
|
---|
1570 | <div class="navheader">
|
---|
1571 | <xsl:if test="$row1 or $row2">
|
---|
1572 | <table width="100%" summary="Navigation header">
|
---|
1573 | <xsl:if test="$row1">
|
---|
1574 | <tr>
|
---|
1575 | <th colspan="3" align="center">
|
---|
1576 | <xsl:apply-templates select="." mode="object.title.markup"/>
|
---|
1577 | </th>
|
---|
1578 | </tr>
|
---|
1579 | </xsl:if>
|
---|
1580 |
|
---|
1581 | <xsl:if test="$row2">
|
---|
1582 | <tr>
|
---|
1583 | <td width="20%" align="{$direction.align.start}">
|
---|
1584 | <xsl:if test="count($prev)>0">
|
---|
1585 | <a accesskey="p">
|
---|
1586 | <xsl:attribute name="href">
|
---|
1587 | <xsl:call-template name="href.target">
|
---|
1588 | <xsl:with-param name="object" select="$prev"/>
|
---|
1589 | </xsl:call-template>
|
---|
1590 | </xsl:attribute>
|
---|
1591 | <xsl:call-template name="navig.content">
|
---|
1592 | <xsl:with-param name="direction" select="'prev'"/>
|
---|
1593 | </xsl:call-template>
|
---|
1594 | </a>
|
---|
1595 | </xsl:if>
|
---|
1596 | <xsl:text> </xsl:text>
|
---|
1597 | </td>
|
---|
1598 | <th width="60%" align="center">
|
---|
1599 | <xsl:choose>
|
---|
1600 | <xsl:when test="count($up) > 0
|
---|
1601 | and generate-id($up) != generate-id($home)
|
---|
1602 | and $navig.showtitles != 0">
|
---|
1603 | <xsl:apply-templates select="$up" mode="object.title.markup"/>
|
---|
1604 | </xsl:when>
|
---|
1605 | <xsl:otherwise> </xsl:otherwise>
|
---|
1606 | </xsl:choose>
|
---|
1607 | </th>
|
---|
1608 | <td width="20%" align="{$direction.align.end}">
|
---|
1609 | <xsl:text> </xsl:text>
|
---|
1610 | <xsl:if test="count($next)>0">
|
---|
1611 | <a accesskey="n">
|
---|
1612 | <xsl:attribute name="href">
|
---|
1613 | <xsl:call-template name="href.target">
|
---|
1614 | <xsl:with-param name="object" select="$next"/>
|
---|
1615 | </xsl:call-template>
|
---|
1616 | </xsl:attribute>
|
---|
1617 | <xsl:call-template name="navig.content">
|
---|
1618 | <xsl:with-param name="direction" select="'next'"/>
|
---|
1619 | </xsl:call-template>
|
---|
1620 | </a>
|
---|
1621 | </xsl:if>
|
---|
1622 | </td>
|
---|
1623 | </tr>
|
---|
1624 | </xsl:if>
|
---|
1625 | </table>
|
---|
1626 | </xsl:if>
|
---|
1627 | <xsl:if test="$header.rule != 0">
|
---|
1628 | <hr/>
|
---|
1629 | </xsl:if>
|
---|
1630 | </div>
|
---|
1631 | </xsl:if>
|
---|
1632 | </xsl:template>
|
---|
1633 |
|
---|
1634 | <!-- ==================================================================== -->
|
---|
1635 |
|
---|
1636 | <xsl:template name="footer.navigation">
|
---|
1637 | <xsl:param name="prev" select="/foo"/>
|
---|
1638 | <xsl:param name="next" select="/foo"/>
|
---|
1639 | <xsl:param name="nav.context"/>
|
---|
1640 |
|
---|
1641 | <xsl:variable name="home" select="/*[1]"/>
|
---|
1642 | <xsl:variable name="up" select="parent::*"/>
|
---|
1643 |
|
---|
1644 | <xsl:variable name="row1" select="count($prev) > 0
|
---|
1645 | or count($up) > 0
|
---|
1646 | or count($next) > 0"/>
|
---|
1647 |
|
---|
1648 | <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
|
---|
1649 | or (generate-id($home) != generate-id(.)
|
---|
1650 | or $nav.context = 'toc')
|
---|
1651 | or ($chunk.tocs.and.lots != 0
|
---|
1652 | and $nav.context != 'toc')
|
---|
1653 | or ($next and $navig.showtitles != 0)"/>
|
---|
1654 |
|
---|
1655 | <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
|
---|
1656 | <div class="navfooter">
|
---|
1657 | <xsl:if test="$footer.rule != 0">
|
---|
1658 | <hr/>
|
---|
1659 | </xsl:if>
|
---|
1660 |
|
---|
1661 | <xsl:if test="$row1 or $row2">
|
---|
1662 | <table width="100%" summary="Navigation footer">
|
---|
1663 | <xsl:if test="$row1">
|
---|
1664 | <tr>
|
---|
1665 | <td width="40%" align="{$direction.align.start}">
|
---|
1666 | <xsl:if test="count($prev)>0">
|
---|
1667 | <a accesskey="p">
|
---|
1668 | <xsl:attribute name="href">
|
---|
1669 | <xsl:call-template name="href.target">
|
---|
1670 | <xsl:with-param name="object" select="$prev"/>
|
---|
1671 | </xsl:call-template>
|
---|
1672 | </xsl:attribute>
|
---|
1673 | <xsl:call-template name="navig.content">
|
---|
1674 | <xsl:with-param name="direction" select="'prev'"/>
|
---|
1675 | </xsl:call-template>
|
---|
1676 | </a>
|
---|
1677 | </xsl:if>
|
---|
1678 | <xsl:text> </xsl:text>
|
---|
1679 | </td>
|
---|
1680 | <td width="20%" align="center">
|
---|
1681 | <xsl:choose>
|
---|
1682 | <xsl:when test="count($up)>0
|
---|
1683 | and generate-id($up) != generate-id($home)">
|
---|
1684 | <a accesskey="u">
|
---|
1685 | <xsl:attribute name="href">
|
---|
1686 | <xsl:call-template name="href.target">
|
---|
1687 | <xsl:with-param name="object" select="$up"/>
|
---|
1688 | </xsl:call-template>
|
---|
1689 | </xsl:attribute>
|
---|
1690 | <xsl:call-template name="navig.content">
|
---|
1691 | <xsl:with-param name="direction" select="'up'"/>
|
---|
1692 | </xsl:call-template>
|
---|
1693 | </a>
|
---|
1694 | </xsl:when>
|
---|
1695 | <xsl:otherwise> </xsl:otherwise>
|
---|
1696 | </xsl:choose>
|
---|
1697 | </td>
|
---|
1698 | <td width="40%" align="{$direction.align.end}">
|
---|
1699 | <xsl:text> </xsl:text>
|
---|
1700 | <xsl:if test="count($next)>0">
|
---|
1701 | <a accesskey="n">
|
---|
1702 | <xsl:attribute name="href">
|
---|
1703 | <xsl:call-template name="href.target">
|
---|
1704 | <xsl:with-param name="object" select="$next"/>
|
---|
1705 | </xsl:call-template>
|
---|
1706 | </xsl:attribute>
|
---|
1707 | <xsl:call-template name="navig.content">
|
---|
1708 | <xsl:with-param name="direction" select="'next'"/>
|
---|
1709 | </xsl:call-template>
|
---|
1710 | </a>
|
---|
1711 | </xsl:if>
|
---|
1712 | </td>
|
---|
1713 | </tr>
|
---|
1714 | </xsl:if>
|
---|
1715 |
|
---|
1716 | <xsl:if test="$row2">
|
---|
1717 | <tr>
|
---|
1718 | <td width="40%" align="{$direction.align.start}" valign="top">
|
---|
1719 | <xsl:if test="$navig.showtitles != 0">
|
---|
1720 | <xsl:apply-templates select="$prev" mode="object.title.markup"/>
|
---|
1721 | </xsl:if>
|
---|
1722 | <xsl:text> </xsl:text>
|
---|
1723 | </td>
|
---|
1724 | <td width="20%" align="center">
|
---|
1725 | <xsl:choose>
|
---|
1726 | <xsl:when test="$home != . or $nav.context = 'toc'">
|
---|
1727 | <a accesskey="h">
|
---|
1728 | <xsl:attribute name="href">
|
---|
1729 | <xsl:call-template name="href.target">
|
---|
1730 | <xsl:with-param name="object" select="$home"/>
|
---|
1731 | </xsl:call-template>
|
---|
1732 | </xsl:attribute>
|
---|
1733 | <xsl:call-template name="navig.content">
|
---|
1734 | <xsl:with-param name="direction" select="'home'"/>
|
---|
1735 | </xsl:call-template>
|
---|
1736 | </a>
|
---|
1737 | <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
---|
1738 | <xsl:text> | </xsl:text>
|
---|
1739 | </xsl:if>
|
---|
1740 | </xsl:when>
|
---|
1741 | <xsl:otherwise> </xsl:otherwise>
|
---|
1742 | </xsl:choose>
|
---|
1743 |
|
---|
1744 | <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
---|
1745 | <a accesskey="t">
|
---|
1746 | <xsl:attribute name="href">
|
---|
1747 | <xsl:value-of select="$chunked.filename.prefix"/>
|
---|
1748 | <xsl:apply-templates select="/*[1]"
|
---|
1749 | mode="recursive-chunk-filename">
|
---|
1750 | <xsl:with-param name="recursive" select="true()"/>
|
---|
1751 | </xsl:apply-templates>
|
---|
1752 | <xsl:text>-toc</xsl:text>
|
---|
1753 | <xsl:value-of select="$html.ext"/>
|
---|
1754 | </xsl:attribute>
|
---|
1755 | <xsl:call-template name="gentext">
|
---|
1756 | <xsl:with-param name="key" select="'nav-toc'"/>
|
---|
1757 | </xsl:call-template>
|
---|
1758 | </a>
|
---|
1759 | </xsl:if>
|
---|
1760 | </td>
|
---|
1761 | <td width="40%" align="{$direction.align.end}" valign="top">
|
---|
1762 | <xsl:text> </xsl:text>
|
---|
1763 | <xsl:if test="$navig.showtitles != 0">
|
---|
1764 | <xsl:apply-templates select="$next" mode="object.title.markup"/>
|
---|
1765 | </xsl:if>
|
---|
1766 | </td>
|
---|
1767 | </tr>
|
---|
1768 | </xsl:if>
|
---|
1769 | </table>
|
---|
1770 | </xsl:if>
|
---|
1771 | </div>
|
---|
1772 | </xsl:if>
|
---|
1773 | </xsl:template>
|
---|
1774 |
|
---|
1775 | <!-- ==================================================================== -->
|
---|
1776 |
|
---|
1777 | <xsl:template name="navig.content">
|
---|
1778 | <xsl:param name="direction" select="next"/>
|
---|
1779 | <xsl:variable name="navtext">
|
---|
1780 | <xsl:choose>
|
---|
1781 | <xsl:when test="$direction = 'prev'">
|
---|
1782 | <xsl:call-template name="gentext.nav.prev"/>
|
---|
1783 | </xsl:when>
|
---|
1784 | <xsl:when test="$direction = 'next'">
|
---|
1785 | <xsl:call-template name="gentext.nav.next"/>
|
---|
1786 | </xsl:when>
|
---|
1787 | <xsl:when test="$direction = 'up'">
|
---|
1788 | <xsl:call-template name="gentext.nav.up"/>
|
---|
1789 | </xsl:when>
|
---|
1790 | <xsl:when test="$direction = 'home'">
|
---|
1791 | <xsl:call-template name="gentext.nav.home"/>
|
---|
1792 | </xsl:when>
|
---|
1793 | <xsl:otherwise>
|
---|
1794 | <xsl:text>xxx</xsl:text>
|
---|
1795 | </xsl:otherwise>
|
---|
1796 | </xsl:choose>
|
---|
1797 | </xsl:variable>
|
---|
1798 |
|
---|
1799 | <xsl:choose>
|
---|
1800 | <xsl:when test="$navig.graphics != 0">
|
---|
1801 | <img>
|
---|
1802 | <xsl:attribute name="src">
|
---|
1803 | <xsl:value-of select="$navig.graphics.path"/>
|
---|
1804 | <xsl:value-of select="$direction"/>
|
---|
1805 | <xsl:value-of select="$navig.graphics.extension"/>
|
---|
1806 | </xsl:attribute>
|
---|
1807 | <xsl:attribute name="alt">
|
---|
1808 | <xsl:value-of select="$navtext"/>
|
---|
1809 | </xsl:attribute>
|
---|
1810 | </img>
|
---|
1811 | </xsl:when>
|
---|
1812 | <xsl:otherwise>
|
---|
1813 | <xsl:value-of select="$navtext"/>
|
---|
1814 | </xsl:otherwise>
|
---|
1815 | </xsl:choose>
|
---|
1816 | </xsl:template>
|
---|
1817 |
|
---|
1818 | <!-- ==================================================================== -->
|
---|
1819 |
|
---|
1820 | <!-- * The following template assumes that the first legalnotice -->
|
---|
1821 | <!-- * instance found in a document applies to the contents of the -->
|
---|
1822 | <!-- * entire document. It generates an HTML link in each chunk, back -->
|
---|
1823 | <!-- * to the file containing the contents of the first legalnotice. -->
|
---|
1824 | <!-- * -->
|
---|
1825 | <!-- * Actually, it may generate multiple link instances in each chunk, -->
|
---|
1826 | <!-- * because it walks through the space-separated list of link -->
|
---|
1827 | <!-- * types specified in the $html.head.legalnotice.link.types param, -->
|
---|
1828 | <!-- * popping off link types and generating links for them until it -->
|
---|
1829 | <!-- * depletes the list. -->
|
---|
1830 |
|
---|
1831 | <xsl:template name="make.legalnotice.head.links">
|
---|
1832 | <!-- * the following ID is used as part of the legalnotice filename; -->
|
---|
1833 | <!-- * we need it in order to construct the filename for use in the -->
|
---|
1834 | <!-- * value of the href attribute on the link -->
|
---|
1835 |
|
---|
1836 | <xsl:param name="ln-node" select="(//legalnotice)[1]"/>
|
---|
1837 |
|
---|
1838 | <xsl:param name="linktype">
|
---|
1839 | <xsl:choose>
|
---|
1840 | <xsl:when test="contains($html.head.legalnotice.link.types, ' ')">
|
---|
1841 | <xsl:value-of
|
---|
1842 | select="normalize-space(
|
---|
1843 | substring-before($html.head.legalnotice.link.types, ' '))"/>
|
---|
1844 | </xsl:when>
|
---|
1845 | <xsl:otherwise>
|
---|
1846 | <xsl:value-of select="$html.head.legalnotice.link.types"/>
|
---|
1847 | </xsl:otherwise>
|
---|
1848 | </xsl:choose>
|
---|
1849 | </xsl:param>
|
---|
1850 | <xsl:param
|
---|
1851 | name="remaining.linktypes"
|
---|
1852 | select="concat(
|
---|
1853 | normalize-space(
|
---|
1854 | substring-after($html.head.legalnotice.link.types, ' ')),' ')"/>
|
---|
1855 | <xsl:if test="not($linktype = '')">
|
---|
1856 |
|
---|
1857 | <!-- Compute name of legalnotice file (see titlepage.xsl) -->
|
---|
1858 | <xsl:variable name="file">
|
---|
1859 | <xsl:call-template name="ln.or.rh.filename">
|
---|
1860 | <xsl:with-param name="node" select="$ln-node"/>
|
---|
1861 | </xsl:call-template>
|
---|
1862 | </xsl:variable>
|
---|
1863 |
|
---|
1864 | <link rel="{$linktype}">
|
---|
1865 | <xsl:attribute name="href">
|
---|
1866 | <xsl:value-of select="$file"/>
|
---|
1867 | </xsl:attribute>
|
---|
1868 | <xsl:attribute name="title">
|
---|
1869 | <xsl:apply-templates select="(//legalnotice)[1]"
|
---|
1870 | mode="object.title.markup.textonly"/>
|
---|
1871 | </xsl:attribute>
|
---|
1872 | </link>
|
---|
1873 | <xsl:call-template name="make.legalnotice.head.links">
|
---|
1874 | <!-- * pop the next value off the list of link types -->
|
---|
1875 | <xsl:with-param
|
---|
1876 | name="linktype"
|
---|
1877 | select="substring-before($remaining.linktypes, ' ')"/>
|
---|
1878 | <!-- * remove the link type from the list of remaining link types -->
|
---|
1879 | <xsl:with-param
|
---|
1880 | name="remaining.linktypes"
|
---|
1881 | select="substring-after($remaining.linktypes, ' ')"/>
|
---|
1882 | </xsl:call-template>
|
---|
1883 | </xsl:if>
|
---|
1884 | </xsl:template>
|
---|
1885 |
|
---|
1886 | <!-- ==================================================================== -->
|
---|
1887 | <xsl:template name="chunk-element-content">
|
---|
1888 | <xsl:param name="prev"/>
|
---|
1889 | <xsl:param name="next"/>
|
---|
1890 | <xsl:param name="nav.context"/>
|
---|
1891 | <xsl:param name="content">
|
---|
1892 | <xsl:apply-imports/>
|
---|
1893 | </xsl:param>
|
---|
1894 |
|
---|
1895 | <xsl:call-template name="user.preroot"/>
|
---|
1896 |
|
---|
1897 | <html>
|
---|
1898 | <xsl:call-template name="root.attributes"/>
|
---|
1899 | <xsl:call-template name="html.head">
|
---|
1900 | <xsl:with-param name="prev" select="$prev"/>
|
---|
1901 | <xsl:with-param name="next" select="$next"/>
|
---|
1902 | </xsl:call-template>
|
---|
1903 |
|
---|
1904 | <body>
|
---|
1905 | <xsl:call-template name="body.attributes"/>
|
---|
1906 |
|
---|
1907 | <xsl:call-template name="user.header.navigation">
|
---|
1908 | <xsl:with-param name="prev" select="$prev"/>
|
---|
1909 | <xsl:with-param name="next" select="$next"/>
|
---|
1910 | <xsl:with-param name="nav.context" select="$nav.context"/>
|
---|
1911 | </xsl:call-template>
|
---|
1912 |
|
---|
1913 | <xsl:call-template name="header.navigation">
|
---|
1914 | <xsl:with-param name="prev" select="$prev"/>
|
---|
1915 | <xsl:with-param name="next" select="$next"/>
|
---|
1916 | <xsl:with-param name="nav.context" select="$nav.context"/>
|
---|
1917 | </xsl:call-template>
|
---|
1918 |
|
---|
1919 | <xsl:call-template name="user.header.content"/>
|
---|
1920 |
|
---|
1921 | <xsl:copy-of select="$content"/>
|
---|
1922 |
|
---|
1923 | <xsl:call-template name="user.footer.content"/>
|
---|
1924 |
|
---|
1925 | <xsl:call-template name="footer.navigation">
|
---|
1926 | <xsl:with-param name="prev" select="$prev"/>
|
---|
1927 | <xsl:with-param name="next" select="$next"/>
|
---|
1928 | <xsl:with-param name="nav.context" select="$nav.context"/>
|
---|
1929 | </xsl:call-template>
|
---|
1930 |
|
---|
1931 | <xsl:call-template name="user.footer.navigation">
|
---|
1932 | <xsl:with-param name="prev" select="$prev"/>
|
---|
1933 | <xsl:with-param name="next" select="$next"/>
|
---|
1934 | <xsl:with-param name="nav.context" select="$nav.context"/>
|
---|
1935 | </xsl:call-template>
|
---|
1936 | </body>
|
---|
1937 | </html>
|
---|
1938 | <xsl:value-of select="$chunk.append"/>
|
---|
1939 | </xsl:template>
|
---|
1940 |
|
---|
1941 | <!-- ==================================================================== -->
|
---|
1942 | <xsl:template name="generate.manifest">
|
---|
1943 | <xsl:param name="node" select="/"/>
|
---|
1944 | <xsl:call-template name="write.text.chunk">
|
---|
1945 | <xsl:with-param name="filename">
|
---|
1946 | <xsl:if test="$manifest.in.base.dir != 0">
|
---|
1947 | <xsl:value-of select="$chunk.base.dir"/>
|
---|
1948 | </xsl:if>
|
---|
1949 | <xsl:value-of select="$manifest"/>
|
---|
1950 | </xsl:with-param>
|
---|
1951 | <xsl:with-param name="method" select="'text'"/>
|
---|
1952 | <xsl:with-param name="content">
|
---|
1953 | <xsl:apply-templates select="$node" mode="enumerate-files"/>
|
---|
1954 | </xsl:with-param>
|
---|
1955 | <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
|
---|
1956 | </xsl:call-template>
|
---|
1957 | </xsl:template>
|
---|
1958 |
|
---|
1959 | <!-- ==================================================================== -->
|
---|
1960 |
|
---|
1961 | <xsl:template name="dbhtml-dir">
|
---|
1962 | <xsl:param name="context" select="."/>
|
---|
1963 | <!-- directories are now inherited from previous levels -->
|
---|
1964 | <xsl:variable name="ppath">
|
---|
1965 | <xsl:if test="$context/parent::*">
|
---|
1966 | <xsl:call-template name="dbhtml-dir">
|
---|
1967 | <xsl:with-param name="context" select="$context/parent::*"/>
|
---|
1968 | </xsl:call-template>
|
---|
1969 | </xsl:if>
|
---|
1970 | </xsl:variable>
|
---|
1971 | <xsl:variable name="path">
|
---|
1972 | <xsl:call-template name="pi.dbhtml_dir">
|
---|
1973 | <xsl:with-param name="node" select="$context"/>
|
---|
1974 | </xsl:call-template>
|
---|
1975 | </xsl:variable>
|
---|
1976 | <xsl:choose>
|
---|
1977 | <xsl:when test="$path = ''">
|
---|
1978 | <xsl:if test="$ppath != ''">
|
---|
1979 | <xsl:value-of select="$ppath"/>
|
---|
1980 | </xsl:if>
|
---|
1981 | </xsl:when>
|
---|
1982 | <xsl:otherwise>
|
---|
1983 | <xsl:if test="$ppath != ''">
|
---|
1984 | <xsl:value-of select="$ppath"/>
|
---|
1985 | <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
|
---|
1986 | <xsl:text>/</xsl:text>
|
---|
1987 | </xsl:if>
|
---|
1988 | </xsl:if>
|
---|
1989 | <xsl:value-of select="$path"/>
|
---|
1990 | <xsl:text>/</xsl:text>
|
---|
1991 | </xsl:otherwise>
|
---|
1992 | </xsl:choose>
|
---|
1993 | </xsl:template>
|
---|
1994 |
|
---|
1995 | </xsl:stylesheet>
|
---|