source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/html/chunker.xsl@ 15c7d39

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 15c7d39 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 21.0 KB
Line 
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:saxon="http://icl.com/saxon"
3 xmlns:lxslt="http://xml.apache.org/xslt"
4 xmlns:redirect="http://xml.apache.org/xalan/redirect"
5 xmlns:exsl="http://exslt.org/common"
6 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
7 version="1.0"
8 exclude-result-prefixes="saxon lxslt redirect exsl doc"
9 extension-element-prefixes="saxon redirect lxslt exsl">
10
11<!-- ********************************************************************
12 $Id: chunker.xsl 9656 2012-10-29 18:09:53Z bobstayton $
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://docbook.sf.net/release/xsl/current/ for
17 copyright and other information.
18
19 ******************************************************************** -->
20
21<!-- ==================================================================== -->
22
23<!-- This stylesheet works with XSLT implementations that support -->
24<!-- exsl:document, saxon:output, or Xalan's redirect:write -->
25<!-- Note: Only Saxon 6.4.2 or later is supported. -->
26
27<xsl:param name="chunker.output.method" select="'html'"/>
28<xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/>
29<xsl:param name="chunker.output.indent" select="'no'"/>
30<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
31<xsl:param name="chunker.output.standalone" select="'no'"/>
32<xsl:param name="chunker.output.doctype-public" select="''"/>
33<xsl:param name="chunker.output.doctype-system" select="''"/>
34<xsl:param name="chunker.output.media-type" select="''"/>
35<xsl:param name="chunker.output.cdata-section-elements" select="''"/>
36
37<!-- Make sure base.dir has a trailing slash now -->
38<xsl:param name="chunk.base.dir">
39 <xsl:choose>
40 <xsl:when test="string-length($base.dir) = 0"></xsl:when>
41 <!-- make sure to add trailing slash if omitted by user -->
42 <xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'">
43 <xsl:value-of select="$base.dir"/>
44 </xsl:when>
45 <xsl:otherwise>
46 <xsl:value-of select="concat($base.dir, '/')"/>
47 </xsl:otherwise>
48 </xsl:choose>
49</xsl:param>
50
51<xsl:param name="saxon.character.representation" select="'entity;decimal'"/>
52
53<!-- ==================================================================== -->
54
55<xsl:template name="make-relative-filename">
56 <xsl:param name="base.dir" select="'./'"/>
57 <xsl:param name="base.name" select="''"/>
58
59 <xsl:choose>
60 <!-- put Saxon first to work around a bug in libxslt -->
61 <xsl:when test="element-available('saxon:output')">
62 <!-- Saxon doesn't make the chunks relative -->
63 <xsl:value-of select="concat($base.dir,$base.name)"/>
64 </xsl:when>
65 <xsl:when test="element-available('exsl:document')">
66 <!-- EXSL document does make the chunks relative, I think -->
67 <xsl:choose>
68 <xsl:when test="count(parent::*) = 0">
69 <xsl:value-of select="concat($base.dir,$base.name)"/>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="$base.name"/>
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:when>
76 <xsl:when test="element-available('redirect:write')">
77 <!-- Xalan doesn't make the chunks relative -->
78 <xsl:value-of select="concat($base.dir,$base.name)"/>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:message terminate="yes">
82 <xsl:text>Don't know how to chunk with </xsl:text>
83 <xsl:value-of select="system-property('xsl:vendor')"/>
84 </xsl:message>
85 </xsl:otherwise>
86 </xsl:choose>
87</xsl:template>
88
89<xsl:template name="write.chunk">
90 <xsl:param name="filename" select="''"/>
91 <xsl:param name="quiet" select="$chunk.quietly"/>
92 <xsl:param name="suppress-context-node-name" select="0"/>
93 <xsl:param name="message-prolog"/>
94 <xsl:param name="message-epilog"/>
95
96 <xsl:param name="method" select="$chunker.output.method"/>
97 <xsl:param name="encoding" select="$chunker.output.encoding"/>
98 <xsl:param name="indent" select="$chunker.output.indent"/>
99 <xsl:param name="omit-xml-declaration"
100 select="$chunker.output.omit-xml-declaration"/>
101 <xsl:param name="standalone" select="$chunker.output.standalone"/>
102 <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
103 <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
104 <xsl:param name="media-type" select="$chunker.output.media-type"/>
105 <xsl:param name="cdata-section-elements"
106 select="$chunker.output.cdata-section-elements"/>
107
108 <xsl:param name="content"/>
109
110 <xsl:if test="$quiet = 0">
111 <xsl:message>
112 <xsl:if test="not($message-prolog = '')">
113 <xsl:value-of select="$message-prolog"/>
114 </xsl:if>
115 <xsl:text>Writing </xsl:text>
116 <xsl:value-of select="$filename"/>
117 <xsl:if test="name(.) != '' and $suppress-context-node-name = 0">
118 <xsl:text> for </xsl:text>
119 <xsl:value-of select="name(.)"/>
120 <xsl:if test="@id or @xml:id">
121 <xsl:text>(</xsl:text>
122 <xsl:value-of select="(@id|@xml:id)[1]"/>
123 <xsl:text>)</xsl:text>
124 </xsl:if>
125 </xsl:if>
126 <xsl:if test="not($message-epilog = '')">
127 <xsl:value-of select="$message-epilog"/>
128 </xsl:if>
129 </xsl:message>
130 </xsl:if>
131
132 <xsl:choose>
133 <xsl:when test="element-available('exsl:document')">
134 <xsl:choose>
135 <!-- Handle the permutations ... -->
136 <xsl:when test="$media-type != ''">
137 <xsl:choose>
138 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
139 <exsl:document href="{$filename}"
140 method="{$method}"
141 encoding="{$encoding}"
142 indent="{$indent}"
143 omit-xml-declaration="{$omit-xml-declaration}"
144 cdata-section-elements="{$cdata-section-elements}"
145 media-type="{$media-type}"
146 doctype-public="{$doctype-public}"
147 doctype-system="{$doctype-system}"
148 standalone="{$standalone}">
149 <xsl:copy-of select="$content"/>
150 </exsl:document>
151 </xsl:when>
152 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
153 <exsl:document href="{$filename}"
154 method="{$method}"
155 encoding="{$encoding}"
156 indent="{$indent}"
157 omit-xml-declaration="{$omit-xml-declaration}"
158 cdata-section-elements="{$cdata-section-elements}"
159 media-type="{$media-type}"
160 doctype-public="{$doctype-public}"
161 standalone="{$standalone}">
162 <xsl:copy-of select="$content"/>
163 </exsl:document>
164 </xsl:when>
165 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
166 <exsl:document href="{$filename}"
167 method="{$method}"
168 encoding="{$encoding}"
169 indent="{$indent}"
170 omit-xml-declaration="{$omit-xml-declaration}"
171 cdata-section-elements="{$cdata-section-elements}"
172 media-type="{$media-type}"
173 doctype-system="{$doctype-system}"
174 standalone="{$standalone}">
175 <xsl:copy-of select="$content"/>
176 </exsl:document>
177 </xsl:when>
178 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
179 <exsl:document href="{$filename}"
180 method="{$method}"
181 encoding="{$encoding}"
182 indent="{$indent}"
183 omit-xml-declaration="{$omit-xml-declaration}"
184 cdata-section-elements="{$cdata-section-elements}"
185 media-type="{$media-type}"
186 standalone="{$standalone}">
187 <xsl:copy-of select="$content"/>
188 </exsl:document>
189 </xsl:otherwise>
190 </xsl:choose>
191 </xsl:when>
192 <xsl:otherwise>
193 <xsl:choose>
194 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
195 <exsl:document href="{$filename}"
196 method="{$method}"
197 encoding="{$encoding}"
198 indent="{$indent}"
199 omit-xml-declaration="{$omit-xml-declaration}"
200 cdata-section-elements="{$cdata-section-elements}"
201 doctype-public="{$doctype-public}"
202 doctype-system="{$doctype-system}"
203 standalone="{$standalone}">
204 <xsl:copy-of select="$content"/>
205 </exsl:document>
206 </xsl:when>
207 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
208 <exsl:document href="{$filename}"
209 method="{$method}"
210 encoding="{$encoding}"
211 indent="{$indent}"
212 omit-xml-declaration="{$omit-xml-declaration}"
213 cdata-section-elements="{$cdata-section-elements}"
214 doctype-public="{$doctype-public}"
215 standalone="{$standalone}">
216 <xsl:copy-of select="$content"/>
217 </exsl:document>
218 </xsl:when>
219 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
220 <exsl:document href="{$filename}"
221 method="{$method}"
222 encoding="{$encoding}"
223 indent="{$indent}"
224 omit-xml-declaration="{$omit-xml-declaration}"
225 cdata-section-elements="{$cdata-section-elements}"
226 doctype-system="{$doctype-system}"
227 standalone="{$standalone}">
228 <xsl:copy-of select="$content"/>
229 </exsl:document>
230 </xsl:when>
231 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
232 <exsl:document href="{$filename}"
233 method="{$method}"
234 encoding="{$encoding}"
235 indent="{$indent}"
236 omit-xml-declaration="{$omit-xml-declaration}"
237 cdata-section-elements="{$cdata-section-elements}"
238 standalone="{$standalone}">
239 <xsl:copy-of select="$content"/>
240 </exsl:document>
241 </xsl:otherwise>
242 </xsl:choose>
243 </xsl:otherwise>
244 </xsl:choose>
245 </xsl:when>
246
247 <xsl:when test="element-available('saxon:output')">
248 <xsl:choose>
249 <!-- Handle the permutations ... -->
250 <xsl:when test="$media-type != ''">
251 <xsl:choose>
252 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
253 <saxon:output saxon:character-representation="{$saxon.character.representation}"
254 href="{$filename}"
255 method="{$method}"
256 encoding="{$encoding}"
257 indent="{$indent}"
258 omit-xml-declaration="{$omit-xml-declaration}"
259 cdata-section-elements="{$cdata-section-elements}"
260 media-type="{$media-type}"
261 doctype-public="{$doctype-public}"
262 doctype-system="{$doctype-system}"
263 standalone="{$standalone}">
264 <xsl:copy-of select="$content"/>
265 </saxon:output>
266 </xsl:when>
267 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
268 <saxon:output saxon:character-representation="{$saxon.character.representation}"
269 href="{$filename}"
270 method="{$method}"
271 encoding="{$encoding}"
272 indent="{$indent}"
273 omit-xml-declaration="{$omit-xml-declaration}"
274 cdata-section-elements="{$cdata-section-elements}"
275 media-type="{$media-type}"
276 doctype-public="{$doctype-public}"
277 standalone="{$standalone}">
278 <xsl:copy-of select="$content"/>
279 </saxon:output>
280 </xsl:when>
281 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
282 <saxon:output saxon:character-representation="{$saxon.character.representation}"
283 href="{$filename}"
284 method="{$method}"
285 encoding="{$encoding}"
286 indent="{$indent}"
287 omit-xml-declaration="{$omit-xml-declaration}"
288 cdata-section-elements="{$cdata-section-elements}"
289 media-type="{$media-type}"
290 doctype-system="{$doctype-system}"
291 standalone="{$standalone}">
292 <xsl:copy-of select="$content"/>
293 </saxon:output>
294 </xsl:when>
295 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
296 <saxon:output saxon:character-representation="{$saxon.character.representation}"
297 href="{$filename}"
298 method="{$method}"
299 encoding="{$encoding}"
300 indent="{$indent}"
301 omit-xml-declaration="{$omit-xml-declaration}"
302 cdata-section-elements="{$cdata-section-elements}"
303 media-type="{$media-type}"
304 standalone="{$standalone}">
305 <xsl:copy-of select="$content"/>
306 </saxon:output>
307 </xsl:otherwise>
308 </xsl:choose>
309 </xsl:when>
310 <xsl:otherwise>
311 <xsl:choose>
312 <xsl:when test="$doctype-public != '' and $doctype-system != ''">
313 <saxon:output saxon:character-representation="{$saxon.character.representation}"
314 href="{$filename}"
315 method="{$method}"
316 encoding="{$encoding}"
317 indent="{$indent}"
318 omit-xml-declaration="{$omit-xml-declaration}"
319 cdata-section-elements="{$cdata-section-elements}"
320 doctype-public="{$doctype-public}"
321 doctype-system="{$doctype-system}"
322 standalone="{$standalone}">
323 <xsl:copy-of select="$content"/>
324 </saxon:output>
325 </xsl:when>
326 <xsl:when test="$doctype-public != '' and $doctype-system = ''">
327 <saxon:output saxon:character-representation="{$saxon.character.representation}"
328 href="{$filename}"
329 method="{$method}"
330 encoding="{$encoding}"
331 indent="{$indent}"
332 omit-xml-declaration="{$omit-xml-declaration}"
333 cdata-section-elements="{$cdata-section-elements}"
334 doctype-public="{$doctype-public}"
335 standalone="{$standalone}">
336 <xsl:copy-of select="$content"/>
337 </saxon:output>
338 </xsl:when>
339 <xsl:when test="$doctype-public = '' and $doctype-system != ''">
340 <saxon:output saxon:character-representation="{$saxon.character.representation}"
341 href="{$filename}"
342 method="{$method}"
343 encoding="{$encoding}"
344 indent="{$indent}"
345 omit-xml-declaration="{$omit-xml-declaration}"
346 cdata-section-elements="{$cdata-section-elements}"
347 doctype-system="{$doctype-system}"
348 standalone="{$standalone}">
349 <xsl:copy-of select="$content"/>
350 </saxon:output>
351 </xsl:when>
352 <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
353 <saxon:output saxon:character-representation="{$saxon.character.representation}"
354 href="{$filename}"
355 method="{$method}"
356 encoding="{$encoding}"
357 indent="{$indent}"
358 omit-xml-declaration="{$omit-xml-declaration}"
359 cdata-section-elements="{$cdata-section-elements}"
360 standalone="{$standalone}">
361 <xsl:copy-of select="$content"/>
362 </saxon:output>
363 </xsl:otherwise>
364 </xsl:choose>
365 </xsl:otherwise>
366 </xsl:choose>
367 </xsl:when>
368
369 <xsl:when test="element-available('redirect:write')">
370 <!-- Xalan uses redirect -->
371 <redirect:write file="{$filename}">
372 <xsl:copy-of select="$content"/>
373 </redirect:write>
374 </xsl:when>
375
376 <xsl:otherwise>
377 <!-- it doesn't matter since we won't be making chunks... -->
378 <xsl:message terminate="yes">
379 <xsl:text>Can't make chunks with </xsl:text>
380 <xsl:value-of select="system-property('xsl:vendor')"/>
381 <xsl:text>'s processor.</xsl:text>
382 </xsl:message>
383 </xsl:otherwise>
384 </xsl:choose>
385</xsl:template>
386
387<xsl:template name="write.chunk.with.doctype">
388 <xsl:param name="filename" select="''"/>
389 <xsl:param name="quiet" select="$chunk.quietly"/>
390
391 <xsl:param name="method" select="$chunker.output.method"/>
392 <xsl:param name="encoding" select="$chunker.output.encoding"/>
393 <xsl:param name="indent" select="$chunker.output.indent"/>
394 <xsl:param name="omit-xml-declaration"
395 select="$chunker.output.omit-xml-declaration"/>
396 <xsl:param name="standalone" select="$chunker.output.standalone"/>
397 <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
398 <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
399 <xsl:param name="media-type" select="$chunker.output.media-type"/>
400 <xsl:param name="cdata-section-elements"
401 select="$chunker.output.cdata-section-elements"/>
402
403 <xsl:param name="content"/>
404
405 <xsl:call-template name="write.chunk">
406 <xsl:with-param name="filename" select="$filename"/>
407 <xsl:with-param name="quiet" select="$quiet"/>
408 <xsl:with-param name="method" select="$method"/>
409 <xsl:with-param name="encoding" select="$encoding"/>
410 <xsl:with-param name="indent" select="$indent"/>
411 <xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/>
412 <xsl:with-param name="standalone" select="$standalone"/>
413 <xsl:with-param name="doctype-public" select="$doctype-public"/>
414 <xsl:with-param name="doctype-system" select="$doctype-system"/>
415 <xsl:with-param name="media-type" select="$media-type"/>
416 <xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/>
417 <xsl:with-param name="content" select="$content"/>
418 </xsl:call-template>
419</xsl:template>
420
421<xsl:template name="write.text.chunk">
422 <xsl:param name="filename" select="''"/>
423 <xsl:param name="quiet" select="$chunk.quietly"/>
424 <xsl:param name="suppress-context-node-name" select="0"/>
425 <xsl:param name="message-prolog"/>
426 <xsl:param name="message-epilog"/>
427 <xsl:param name="method" select="'text'"/>
428 <xsl:param name="encoding" select="$chunker.output.encoding"/>
429 <xsl:param name="media-type" select="$chunker.output.media-type"/>
430 <xsl:param name="content"/>
431
432 <xsl:call-template name="write.chunk">
433 <xsl:with-param name="filename" select="$filename"/>
434 <xsl:with-param name="quiet" select="$quiet"/>
435 <xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/>
436 <xsl:with-param name="message-prolog" select="$message-prolog"/>
437 <xsl:with-param name="message-epilog" select="$message-epilog"/>
438 <xsl:with-param name="method" select="$method"/>
439 <xsl:with-param name="encoding" select="$encoding"/>
440 <xsl:with-param name="indent" select="'no'"/>
441 <xsl:with-param name="omit-xml-declaration" select="'yes'"/>
442 <xsl:with-param name="standalone" select="'no'"/>
443 <xsl:with-param name="doctype-public"/>
444 <xsl:with-param name="doctype-system"/>
445 <xsl:with-param name="media-type" select="$media-type"/>
446 <xsl:with-param name="cdata-section-elements"/>
447 <xsl:with-param name="content" select="$content"/>
448 </xsl:call-template>
449</xsl:template>
450
451
452</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.