summaryrefslogtreecommitdiff
path: root/xsl/svg.xsl
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-03 11:57:58 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-03 12:00:54 +0200
commit909b7ebba9f4441c3a72428cf3cc89cba560c9e0 (patch)
tree2bf79bf52c96613ca9c20d9cc1ea2bc3e6740b1f /xsl/svg.xsl
parent9205580d0636d2b55e77cad60bec0fece47b6696 (diff)
downloadmutti-web-909b7ebba9f4441c3a72428cf3cc89cba560c9e0.tar.gz
mutti-web-909b7ebba9f4441c3a72428cf3cc89cba560c9e0.tar.bz2
mutti-web-909b7ebba9f4441c3a72428cf3cc89cba560c9e0.zip
Rework styling to be responsive and more "wide"
Diffstat (limited to 'xsl/svg.xsl')
-rw-r--r--xsl/svg.xsl49
1 files changed, 49 insertions, 0 deletions
diff --git a/xsl/svg.xsl b/xsl/svg.xsl
new file mode 100644
index 0000000..dd18d72
--- /dev/null
+++ b/xsl/svg.xsl
@@ -0,0 +1,49 @@
+<?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-img">
+ <xsl:with-param name="svg-file" select="@src" />
+ <xsl:with-param name="svg-alt" select="@alt" />
+ </xsl:call-template>
+ </xsl:template>
+ -->
+ <xsl:template match="s:svg" mode="html">
+ <xsl:call-template name="svg-inline">
+ <xsl:with-param name="svg-file" select="@file" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="svg-img">
+ <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:template mode="inline-svg" match="svg:*">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="inline-svg"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>