666
|
1 <?xml version="1.0" encoding="UTF-8"?>
|
|
2 <xsl:stylesheet version="2.0"
|
|
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
5 xmlns:cc="http://creativecommons.org/ns#"
|
|
6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
7 xmlns:svg="http://www.w3.org/2000/svg"
|
|
8 xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
9 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
10 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
11 >
|
|
12
|
|
13 <!--
|
|
14 Create icons from a single SVG file.
|
|
15 In the SVG the icons reside in labelled groups -->
|
|
16
|
|
17 <xsl:output method="xml"/>
|
|
18
|
|
19 <xsl:template match="/">
|
|
20 <!-- select all hidden layers -->
|
|
21 <xsl:apply-templates select="//svg:g[@style='display:none']" />
|
|
22 </xsl:template>
|
|
23
|
|
24 <xsl:template match="svg:g">
|
|
25 <xsl:variable name="name" select="@inkscape:label"/>
|
|
26 <xsl:variable name="file" select="concat('embedded/svg/',$name,'.svg')"/>
|
|
27 <xsl:result-document href="{$file}">
|
|
28 <svg:svg>
|
|
29 <xsl:copy-of select="/svg:svg/@*"/>
|
|
30 <xsl:copy-of select="/svg:svg/*[not(@style='display:none')]"/>
|
|
31 <svg:g>
|
|
32 <xsl:copy-of select="@*"/>
|
|
33 <!-- replace the "style" attribute -->
|
|
34 <xsl:attribute name="style">display:inline</xsl:attribute>
|
|
35 <xsl:copy-of select="*"/>
|
|
36 </svg:g>
|
|
37 </svg:svg>
|
|
38 </xsl:result-document>
|
|
39 </xsl:template>
|
|
40
|
|
41
|
|
42 </xsl:stylesheet>
|
|
43
|