source: Dev/branches/rest-dojo-ui/client/dojox/gfx/resources/svg2gfx-simple.xsl @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 2.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Super simple XSLT to convert Nils.svg and Lars.svg to our format -->
3<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
4        <xsl:output method="text" version="1.0" encoding="UTF-8"/>
5        <xsl:template name="fill">
6                <xsl:param name="node"/>
7                <xsl:if test="count($node/@fill) &gt; 0">
8                        <xsl:text>fill: "</xsl:text>
9                        <xsl:value-of select="$node/@fill"/>
10                        <xsl:text>",</xsl:text>
11                </xsl:if>
12        </xsl:template>
13        <xsl:template name="stroke">
14                <xsl:param name="node"/>
15                <xsl:text>stroke: {</xsl:text>
16                <xsl:if test="count($node/@stroke) &gt; 0">
17                        <xsl:text>color: "</xsl:text>
18                        <xsl:value-of select="$node/@stroke"/>
19                        <xsl:text>",</xsl:text>
20                </xsl:if>
21                <xsl:if test="count($node/@stroke-width) &gt; 0">
22                        <xsl:text>width: "</xsl:text>
23                        <xsl:value-of select="$node/@stroke-width"/>
24                        <xsl:text>",</xsl:text>
25                </xsl:if>
26                <xsl:if test="count($node/@stroke-linecap) &gt; 0">
27                        <xsl:text>cap: "</xsl:text>
28                        <xsl:value-of select="$node/@stroke-linecap"/>
29                        <xsl:text>",</xsl:text>
30                </xsl:if>
31                <xsl:if test="count($node/@stroke-linejoin) &gt; 0">
32                        <xsl:text>join: "</xsl:text>
33                        <xsl:value-of select="$node/@stroke-linejoin"/>
34                        <xsl:text>",</xsl:text>
35                </xsl:if>
36                <xsl:text>},</xsl:text>
37        </xsl:template>
38        <xsl:template match="g">
39                <xsl:text>{</xsl:text>
40                <xsl:if test="count(@id) &gt; 0">
41                        <xsl:text>name: "</xsl:text>
42                        <xsl:value-of select="@id"/>
43                        <xsl:text>",</xsl:text>
44                </xsl:if>
45                <xsl:text>children: [</xsl:text>
46                <xsl:apply-templates select="g|path"/>
47                <xsl:text>]},</xsl:text>
48        </xsl:template>
49        <xsl:template match="path">
50                <xsl:text>{</xsl:text>
51                <xsl:if test="count(@id) &gt; 0">
52                        <xsl:text>name: "</xsl:text>
53                        <xsl:value-of select="@id"/>
54                        <xsl:text>",</xsl:text>
55                </xsl:if>
56                <xsl:text>shape: {type: "path", path: "</xsl:text>
57                <xsl:value-of select="@d"/>
58                <xsl:text>"},</xsl:text>
59                <xsl:call-template name="fill">
60                        <xsl:with-param name="node" select="."/>
61                </xsl:call-template>
62                <xsl:call-template name="stroke">
63                        <xsl:with-param name="node" select="."/>
64                </xsl:call-template>
65                <xsl:text>},</xsl:text>
66        </xsl:template>
67        <xsl:template match="svg">
68                <xsl:text>[</xsl:text>
69                <xsl:apply-templates select="g|path"/>
70                <xsl:text>]</xsl:text>
71        </xsl:template>
72</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.