source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml/html.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: 23.5 KB
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6<!-- ********************************************************************
7 $Id: html.xsl 9306 2012-04-28 03:49:00Z bobstayton $
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
13
14 ******************************************************************** -->
15
16<!-- These variables set the align attribute value for HTML output based on
17 the writing-mode specified in the gentext file for the document's lang. -->
18
19<xsl:variable name="direction.align.start">
20 <xsl:choose>
21 <xsl:when test="starts-with($writing.mode, 'lr')">left</xsl:when>
22 <xsl:when test="starts-with($writing.mode, 'rl')">right</xsl:when>
23 <xsl:otherwise>left</xsl:otherwise>
24 </xsl:choose>
25</xsl:variable>
26
27<xsl:variable name="direction.align.end">
28 <xsl:choose>
29 <xsl:when test="starts-with($writing.mode, 'lr')">right</xsl:when>
30 <xsl:when test="starts-with($writing.mode, 'rl')">left</xsl:when>
31 <xsl:otherwise>right</xsl:otherwise>
32 </xsl:choose>
33</xsl:variable>
34
35<xsl:variable name="direction.mode">
36 <xsl:choose>
37 <xsl:when test="starts-with($writing.mode, 'lr')">ltr</xsl:when>
38 <xsl:when test="starts-with($writing.mode, 'rl')">rtl</xsl:when>
39 <xsl:otherwise>ltr</xsl:otherwise>
40 </xsl:choose>
41</xsl:variable>
42
43<!-- Support switching to <section> for HTML5 stylesheet -->
44<!-- This is an internal variable that does not need to be set by a user -->
45<xsl:variable name="div.element">div</xsl:variable>
46<!-- Support turning off table border with border="" for HTML5 -->
47<xsl:variable name="table.border.off">0</xsl:variable>
48
49<!-- The generate.html.title template is currently used for generating HTML -->
50<!-- "title" attributes for some inline elements only, but not for any -->
51<!-- block elements. It is called in eleven places in the inline.xsl -->
52<!-- file. But it's called by all the inline.* templates (e.g., -->
53<!-- inline.boldseq), which in turn are called by other (element) -->
54<!-- templates, so it results, currently, in supporting generation of the -->
55<!-- HTML "title" attribute for a total of about 92 elements. -->
56<!-- You can use mode="html.title.attribute" to get a title for -->
57<!-- an element specified by a param, including targets of cross references. -->
58<xsl:template name="generate.html.title">
59 <xsl:apply-templates select="." mode="html.title.attribute"/>
60</xsl:template>
61
62<xsl:template match="acronym|abbrev" mode="html.title.attribute">
63 <xsl:if test="alt">
64 <xsl:attribute name="title">
65 <xsl:value-of select="normalize-space(alt)"/>
66 </xsl:attribute>
67 </xsl:if>
68</xsl:template>
69
70<!-- Generate a title attribute for the context node -->
71<!-- This may be the target of an xref -->
72<xsl:template match="*" mode="html.title.attribute">
73 <xsl:variable name="is.title">
74 <xsl:call-template name="gentext.template.exists">
75 <xsl:with-param name="context" select="'title'"/>
76 <xsl:with-param name="name" select="local-name(.)"/>
77 <xsl:with-param name="lang">
78 <xsl:call-template name="l10n.language"/>
79 </xsl:with-param>
80 </xsl:call-template>
81 </xsl:variable>
82
83 <xsl:variable name="is.title-numbered">
84 <xsl:call-template name="gentext.template.exists">
85 <xsl:with-param name="context" select="'title-numbered'"/>
86 <xsl:with-param name="name" select="local-name(.)"/>
87 <xsl:with-param name="lang">
88 <xsl:call-template name="l10n.language"/>
89 </xsl:with-param>
90 </xsl:call-template>
91 </xsl:variable>
92
93 <xsl:variable name="is.title-unnumbered">
94 <xsl:call-template name="gentext.template.exists">
95 <xsl:with-param name="context" select="'title-unnumbered'"/>
96 <xsl:with-param name="name" select="local-name(.)"/>
97 <xsl:with-param name="lang">
98 <xsl:call-template name="l10n.language"/>
99 </xsl:with-param>
100 </xsl:call-template>
101 </xsl:variable>
102
103 <xsl:variable name="has.title.markup">
104 <xsl:apply-templates select="." mode="title.markup">
105 <xsl:with-param name="verbose" select="0"/>
106 </xsl:apply-templates>
107 </xsl:variable>
108
109 <xsl:variable name="gentext.title">
110 <xsl:if test="$has.title.markup != '???TITLE???' and ($is.title != 0 or $is.title-numbered != 0 or $is.title-unnumbered != 0)">
111 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
112 </xsl:if>
113 </xsl:variable>
114
115 <xsl:choose>
116 <xsl:when test="string-length($gentext.title) != 0">
117 <xsl:attribute name="title">
118 <xsl:value-of select="$gentext.title"/>
119 </xsl:attribute>
120 </xsl:when>
121 <!-- Fall back to alt if available -->
122 <xsl:when test="alt">
123 <xsl:attribute name="title">
124 <xsl:value-of select="normalize-space(alt)"/>
125 </xsl:attribute>
126 </xsl:when>
127 </xsl:choose>
128</xsl:template>
129
130<xsl:template match="qandaentry" mode="html.title.attribute">
131 <xsl:apply-templates select="question" mode="html.title.attribute"/>
132</xsl:template>
133
134<xsl:template match="question" mode="html.title.attribute">
135 <xsl:variable name="label.text">
136 <xsl:apply-templates select="." mode="qanda.label"/>
137 </xsl:variable>
138
139 <xsl:choose>
140 <xsl:when test="string-length($label.text) != 0">
141 <xsl:attribute name="title">
142 <xsl:value-of select="$label.text"/>
143 </xsl:attribute>
144 </xsl:when>
145 <!-- Fall back to alt if available -->
146 <xsl:when test="alt">
147 <xsl:attribute name="title">
148 <xsl:value-of select="normalize-space(alt)"/>
149 </xsl:attribute>
150 </xsl:when>
151 </xsl:choose>
152</xsl:template>
153
154<xsl:template name="dir">
155 <xsl:param name="inherit" select="0"/>
156
157 <xsl:variable name="dir">
158 <xsl:choose>
159 <xsl:when test="@dir">
160 <xsl:value-of select="@dir"/>
161 </xsl:when>
162 <xsl:when test="$inherit != 0">
163 <xsl:value-of select="ancestor::*/@dir[1]"/>
164 </xsl:when>
165 </xsl:choose>
166 </xsl:variable>
167
168 <xsl:if test="$dir != ''">
169 <xsl:attribute name="dir">
170 <xsl:value-of select="$dir"/>
171 </xsl:attribute>
172 </xsl:if>
173</xsl:template>
174
175<xsl:template name="anchor">
176 <xsl:param name="node" select="."/>
177 <xsl:param name="conditional" select="1"/>
178
179 <xsl:choose>
180 <xsl:when test="$generate.id.attributes != 0">
181 <!-- No named anchors output when this param is set -->
182 </xsl:when>
183 <xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
184 <a>
185 <xsl:attribute name="id">
186 <xsl:call-template name="object.id">
187 <xsl:with-param name="object" select="$node"/>
188 </xsl:call-template>
189 </xsl:attribute>
190 </a>
191 </xsl:when>
192 </xsl:choose>
193</xsl:template>
194
195<xsl:template name="id.attribute">
196 <xsl:param name="node" select="."/>
197 <xsl:param name="conditional" select="1"/>
198 <xsl:choose>
199 <xsl:when test="$generate.id.attributes = 0">
200 <!-- No id attributes when this param is zero -->
201 </xsl:when>
202 <xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
203 <xsl:attribute name="id">
204 <xsl:call-template name="object.id">
205 <xsl:with-param name="object" select="$node"/>
206 </xsl:call-template>
207 </xsl:attribute>
208 </xsl:when>
209 </xsl:choose>
210</xsl:template>
211
212<xsl:template name="href.target.uri">
213 <xsl:param name="context" select="."/>
214 <xsl:param name="object" select="."/>
215 <xsl:text>#</xsl:text>
216 <xsl:call-template name="object.id">
217 <xsl:with-param name="object" select="$object"/>
218 </xsl:call-template>
219</xsl:template>
220
221<xsl:template name="href.target">
222 <xsl:param name="context" select="."/>
223 <xsl:param name="object" select="."/>
224 <xsl:text>#</xsl:text>
225 <xsl:call-template name="object.id">
226 <xsl:with-param name="object" select="$object"/>
227 </xsl:call-template>
228</xsl:template>
229
230<xsl:template name="href.target.with.base.dir">
231 <xsl:param name="context" select="."/>
232 <xsl:param name="object" select="."/>
233 <xsl:if test="$manifest.in.base.dir = 0">
234 <xsl:value-of select="$chunk.base.dir"/>
235 </xsl:if>
236 <xsl:call-template name="href.target">
237 <xsl:with-param name="context" select="$context"/>
238 <xsl:with-param name="object" select="$object"/>
239 </xsl:call-template>
240</xsl:template>
241
242<xsl:template name="dingbat">
243 <xsl:param name="dingbat">bullet</xsl:param>
244 <xsl:call-template name="dingbat.characters">
245 <xsl:with-param name="dingbat" select="$dingbat"/>
246 </xsl:call-template>
247</xsl:template>
248
249<xsl:template name="dingbat.characters">
250 <!-- now that I'm using the real serializer, all that dingbat malarky -->
251 <!-- isn't necessary anymore... -->
252 <xsl:param name="dingbat">bullet</xsl:param>
253 <xsl:choose>
254 <xsl:when test="$dingbat='bullet'">&#8226;</xsl:when>
255 <xsl:when test="$dingbat='copyright'">&#169;</xsl:when>
256 <xsl:when test="$dingbat='trademark'">&#8482;</xsl:when>
257 <xsl:when test="$dingbat='trade'">&#8482;</xsl:when>
258 <xsl:when test="$dingbat='registered'">&#174;</xsl:when>
259 <xsl:when test="$dingbat='service'">(SM)</xsl:when>
260 <xsl:when test="$dingbat='nbsp'">&#160;</xsl:when>
261 <xsl:when test="$dingbat='ldquo'">&#8220;</xsl:when>
262 <xsl:when test="$dingbat='rdquo'">&#8221;</xsl:when>
263 <xsl:when test="$dingbat='lsquo'">&#8216;</xsl:when>
264 <xsl:when test="$dingbat='rsquo'">&#8217;</xsl:when>
265 <xsl:when test="$dingbat='em-dash'">&#8212;</xsl:when>
266 <xsl:when test="$dingbat='mdash'">&#8212;</xsl:when>
267 <xsl:when test="$dingbat='en-dash'">&#8211;</xsl:when>
268 <xsl:when test="$dingbat='ndash'">&#8211;</xsl:when>
269 <xsl:otherwise>
270 <xsl:text>&#8226;</xsl:text>
271 </xsl:otherwise>
272 </xsl:choose>
273</xsl:template>
274
275<xsl:template name="id.warning">
276 <xsl:if test="$id.warnings != 0 and not(@id) and not(@xml:id) and parent::*">
277 <xsl:variable name="title">
278 <xsl:choose>
279 <xsl:when test="title">
280 <xsl:value-of select="title[1]"/>
281 </xsl:when>
282 <xsl:when test="substring(local-name(*[1]), string-length(local-name(*[1])-3) = 'info') and *[1]/title">
283 <xsl:value-of select="*[1]/title[1]"/>
284 </xsl:when>
285 <xsl:when test="refmeta/refentrytitle">
286 <xsl:value-of select="refmeta/refentrytitle"/>
287 </xsl:when>
288 <xsl:when test="refnamediv/refname">
289 <xsl:value-of select="refnamediv/refname[1]"/>
290 </xsl:when>
291 </xsl:choose>
292 </xsl:variable>
293
294 <xsl:message>
295 <xsl:text>ID recommended on </xsl:text>
296 <xsl:value-of select="local-name(.)"/>
297 <xsl:if test="$title != ''">
298 <xsl:text>: </xsl:text>
299 <xsl:choose>
300 <xsl:when test="string-length($title) &gt; 40">
301 <xsl:value-of select="substring($title,1,40)"/>
302 <xsl:text>...</xsl:text>
303 </xsl:when>
304 <xsl:otherwise>
305 <xsl:value-of select="$title"/>
306 </xsl:otherwise>
307 </xsl:choose>
308 </xsl:if>
309 </xsl:message>
310 </xsl:if>
311</xsl:template>
312
313<xsl:template name="generate.class.attribute">
314 <xsl:param name="class" select="local-name(.)"/>
315 <xsl:apply-templates select="." mode="class.attribute">
316 <xsl:with-param name="class" select="$class"/>
317 </xsl:apply-templates>
318</xsl:template>
319
320<xsl:template match="*" mode="class.attribute">
321 <xsl:param name="class" select="local-name(.)"/>
322 <!-- permit customization of class attributes -->
323 <!-- Use element name by default -->
324 <xsl:variable name="class.value">
325 <xsl:apply-templates select="." mode="class.value">
326 <xsl:with-param name="class" select="$class"/>
327 </xsl:apply-templates>
328 </xsl:variable>
329
330 <xsl:if test="string-length(normalize-space($class.value)) != 0">
331 <xsl:attribute name="class">
332 <xsl:value-of select="$class.value"/>
333 </xsl:attribute>
334 </xsl:if>
335</xsl:template>
336
337<xsl:template match="*" mode="class.value">
338 <xsl:param name="class" select="local-name(.)"/>
339 <!-- permit customization of class value only -->
340 <!-- Use element name by default -->
341 <xsl:value-of select="$class"/>
342</xsl:template>
343
344<!-- Apply common attributes such as class, lang, dir -->
345<xsl:template name="common.html.attributes">
346 <xsl:param name="inherit" select="0"/>
347 <xsl:param name="class" select="local-name(.)"/>
348 <xsl:apply-templates select="." mode="common.html.attributes">
349 <xsl:with-param name="class" select="$class"/>
350 <xsl:with-param name="inherit" select="$inherit"/>
351 </xsl:apply-templates>
352</xsl:template>
353
354<xsl:template match="*" mode="common.html.attributes">
355 <xsl:param name="class" select="local-name(.)"/>
356 <xsl:param name="inherit" select="0"/>
357 <xsl:call-template name="generate.html.lang"/>
358 <xsl:call-template name="dir">
359 <xsl:with-param name="inherit" select="$inherit"/>
360 </xsl:call-template>
361 <xsl:apply-templates select="." mode="class.attribute">
362 <xsl:with-param name="class" select="$class"/>
363 </xsl:apply-templates>
364</xsl:template>
365
366<!-- Apply common attributes not including class -->
367<xsl:template name="locale.html.attributes">
368 <xsl:apply-templates select="." mode="locale.html.attributes"/>
369</xsl:template>
370
371<xsl:template match="*" mode="locale.html.attributes">
372 <xsl:call-template name="generate.html.lang"/>
373 <xsl:call-template name="dir"/>
374</xsl:template>
375
376<!-- Pass through any lang attributes -->
377<xsl:template name="generate.html.lang">
378 <xsl:apply-templates select="." mode="html.lang.attribute"/>
379</xsl:template>
380
381<xsl:template match="*" mode="html.lang.attribute">
382 <!-- match the attribute name to the output type -->
383 <xsl:choose>
384 <xsl:when test="@lang and $stylesheet.result.type = 'html'">
385 <xsl:attribute name="lang">
386 <xsl:value-of select="@lang"/>
387 </xsl:attribute>
388 </xsl:when>
389 <xsl:when test="@lang and $stylesheet.result.type = 'xhtml'">
390 <xsl:attribute name="xml:lang">
391 <xsl:value-of select="@lang"/>
392 </xsl:attribute>
393 </xsl:when>
394 <xsl:when test="@xml:lang and $stylesheet.result.type = 'html'">
395 <xsl:attribute name="lang">
396 <xsl:value-of select="@xml:lang"/>
397 </xsl:attribute>
398 </xsl:when>
399 <xsl:when test="@xml:lang and $stylesheet.result.type = 'xhtml'">
400 <xsl:attribute name="xml:lang">
401 <xsl:value-of select="@xml:lang"/>
402 </xsl:attribute>
403 </xsl:when>
404 </xsl:choose>
405</xsl:template>
406
407<!-- ==================================================================== -->
408<!-- Insert link to css or insert literal CSS in head element -->
409<xsl:template name="generate.css">
410 <xsl:choose>
411 <xsl:when test="$generate.css.header = 0">
412 <xsl:call-template name="generate.css.links"/>
413 </xsl:when>
414 <xsl:otherwise>
415 <xsl:call-template name="generate.css.headers"/>
416 </xsl:otherwise>
417 </xsl:choose>
418</xsl:template>
419
420<xsl:template name="generate.css.headers">
421 <xsl:call-template name="generate.default.css.header"/>
422 <xsl:call-template name="generate.custom.css.header"/>
423</xsl:template>
424
425<xsl:template name="generate.default.css.header">
426 <xsl:if test="$make.clean.html != 0 and $docbook.css.source != ''">
427 <!-- Select default file relative to stylesheet -->
428 <xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
429
430 <xsl:call-template name="output.css.header">
431 <xsl:with-param name="css.node" select="$css.node"/>
432 </xsl:call-template>
433 </xsl:if>
434</xsl:template>
435
436<xsl:template name="generate.custom.css.header">
437 <xsl:if test="$custom.css.source != ''">
438 <!-- Select custom file relative to document -->
439 <xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
440
441 <xsl:call-template name="output.css.header">
442 <xsl:with-param name="css.node" select="$css.node"/>
443 </xsl:call-template>
444 </xsl:if>
445</xsl:template>
446
447<xsl:template name="output.css.header">
448 <xsl:param name="css.node"/>
449
450 <xsl:choose>
451 <xsl:when test="count($css.node) = 0">
452 </xsl:when>
453 <xsl:otherwise>
454 <style type="text/css">
455 <xsl:copy-of select="$css.node/text()"/>
456 </style>
457 </xsl:otherwise>
458 </xsl:choose>
459</xsl:template>
460
461<!-- ==================================================================== -->
462<xsl:template name="generate.css.links">
463 <xsl:call-template name="generate.default.css.link"/>
464 <xsl:call-template name="generate.custom.css.link"/>
465</xsl:template>
466
467<xsl:template name="generate.default.css.link">
468 <xsl:if test="$make.clean.html != 0 and $docbook.css.link != 0 and $docbook.css.source != ''">
469 <xsl:variable name="filename">
470 <xsl:call-template name="css.output.filename">
471 <xsl:with-param name="src" select="$docbook.css.source"/>
472 </xsl:call-template>
473 </xsl:variable>
474
475 <xsl:call-template name="make.css.link">
476 <xsl:with-param name="css.filename" select="$filename"/>
477 </xsl:call-template>
478 </xsl:if>
479</xsl:template>
480
481<xsl:template name="generate.custom.css.link">
482 <xsl:if test="$custom.css.source != ''">
483 <xsl:variable name="filename">
484 <xsl:call-template name="css.output.filename">
485 <xsl:with-param name="src" select="$custom.css.source"/>
486 </xsl:call-template>
487 </xsl:variable>
488
489 <xsl:call-template name="make.css.link">
490 <xsl:with-param name="css.filename" select="$filename"/>
491 </xsl:call-template>
492 </xsl:if>
493</xsl:template>
494
495<!-- a CSS link reference must take into account the relative
496 path to a CSS file when chunked HTML is output to more than one directory -->
497<xsl:template name="make.css.link">
498 <xsl:param name="css.filename" select="''"/>
499
500 <xsl:variable name="href">
501 <xsl:call-template name="relative.path.link">
502 <xsl:with-param name="target.pathname" select="$css.filename"/>
503 </xsl:call-template>
504 </xsl:variable>
505
506 <xsl:if test="string-length($css.filename) != 0">
507 <link rel="stylesheet" type="text/css" href="{$href}"/>
508 </xsl:if>
509</xsl:template>
510
511<!-- And the same applies to script links -->
512<xsl:template name="make.script.link">
513 <xsl:param name="script.filename" select="''"/>
514
515 <xsl:variable name="src">
516 <xsl:call-template name="relative.path.link">
517 <xsl:with-param name="target.pathname" select="$script.filename"/>
518 </xsl:call-template>
519 </xsl:variable>
520
521 <xsl:if test="string-length($script.filename) != 0">
522 <script>
523 <xsl:attribute name="src">
524 <xsl:value-of select="$src"/>
525 </xsl:attribute>
526 <xsl:attribute name="type">
527 <xsl:value-of select="$html.script.type"/>
528 </xsl:attribute>
529 <xsl:call-template name="other.script.attributes">
530 <xsl:with-param name="script.filename" select="$script.filename"/>
531 </xsl:call-template>
532 </script>
533 </xsl:if>
534</xsl:template>
535
536<xsl:template name="other.script.attributes">
537 <xsl:param name="script.filename"/>
538 <!-- Placeholder template to allow customization to
539 insert additional script element attributes if needed -->
540</xsl:template>
541
542<xsl:template name="relative.path.link">
543 <xsl:param name="target.pathname"/>
544
545 <xsl:variable name="href.to.uri" select="$target.pathname"/>
546
547 <xsl:variable name="href.from.uri">
548 <xsl:call-template name="href.target.uri">
549 <xsl:with-param name="object" select="."/>
550 </xsl:call-template>
551 </xsl:variable>
552
553 <xsl:variable name="href.to">
554 <xsl:call-template name="trim.common.uri.paths">
555 <xsl:with-param name="uriA" select="$href.to.uri"/>
556 <xsl:with-param name="uriB" select="$href.from.uri"/>
557 <xsl:with-param name="return" select="'A'"/>
558 </xsl:call-template>
559 </xsl:variable>
560
561 <xsl:variable name="href.from">
562 <xsl:call-template name="trim.common.uri.paths">
563 <xsl:with-param name="uriA" select="$href.to.uri"/>
564 <xsl:with-param name="uriB" select="$href.from.uri"/>
565 <xsl:with-param name="return" select="'B'"/>
566 </xsl:call-template>
567 </xsl:variable>
568 <xsl:variable name="depth">
569 <xsl:call-template name="count.uri.path.depth">
570 <xsl:with-param name="filename" select="$href.from"/>
571 </xsl:call-template>
572 </xsl:variable>
573 <xsl:variable name="href">
574 <xsl:call-template name="copy-string">
575 <xsl:with-param name="string" select="'../'"/>
576 <xsl:with-param name="count" select="$depth"/>
577 </xsl:call-template>
578 <xsl:value-of select="$href.to"/>
579 </xsl:variable>
580
581 <xsl:value-of select="$href"/>
582</xsl:template>
583
584<!-- ==================================================================== -->
585
586<xsl:template name="generate.css.files">
587 <xsl:call-template name="generate.default.css.file"/>
588 <xsl:call-template name="generate.custom.css.file"/>
589</xsl:template>
590
591<xsl:template name="generate.default.css.file">
592 <xsl:if test="$make.clean.html != 0 and $generate.css.header = 0 and $docbook.css.source != ''">
593 <!-- Select default file relative to stylesheet -->
594 <xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
595
596 <xsl:call-template name="generate.css.file">
597 <xsl:with-param name="src" select="$docbook.css.source"/>
598 <xsl:with-param name="css.node" select="$css.node"/>
599 </xsl:call-template>
600 </xsl:if>
601</xsl:template>
602
603<xsl:template name="generate.custom.css.file">
604 <xsl:if test="$custom.css.source != '' and $generate.css.header = 0">
605 <!-- Select custom file relative to document -->
606 <xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
607
608 <xsl:call-template name="generate.css.file">
609 <xsl:with-param name="src" select="$custom.css.source"/>
610 <xsl:with-param name="css.node" select="$css.node"/>
611 </xsl:call-template>
612 </xsl:if>
613</xsl:template>
614
615<xsl:template name="generate.css.file">
616 <xsl:param name="css.node"/>
617 <xsl:param name="src" select="''"/>
618
619 <xsl:variable name="css.text" select="$css.node/text()"/>
620
621 <xsl:choose>
622 <xsl:when test="count($css.node) = 0">
623 <xsl:message>
624 <xsl:text>ERROR: no root element for CSS source file'</xsl:text>
625 <xsl:value-of select="$src"/>
626 <xsl:text>'.</xsl:text>
627 </xsl:message>
628 </xsl:when>
629 <xsl:otherwise>
630 <xsl:variable name="filename">
631 <xsl:call-template name="css.output.pathname">
632 <xsl:with-param name="src" select="$src"/>
633 <xsl:with-param name="content" select="$css.node"/>
634 </xsl:call-template>
635 </xsl:variable>
636
637 <xsl:call-template name="write.text.chunk">
638 <xsl:with-param name="filename" select="$filename"/>
639 <xsl:with-param name="content" select="$css.text"/>
640 </xsl:call-template>
641
642 </xsl:otherwise>
643 </xsl:choose>
644</xsl:template>
645
646<xsl:template name="css.output.filename">
647 <xsl:param name="content"/>
648 <xsl:param name="src" select="''"/>
649
650 <xsl:variable name="candidate">
651 <xsl:choose>
652 <xsl:when test="string-length($src) = 0">
653 <xsl:message>
654 <xsl:text>ERROR: missing CSS input filename.</xsl:text>
655 </xsl:message>
656 </xsl:when>
657 <xsl:when test="substring($src,string-length($src)-3) = '.xml'">
658 <xsl:value-of select="substring($src, 1, string-length($src) - 4)"/>
659 </xsl:when>
660 <xsl:otherwise>
661 <xsl:value-of select="$src"/>
662 </xsl:otherwise>
663 </xsl:choose>
664 </xsl:variable>
665 <xsl:value-of select="$candidate"/>
666</xsl:template>
667
668<xsl:template name="css.output.pathname">
669 <xsl:param name="content"/>
670 <xsl:param name="src" select="''"/>
671
672 <xsl:variable name="file">
673 <xsl:call-template name="css.output.filename">
674 <xsl:with-param name="content" select="$content"/>
675 <xsl:with-param name="src" select="$src"/>
676 </xsl:call-template>
677 </xsl:variable>
678
679 <xsl:variable name="path" select="concat($chunk.base.dir, $file)"/>
680 <xsl:value-of select="$path"/>
681
682</xsl:template>
683
684</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.