1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
3 xmlns:
svg=
"http://www.w3.org/2000/svg"
7 Transform the SVG produced by various tools, applying assorted fixups.
11 Add viewBox attribute to svg element if not already present. This allows the
14 <xsl:template match=
"svg:svg">
16 <xsl:if test=
"not(@viewBox)">
17 <xsl:attribute name=
"viewBox">
18 <xsl:text>0 0 </xsl:text>
19 <xsl:value-of select=
"@width"/>
20 <xsl:text> </xsl:text>
21 <xsl:value-of select=
"@height"/>
24 <xsl:apply-templates select=
"@* | node()"/>
29 Fix stroke="transparent" attribute, which is invalid SVG.
31 <xsl:template match=
"@stroke[.='transparent']">
32 <xsl:attribute name=
"stroke">none
</xsl:attribute>
38 <xsl:template match=
"@* | node()">
40 <xsl:apply-templates select=
"@* | node()"/>