blob: 2fc8778213c8ca149119e1a42f56c5619d7c6228 (
plain)
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
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:s="https://beratung-franzke.de/web-tpl">
<xsl:template match="s:svg" mode="html">
<xsl:call-template name="svg">
<xsl:with-param name="svg-file" select="@src" />
<xsl:with-param name="svg-alt" select="@alt" />
</xsl:call-template>
</xsl:template>
<xsl:template name="svg">
<xsl:param name="svg-file" />
<xsl:param name="svg-alt" />
<xsl:variable name="png-file" select="concat(substring-before($svg-file, '.svg'), '.png')" />
<img src="{$svg-file}" alt="{$svg-alt}" class="svg" />
<object data="{$svg-file}" type="image/svg+xml" class="svg" style="display: none">
<xsl:attribute name="width">
<xsl:value-of select="ceiling(document(concat('../', $svg-file))/svg:svg/@width)" />
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="ceiling(document(concat('../', $svg-file))/svg:svg/@height)" />
</xsl:attribute>
<param name="src" value="{$svg-file}" />
<img src="{$png-file}" alt="{$svg-alt}" />
</object>
</xsl:template>
</xsl:stylesheet>
|