source: stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/graphics.xsl@ 65b2904

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 65b2904 was 65b2904, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS-XSL Stylesheets files.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@6840 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 21.0 KB
Line 
1<?xml version='1.0'?>
2<!DOCTYPE xsl:stylesheet [
3<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
4<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
5 ]>
6<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:fo="http://www.w3.org/1999/XSL/Format"
8 xmlns:xlink="http://www.w3.org/1999/xlink"
9 xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory"
10 xmlns:xtext="com.nwalsh.xalan.Text"
11 xmlns:lxslt="http://xml.apache.org/xslt"
12 exclude-result-prefixes="xlink stext xtext lxslt"
13 extension-element-prefixes="stext xtext"
14 version='1.0'>
15
16<!-- ********************************************************************
17 $Id$
18 ********************************************************************
19
20 This file is part of the XSL DocBook Stylesheet distribution.
21 See ../README or http://docbook.sf.net/release/xsl/current/ for
22 copyright and other information.
23
24 Contributors:
25 Colin Paul Adams, <colin@colina.demon.co.uk>
26 Paul Grosso, <pgrosso@arbortext.com>
27
28 ******************************************************************** -->
29
30<!-- ==================================================================== -->
31<!-- Graphic format tests for the FO backend -->
32
33<xsl:param name="graphic.notations">
34 <!-- n.b. exactly one leading space, one trailing space, and one inter-word space -->
35 <xsl:choose>
36 <xsl:when test="$passivetex.extensions != 0">
37 <xsl:text> PNG PDF JPG JPEG linespecific </xsl:text>
38 </xsl:when>
39 <xsl:when test="$fop1.extensions != 0">
40 <xsl:text> BMP GIF TIFF SVG PNG EPS JPG JPEG linespecific </xsl:text>
41 </xsl:when>
42 <xsl:when test="$fop.extensions != 0">
43 <xsl:text> BMP GIF TIFF SVG PNG EPS JPG JPEG linespecific </xsl:text>
44 </xsl:when>
45 <xsl:when test="$arbortext.extensions != 0">
46 <xsl:text> PNG PDF JPG JPEG linespecific GIF GIF87a GIF89a TIFF BMP </xsl:text>
47 </xsl:when>
48 <xsl:when test="$xep.extensions != 0">
49 <xsl:text> SVG PNG PDF JPG JPEG linespecific GIF GIF87a GIF89a TIFF BMP </xsl:text>
50 </xsl:when>
51 <xsl:otherwise>
52 <xsl:text> PNG PDF JPG JPEG linespecific GIF GIF87a GIF89a TIFF BMP </xsl:text>
53 </xsl:otherwise>
54 </xsl:choose>
55</xsl:param>
56
57<xsl:template name="is.graphic.format">
58 <xsl:param name="format"/>
59 <xsl:if test="contains($graphic.notations, concat(' ',$format,' '))">1</xsl:if>
60</xsl:template>
61
62<xsl:param name="graphic.extensions">
63 <!-- n.b. exactly one leading space, one trailing space, and one inter-word space -->
64 <xsl:choose>
65 <xsl:when test="$passivetex.extensions != 0">
66 <xsl:text> png pdf jpg jpeg </xsl:text>
67 </xsl:when>
68 <xsl:when test="$fop1.extensions != 0">
69 <xsl:text> bmp gif tif tiff svg png pdf jpg jpeg eps </xsl:text>
70 </xsl:when>
71 <xsl:when test="$fop.extensions != 0">
72 <xsl:text> bmp gif tif tiff svg png pdf jpg jpeg eps </xsl:text>
73 </xsl:when>
74 <xsl:when test="$arbortext.extensions != 0">
75 <xsl:text> png pdf jpg jpeg gif tif tiff bmp </xsl:text>
76 </xsl:when>
77 <xsl:when test="$xep.extensions != 0">
78 <xsl:text> svg png pdf jpg jpeg gif tif tiff bmp eps </xsl:text>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:text> svg png pdf jpg jpeg gif tif tiff bmp eps </xsl:text>
82 </xsl:otherwise>
83 </xsl:choose>
84</xsl:param>
85
86<xsl:template name="is.graphic.extension">
87 <xsl:param name="ext"/>
88 <xsl:variable name="lcext" select="translate($ext,
89 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
90 'abcdefghijklmnopqrstuvwxyz')"/>
91
92 <xsl:if test="contains($graphic.extensions,
93 concat(' ', $lcext, ' '))">1</xsl:if>
94</xsl:template>
95
96<xsl:template name="graphic.format.content-type">
97 <xsl:param name="format"/>
98 <xsl:variable name="is.graphic.format">
99 <xsl:call-template name="is.graphic.format">
100 <xsl:with-param name="format" select="$format"/>
101 </xsl:call-template>
102 </xsl:variable>
103 <xsl:if test="$is.graphic.format">
104 <xsl:choose>
105 <xsl:when test="$format = ''"></xsl:when>
106 <xsl:when test="$format = 'linespecific'"></xsl:when>
107 <xsl:when test="$format = 'PS'">application/postscript</xsl:when>
108 <xsl:when test="$format = 'PDF'">application/pdf</xsl:when>
109 <xsl:when test="$format = 'PNG'">image/png</xsl:when>
110 <xsl:when test="$format = 'SVG'">image/svg+xml</xsl:when>
111 <xsl:when test="$format = 'JPG'">image/jpeg</xsl:when>
112 <xsl:when test="$format = 'GIF87a'">image/gif</xsl:when>
113 <xsl:when test="$format = 'GIF89a'">image/gif</xsl:when>
114 <xsl:otherwise>
115 <xsl:value-of select="concat('image/',
116 translate($format, &uppercase;, &lowercase;))"/>
117 </xsl:otherwise>
118 </xsl:choose>
119 </xsl:if>
120</xsl:template>
121
122
123<!-- ==================================================================== -->
124
125<xsl:template match="screenshot">
126 <fo:block>
127 <xsl:apply-templates/>
128 </fo:block>
129</xsl:template>
130
131<xsl:template match="screeninfo">
132</xsl:template>
133
134<!-- ==================================================================== -->
135<!-- Override these templates for FO -->
136<!-- ==================================================================== -->
137
138<xsl:template name="process.image">
139 <!-- When this template is called, the current node should be -->
140 <!-- a graphic, inlinegraphic, imagedata, or videodata. All -->
141 <!-- those elements have the same set of attributes, so we can -->
142 <!-- handle them all in one place. -->
143
144 <xsl:variable name="scalefit">
145 <xsl:choose>
146 <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
147 <xsl:when test="@contentwidth">0</xsl:when>
148 <xsl:when test="@contentdepth and
149 @contentdepth != '100%'">0</xsl:when>
150 <xsl:when test="@scale">0</xsl:when>
151 <xsl:when test="@scalefit"><xsl:value-of select="@scalefit"/></xsl:when>
152 <xsl:when test="@width or @depth">1</xsl:when>
153 <xsl:otherwise>0</xsl:otherwise>
154 </xsl:choose>
155 </xsl:variable>
156
157 <xsl:variable name="scale">
158 <xsl:choose>
159 <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
160 <xsl:when test="@contentwidth or @contentdepth">1.0</xsl:when>
161 <xsl:when test="@scale">
162 <xsl:value-of select="@scale div 100.0"/>
163 </xsl:when>
164 <xsl:otherwise>1.0</xsl:otherwise>
165 </xsl:choose>
166 </xsl:variable>
167
168 <xsl:variable name="filename">
169 <xsl:choose>
170 <xsl:when test="local-name(.) = 'graphic'
171 or local-name(.) = 'inlinegraphic'">
172 <!-- handle legacy graphic and inlinegraphic by new template -->
173 <xsl:call-template name="mediaobject.filename">
174 <xsl:with-param name="object" select="."/>
175 </xsl:call-template>
176 </xsl:when>
177 <xsl:otherwise>
178 <!-- imagedata, videodata, audiodata -->
179 <xsl:call-template name="mediaobject.filename">
180 <xsl:with-param name="object" select=".."/>
181 </xsl:call-template>
182 </xsl:otherwise>
183 </xsl:choose>
184 </xsl:variable>
185
186 <xsl:variable name="content-type">
187 <xsl:if test="@format">
188 <xsl:call-template name="graphic.format.content-type">
189 <xsl:with-param name="format" select="@format"/>
190 </xsl:call-template>
191 </xsl:if>
192 </xsl:variable>
193
194 <xsl:variable name="bgcolor">
195 <xsl:call-template name="pi.dbfo_background-color">
196 <xsl:with-param name="node" select=".."/>
197 </xsl:call-template>
198 </xsl:variable>
199
200 <fo:external-graphic>
201 <xsl:attribute name="src">
202 <xsl:call-template name="fo-external-image">
203 <xsl:with-param name="filename">
204 <xsl:if test="$img.src.path != '' and
205 not(starts-with($filename, '/')) and
206 not(contains($filename, '://'))">
207 <xsl:value-of select="$img.src.path"/>
208 </xsl:if>
209 <xsl:value-of select="$filename"/>
210 </xsl:with-param>
211 </xsl:call-template>
212 </xsl:attribute>
213
214 <xsl:attribute name="width">
215 <xsl:choose>
216 <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
217 <xsl:when test="contains(@width,'%')">
218 <xsl:value-of select="@width"/>
219 </xsl:when>
220 <xsl:when test="@width and not(@width = '')">
221 <xsl:call-template name="length-spec">
222 <xsl:with-param name="length" select="@width"/>
223 <xsl:with-param name="default.units" select="'px'"/>
224 </xsl:call-template>
225 </xsl:when>
226 <xsl:when test="not(@depth) and $default.image.width != ''">
227 <xsl:call-template name="length-spec">
228 <xsl:with-param name="length" select="$default.image.width"/>
229 <xsl:with-param name="default.units" select="'px'"/>
230 </xsl:call-template>
231 </xsl:when>
232 <xsl:otherwise>auto</xsl:otherwise>
233 </xsl:choose>
234 </xsl:attribute>
235
236 <xsl:attribute name="height">
237 <xsl:choose>
238 <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
239 <xsl:when test="contains(@depth,'%')">
240 <xsl:value-of select="@depth"/>
241 </xsl:when>
242 <xsl:when test="@depth">
243 <xsl:call-template name="length-spec">
244 <xsl:with-param name="length" select="@depth"/>
245 <xsl:with-param name="default.units" select="'px'"/>
246 </xsl:call-template>
247 </xsl:when>
248 <xsl:otherwise>auto</xsl:otherwise>
249 </xsl:choose>
250 </xsl:attribute>
251
252 <xsl:attribute name="content-width">
253 <xsl:choose>
254 <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
255 <xsl:when test="contains(@contentwidth,'%')">
256 <xsl:value-of select="@contentwidth"/>
257 </xsl:when>
258 <xsl:when test="@contentwidth">
259 <xsl:call-template name="length-spec">
260 <xsl:with-param name="length" select="@contentwidth"/>
261 <xsl:with-param name="default.units" select="'px'"/>
262 </xsl:call-template>
263 </xsl:when>
264 <xsl:when test="number($scale) != 1.0">
265 <xsl:value-of select="$scale * 100"/>
266 <xsl:text>%</xsl:text>
267 </xsl:when>
268 <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
269 <xsl:otherwise>auto</xsl:otherwise>
270 </xsl:choose>
271 </xsl:attribute>
272
273 <xsl:attribute name="content-height">
274 <xsl:choose>
275 <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
276 <xsl:when test="contains(@contentdepth,'%')">
277 <xsl:value-of select="@contentdepth"/>
278 </xsl:when>
279 <xsl:when test="@contentdepth">
280 <xsl:call-template name="length-spec">
281 <xsl:with-param name="length" select="@contentdepth"/>
282 <xsl:with-param name="default.units" select="'px'"/>
283 </xsl:call-template>
284 </xsl:when>
285 <xsl:when test="number($scale) != 1.0">
286 <xsl:value-of select="$scale * 100"/>
287 <xsl:text>%</xsl:text>
288 </xsl:when>
289 <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
290 <xsl:otherwise>auto</xsl:otherwise>
291 </xsl:choose>
292 </xsl:attribute>
293
294 <xsl:if test="$content-type != ''">
295 <xsl:attribute name="content-type">
296 <xsl:value-of select="concat('content-type:',$content-type)"/>
297 </xsl:attribute>
298 </xsl:if>
299
300 <xsl:if test="$bgcolor != ''">
301 <xsl:attribute name="background-color">
302 <xsl:value-of select="$bgcolor"/>
303 </xsl:attribute>
304 </xsl:if>
305
306 <xsl:if test="@align">
307 <xsl:attribute name="text-align">
308 <xsl:value-of select="@align"/>
309 </xsl:attribute>
310 </xsl:if>
311
312 <xsl:if test="@valign">
313 <xsl:attribute name="display-align">
314 <xsl:choose>
315 <xsl:when test="@valign = 'top'">before</xsl:when>
316 <xsl:when test="@valign = 'middle'">center</xsl:when>
317 <xsl:when test="@valign = 'bottom'">after</xsl:when>
318 <xsl:otherwise>auto</xsl:otherwise>
319 </xsl:choose>
320 </xsl:attribute>
321 </xsl:if>
322 </fo:external-graphic>
323</xsl:template>
324
325<!-- ==================================================================== -->
326
327<xsl:template match="graphic">
328 <xsl:choose>
329 <xsl:when test="parent::inlineequation">
330 <xsl:call-template name="process.image"/>
331 </xsl:when>
332 <xsl:otherwise>
333 <fo:block>
334 <xsl:if test="@align">
335 <xsl:attribute name="text-align">
336 <xsl:value-of select="@align"/>
337 </xsl:attribute>
338 </xsl:if>
339 <xsl:call-template name="process.image"/>
340 </fo:block>
341 </xsl:otherwise>
342 </xsl:choose>
343</xsl:template>
344
345<xsl:template match="inlinegraphic">
346 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
347 <xsl:variable name="filename">
348 <xsl:choose>
349 <xsl:when test="@entityref">
350 <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
351 </xsl:when>
352 <xsl:otherwise>
353 <xsl:apply-templates select="@fileref"/>
354 </xsl:otherwise>
355 </xsl:choose>
356 </xsl:variable>
357
358 <xsl:choose>
359 <xsl:when test="@format='linespecific'">
360 <xsl:choose>
361 <xsl:when test="$use.extensions != '0'
362 and $textinsert.extension != '0'">
363 <xsl:choose>
364 <xsl:when test="contains($vendor, 'SAXON')">
365 <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
366 </xsl:when>
367 <xsl:when test="contains($vendor, 'Apache Software Foundation')">
368 <xtext:insertfile href="{$filename}"/>
369 </xsl:when>
370 <xsl:otherwise>
371 <xsl:message terminate="yes">
372 <xsl:text>Don't know how to insert files with </xsl:text>
373 <xsl:value-of select="$vendor"/>
374 </xsl:message>
375 </xsl:otherwise>
376 </xsl:choose>
377 </xsl:when>
378 <xsl:otherwise>
379 <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"
380 href="{$filename}"/>
381 </xsl:otherwise>
382 </xsl:choose>
383 </xsl:when>
384 <xsl:otherwise>
385 <xsl:call-template name="process.image"/>
386 </xsl:otherwise>
387 </xsl:choose>
388</xsl:template>
389
390<!-- ==================================================================== -->
391
392<xsl:template match="mediaobject|mediaobjectco">
393
394 <xsl:variable name="olist" select="imageobject|imageobjectco
395 |videoobject|audioobject
396 |textobject"/>
397
398 <xsl:variable name="object.index">
399 <xsl:call-template name="select.mediaobject.index">
400 <xsl:with-param name="olist" select="$olist"/>
401 <xsl:with-param name="count" select="1"/>
402 </xsl:call-template>
403 </xsl:variable>
404
405 <xsl:variable name="object" select="$olist[position() = $object.index]"/>
406
407 <xsl:variable name="align">
408 <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
409 </xsl:variable>
410
411 <xsl:variable name="id">
412 <xsl:call-template name="object.id"/>
413 </xsl:variable>
414
415 <fo:block id="{$id}">
416 <xsl:if test="$align != '' ">
417 <xsl:attribute name="text-align">
418 <xsl:value-of select="$align"/>
419 </xsl:attribute>
420 </xsl:if>
421
422 <xsl:apply-templates select="$object"/>
423 <xsl:apply-templates select="caption"/>
424 </fo:block>
425</xsl:template>
426
427<xsl:template match="inlinemediaobject">
428 <xsl:call-template name="select.mediaobject"/>
429</xsl:template>
430
431<!-- ==================================================================== -->
432
433<xsl:template match="imageobjectco">
434 <xsl:apply-templates select="imageobject"/>
435 <xsl:apply-templates select="calloutlist"/>
436</xsl:template>
437
438<xsl:template match="imageobject">
439 <xsl:choose>
440 <xsl:when test="imagedata">
441 <xsl:apply-templates select="imagedata"/>
442 </xsl:when>
443 <xsl:otherwise>
444 <fo:instream-foreign-object>
445 <xsl:apply-templates mode="copy-all"/>
446 </fo:instream-foreign-object>
447 </xsl:otherwise>
448 </xsl:choose>
449</xsl:template>
450
451<!-- ==================================================================== -->
452
453<xsl:template match="*" mode="copy-all">
454 <xsl:copy>
455 <xsl:for-each select="@*">
456 <xsl:copy/>
457 </xsl:for-each>
458 <xsl:apply-templates mode="copy-all"/>
459 </xsl:copy>
460</xsl:template>
461
462<xsl:template match="text()|comment()|processing-instruction()" mode="copy-all">
463 <xsl:copy/>
464</xsl:template>
465
466<!-- ==================================================================== -->
467
468<xsl:template match="imagedata">
469 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
470 <xsl:variable name="filename">
471 <xsl:call-template name="mediaobject.filename">
472 <xsl:with-param name="object" select=".."/>
473 </xsl:call-template>
474 </xsl:variable>
475
476 <xsl:choose>
477 <xsl:when test="@format='linespecific'">
478 <xsl:choose>
479 <xsl:when test="$use.extensions != '0'
480 and $textinsert.extension != '0'">
481 <xsl:choose>
482 <xsl:when test="contains($vendor, 'SAXON')">
483 <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
484 </xsl:when>
485 <xsl:when test="contains($vendor, 'Apache Software Foundation')">
486 <xtext:insertfile href="{$filename}"/>
487 </xsl:when>
488 <xsl:otherwise>
489 <xsl:message terminate="yes">
490 <xsl:text>Don't know how to insert files with </xsl:text>
491 <xsl:value-of select="$vendor"/>
492 </xsl:message>
493 </xsl:otherwise>
494 </xsl:choose>
495 </xsl:when>
496 <xsl:otherwise>
497 <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"
498 href="{$filename}"/>
499 </xsl:otherwise>
500 </xsl:choose>
501 </xsl:when>
502 <xsl:otherwise>
503 <xsl:call-template name="process.image"/>
504 </xsl:otherwise>
505 </xsl:choose>
506</xsl:template>
507
508<!-- ==================================================================== -->
509
510<xsl:template match="videoobject">
511 <xsl:apply-templates select="videodata"/>
512</xsl:template>
513
514<xsl:template match="videodata">
515 <xsl:call-template name="process.image"/>
516</xsl:template>
517
518<!-- ==================================================================== -->
519
520<xsl:template match="audioobject">
521 <xsl:apply-templates select="audiodata"/>
522</xsl:template>
523
524<xsl:template match="audiodata">
525 <xsl:call-template name="process.image"/>
526</xsl:template>
527
528<!-- ==================================================================== -->
529
530<xsl:template match="textobject">
531 <xsl:apply-templates/>
532</xsl:template>
533
534<xsl:template match="textdata">
535 <xsl:variable name="filename">
536 <xsl:choose>
537 <xsl:when test="@entityref">
538 <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
539 </xsl:when>
540 <xsl:otherwise>
541 <xsl:apply-templates select="@fileref"/>
542 </xsl:otherwise>
543 </xsl:choose>
544 </xsl:variable>
545
546 <xsl:variable name="encoding">
547 <xsl:choose>
548 <xsl:when test="@encoding">
549 <xsl:value-of select="@encoding"/>
550 </xsl:when>
551 <xsl:otherwise>
552 <xsl:value-of select="$textdata.default.encoding"/>
553 </xsl:otherwise>
554 </xsl:choose>
555 </xsl:variable>
556
557 <xsl:choose>
558 <xsl:when test="$use.extensions != '0'
559 and $textinsert.extension != '0'">
560 <xsl:choose>
561 <xsl:when test="element-available('stext:insertfile')">
562 <stext:insertfile href="{$filename}" encoding="{$encoding}"/>
563 </xsl:when>
564 <xsl:when test="element-available('xtext:insertfile')">
565 <xtext:insertfile href="{$filename}"/>
566 </xsl:when>
567 <xsl:otherwise>
568 <xsl:message terminate="yes">
569 <xsl:text>No insertfile extension available.</xsl:text>
570 </xsl:message>
571 </xsl:otherwise>
572 </xsl:choose>
573 </xsl:when>
574 <xsl:otherwise>
575 <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"
576 href="{$filename}"/>
577 </xsl:otherwise>
578 </xsl:choose>
579</xsl:template>
580
581<!-- ==================================================================== -->
582
583<xsl:template match="caption">
584 <fo:block>
585 <xsl:if test="@align = 'right' or @align = 'left' or @align='center'">
586 <xsl:attribute name="text-align"><xsl:value-of
587 select="@align"/></xsl:attribute>
588 </xsl:if>
589 <xsl:apply-templates/>
590 </fo:block>
591</xsl:template>
592
593<!-- ==================================================================== -->
594
595<xsl:template name="fo-external-image">
596 <xsl:param name="filename"/>
597
598 <xsl:choose>
599 <xsl:when test="$passivetex.extensions != 0
600 or $fop.extensions != 0">
601 <xsl:value-of select="$filename"/>
602 </xsl:when>
603 <xsl:otherwise>
604 <xsl:value-of select="concat('url(', $filename, ')')"/>
605 </xsl:otherwise>
606 </xsl:choose>
607</xsl:template>
608
609<!-- Resolve xml:base attributes -->
610<xsl:template match="@fileref">
611 <!-- need a check for absolute urls -->
612 <xsl:choose>
613 <xsl:when test="contains(., ':') or starts-with(.,'/')">
614 <!-- it has a uri scheme or starts with '/', so it is an absolute uri -->
615 <xsl:value-of select="."/>
616 </xsl:when>
617 <xsl:when test="$keep.relative.image.uris != 0">
618 <!-- leave it alone -->
619 <xsl:value-of select="."/>
620 </xsl:when>
621 <xsl:otherwise>
622 <!-- its a relative uri -->
623 <xsl:call-template name="relative-uri">
624 </xsl:call-template>
625 </xsl:otherwise>
626 </xsl:choose>
627</xsl:template>
628
629</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.