-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags-upgrade.xsl
66 lines (51 loc) · 2.1 KB
/
flags-upgrade.xsl
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rw="http://www.rapidweb.tools/rw" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:template match="rw:collection">
<rw:collection>
<xsl:apply-templates select="@* | * | text()"/>
</rw:collection>
</xsl:template>
<xsl:template match="rw:template">
<rw:template>
<xsl:apply-templates select="@* | * | text()"/>
</rw:template>
</xsl:template>
<xsl:template match="svg:svg">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:variable name="ratio" select="number(@width) div number(@height)"/>
<xsl:variable name="height" select="24"/>
<xsl:attribute name="width">
<!-- <xsl:text>60</xsl:text>-->
<xsl:value-of select="number($height) * $ratio"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="$height"/>
</xsl:attribute>
<xsl:if test="not(@viewBox)">
<xsl:attribute name="viewBox">
<xsl:text>0 0 </xsl:text>
<xsl:value-of select="@width"/>
<!-- <xsl:value-of select="@height * 2"/>-->
<xsl:text> </xsl:text>
<xsl:value-of select="@height"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="* | text()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{name()}">
<xsl:apply-templates select="* | @* | text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>