aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/gfx/demos/data/svg2gfx.xsl
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/gfx/demos/data/svg2gfx.xsl
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/gfx/demos/data/svg2gfx.xsl')
-rw-r--r--includes/js/dojox/gfx/demos/data/svg2gfx.xsl72
1 files changed, 72 insertions, 0 deletions
diff --git a/includes/js/dojox/gfx/demos/data/svg2gfx.xsl b/includes/js/dojox/gfx/demos/data/svg2gfx.xsl
new file mode 100644
index 0000000..90a463f
--- /dev/null
+++ b/includes/js/dojox/gfx/demos/data/svg2gfx.xsl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Super simple XSLT to convert Nils.svg and Lars.svg to our format -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <xsl:output method="text" version="1.0" encoding="UTF-8"/>
+ <xsl:template name="fill">
+ <xsl:param name="node"/>
+ <xsl:if test="count($node/@fill) &gt; 0">
+ <xsl:text>fill: "</xsl:text>
+ <xsl:value-of select="$node/@fill"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="stroke">
+ <xsl:param name="node"/>
+ <xsl:text>stroke: {</xsl:text>
+ <xsl:if test="count($node/@stroke) &gt; 0">
+ <xsl:text>color: "</xsl:text>
+ <xsl:value-of select="$node/@stroke"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ <xsl:if test="count($node/@stroke-width) &gt; 0">
+ <xsl:text>width: "</xsl:text>
+ <xsl:value-of select="$node/@stroke-width"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ <xsl:if test="count($node/@stroke-linecap) &gt; 0">
+ <xsl:text>cap: "</xsl:text>
+ <xsl:value-of select="$node/@stroke-linecap"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ <xsl:if test="count($node/@stroke-linejoin) &gt; 0">
+ <xsl:text>join: "</xsl:text>
+ <xsl:value-of select="$node/@stroke-linejoin"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ <xsl:text>},</xsl:text>
+ </xsl:template>
+ <xsl:template match="g">
+ <xsl:text>{</xsl:text>
+ <xsl:if test="count(@id) &gt; 0">
+ <xsl:text>name: "</xsl:text>
+ <xsl:value-of select="@id"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ <xsl:text>children: [</xsl:text>
+ <xsl:apply-templates select="g|path"/>
+ <xsl:text>]},</xsl:text>
+ </xsl:template>
+ <xsl:template match="path">
+ <xsl:text>{</xsl:text>
+ <xsl:if test="count(@id) &gt; 0">
+ <xsl:text>name: "</xsl:text>
+ <xsl:value-of select="@id"/>
+ <xsl:text>",</xsl:text>
+ </xsl:if>
+ <xsl:text>shape: {type: "path", path: "</xsl:text>
+ <xsl:value-of select="@d"/>
+ <xsl:text>"},</xsl:text>
+ <xsl:call-template name="fill">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ <xsl:call-template name="stroke">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ <xsl:text>},</xsl:text>
+ </xsl:template>
+ <xsl:template match="svg">
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates select="g|path"/>
+ <xsl:text>]</xsl:text>
+ </xsl:template>
+</xsl:stylesheet>