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