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