Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F1127941
svg2gfx.xsl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
svg2gfx.xsl
View Options
<?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) > 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) > 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) > 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) > 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) > 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) > 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) > 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>
File Metadata
Details
Attached
Mime Type
text/xml
Expires
Thu, Jun 19, 16:25 (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24731
Default Alt Text
svg2gfx.xsl (2 KB)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment