Code

r16523@tres: ted | 2007-09-11 20:47:18 -0700
authorgouldtj <gouldtj@users.sourceforge.net>
Wed, 12 Sep 2007 06:36:30 +0000 (06:36 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Wed, 12 Sep 2007 06:36:30 +0000 (06:36 +0000)
 Adding in the svg2xaml and xaml2svg XSLT scripts.  Also updating the
 aisvg.xslt to 1.0.

15 files changed:
share/extensions/Makefile.am
share/extensions/aisvg.xslt
share/extensions/colors.xml [new file with mode: 0644]
share/extensions/svg2xaml.inx [new file with mode: 0644]
share/extensions/svg2xaml.xsl [new file with mode: 0644]
share/extensions/xaml2svg.inx [new file with mode: 0644]
share/extensions/xaml2svg.xsl [new file with mode: 0644]
share/extensions/xaml2svg/Makefile.am [new file with mode: 0644]
share/extensions/xaml2svg/animation.xsl [new file with mode: 0644]
share/extensions/xaml2svg/brushes.xsl [new file with mode: 0644]
share/extensions/xaml2svg/canvas.xsl [new file with mode: 0644]
share/extensions/xaml2svg/geometry.xsl [new file with mode: 0644]
share/extensions/xaml2svg/properties.xsl [new file with mode: 0644]
share/extensions/xaml2svg/shapes.xsl [new file with mode: 0644]
share/extensions/xaml2svg/transform.xsl [new file with mode: 0644]

index 180fd420cf5c80ea600754bae7ae58977ae30587..eb642f2acb11f7efe8148760a19c86c57ff36006 100644 (file)
@@ -1,5 +1,7 @@
 
-SUBDIRS = Barcode
+SUBDIRS = \
+       Barcode \
+       xaml2svg
 
 extensiondir = $(datadir)/inkscape/extensions
 
@@ -100,7 +102,10 @@ extensions = \
        whirl.py
 
 otherstuff = \
-    aisvg.xslt
+    aisvg.xslt \
+       colors.xml \
+       svg2xaml.xsl \
+       xaml2svg.xsl
 
 modules = \
        addnodes.inx \
@@ -169,6 +174,7 @@ modules = \
        sk_input.inx \
        straightseg.inx \
        summersnight.inx \
+       svg2xaml.inx \
        svg_and_media_zip_output.inx \
        svgz_input.inx \
        svgz_output.inx \
@@ -181,7 +187,8 @@ modules = \
        text_replace.inx \
        txt2svg.inx \
        whirl.inx \
-       wmf_input.inx
+       wmf_input.inx \
+       xaml2svg.inx
 
 
 extension_SCRIPTS = \
index 146a439b866e9e36d75ef7617734d9384b39d974..e2e7096ff969e5d8058c9364e6da8f7dc00fc980 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>\r
-<xsl:stylesheet  xml:space="default" version="2.0" \r
+<xsl:stylesheet  xml:space="default" version="1.0" \r
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
 xmlns="http://www.w3.org/2000/svg"\r
 xmlns:svg="http://www.w3.org/2000/svg"\r
@@ -22,4 +22,4 @@ xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" >
        </xsl:template>\r
        <xsl:template match="i:*|@i:*|x:*|@x:*|graph:*|@graph:*|a:*|@a:*">\r
        </xsl:template>\r
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>\r
diff --git a/share/extensions/colors.xml b/share/extensions/colors.xml
new file mode 100644 (file)
index 0000000..d877113
--- /dev/null
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<colors>\r
+<color name="aliceblue" hex="#f0f8ff" rgb="240,248,255" />\r
+<color name="antiquewhite" hex="#faebd7" rgb="250,235,215" />\r
+<color name="aqua" hex="#00ffff" rgb="0,255,255" />\r
+<color name="aquamarine" hex="#7fffd4" rgb="127,255,212" />\r
+<color name="azure" hex="#f0ffff" rgb="240,255,255" />\r
+<color name="beige" hex="#f5f5dc" rgb="245,245,220" />\r
+<color name="bisque" hex="#ffe4c4" rgb="255,228,196" />\r
+<color name="black" hex="#000000" rgb="0,0,0" />\r
+<color name="blanchedalmond" hex="#ffebcd" rgb="255,235,205" />\r
+<color name="blue" hex="#0000ff" rgb="0,0,255" />\r
+<color name="blueviolet" hex="#8a2be2" rgb="138,43,226" />\r
+<color name="brown" hex="#a52a2a" rgb="165,42,42" />\r
+<color name="burlywood" hex="#deb887" rgb="222,184,135" />\r
+<color name="cadetblue" hex="#5f9ea0" rgb="95,158,160" />\r
+<color name="chartreuse" hex="#7fff00" rgb="127,255,0" />\r
+<color name="chocolate" hex="#d2691e" rgb="210,105,30" />\r
+<color name="coral" hex="#ff7f50" rgb="255,127,80" />\r
+<color name="cornflowerblue" hex="#6495ed" rgb="100,149,237" />\r
+<color name="cornsilk" hex="#fff8dc" rgb="255,248,220" />\r
+<color name="crimson" hex="#dc143c" rgb="220,20,60" />\r
+<color name="cyan" hex="#00ffff" rgb="0,255,255" />\r
+<color name="darkblue" hex="#00008b" rgb="0,0,139" />\r
+<color name="darkcyan" hex="#008b8b" rgb="0,139,139" />\r
+<color name="darkgoldenrod" hex="#b8860b" rgb="184,134,11" />\r
+<color name="darkgray" hex="#a9a9a9" rgb="169,169,169" />\r
+<color name="darkgreen" hex="#006400" rgb="0,100,0" />\r
+<color name="darkgrey" hex="#a9a9a9" rgb="169,169,169" />\r
+<color name="darkkhaki" hex="#bdb76b" rgb="189,183,107" />\r
+<color name="darkmagenta" hex="#8b008b" rgb="139,0,139" />\r
+<color name="darkolivegreen" hex="#556b2f" rgb="85,107,47" />\r
+<color name="darkorange" hex="#ff8c00" rgb="255,140,0" />\r
+<color name="darkorchid" hex="#9932cc" rgb="153,50,204" />\r
+<color name="darkred" hex="#8b0000" rgb="139,0,0" />\r
+<color name="darksalmon" hex="#e9967a" rgb="233,150,122" />\r
+<color name="darkseagreen" hex="#8fbc8f" rgb="143,188,143" />\r
+<color name="darkslateblue" hex="#483d8b" rgb="72,61,139" />\r
+<color name="darkslategray" hex="#2f4f4f" rgb="47,79,79" />\r
+<color name="darkslategrey" hex="#2f4f4f" rgb="47,79,79" />\r
+<color name="darkturquoise" hex="#00ced1" rgb="0,206,209" />\r
+<color name="darkviolet" hex="#9400d3" rgb="148,0,211" />\r
+<color name="deeppink" hex="#ff1493" rgb="255,20,147" />\r
+<color name="deepskyblue" hex="#00bfff" rgb="0,191,255" />\r
+<color name="dimgray" hex="#696969" rgb="105,105,105" />\r
+<color name="dimgrey" hex="#696969" rgb="105,105,105" />\r
+<color name="dodgerblue" hex="#1e90ff" rgb="30,144,255" />\r
+<color name="firebrick" hex="#b22222" rgb="178,34,34" />\r
+<color name="floralwhite" hex="#fffaf0" rgb="255,250,240" />\r
+<color name="forestgreen" hex="#228b22" rgb="34,139,34" />\r
+<color name="fuchsia" hex="#ff00ff" rgb="255,0,255" />\r
+<color name="gainsboro" hex="#dcdcdc" rgb="220,220,220" />\r
+<color name="ghostwhite" hex="#f8f8ff" rgb="248,248,255" />\r
+<color name="gold" hex="#ffd700" rgb="255,215,0" />\r
+<color name="goldenrod" hex="#daa520" rgb="218,165,32" />\r
+<color name="gray" hex="#808080" rgb="128,128,128" />\r
+<color name="green" hex="#008000" rgb="0,128,0" />\r
+<color name="greenyellow" hex="#adff2f" rgb="173,255,47" />\r
+<color name="grey" hex="#808080" rgb="128,128,128" />\r
+<color name="honeydew" hex="#f0fff0" rgb="240,255,240" />\r
+<color name="hotpink" hex="#ff69b4" rgb="255,105,180" />\r
+<color name="indianred" hex="#cd5c5c" rgb="205,92,92" />\r
+<color name="indigo" hex="#4b0082" rgb="75,0,130" />\r
+<color name="ivory" hex="#fffff0" rgb="255,255,240" />\r
+<color name="khaki" hex="#f0e68c" rgb="240,230,140" />\r
+<color name="lavender" hex="#e6e6fa" rgb="230,230,250" />\r
+<color name="lavenderblush" hex="#fff0f5" rgb="255,240,245" />\r
+<color name="lawngreen" hex="#7cfc00" rgb="124,252,0" />\r
+<color name="lemonchiffon" hex="#fffacd" rgb="255,250,205" />\r
+<color name="lightblue" hex="#add8e6" rgb="173,216,230" />\r
+<color name="lightcoral" hex="#f08080" rgb="240,128,128" />\r
+<color name="lightcyan" hex="#e0ffff" rgb="224,255,255" />\r
+<color name="lightgoldenrodyellow" hex="#fafad2" rgb="250,250,210" />\r
+<color name="lightgray" hex="#d3d3d3" rgb="211,211,211" />\r
+<color name="lightgreen" hex="#90ee90" rgb="144,238,144" />\r
+<color name="lightgrey" hex="#d3d3d3" rgb="211,211,211" />\r
+<color name="lightpink" hex="#ffb6c1" rgb="255,182,193" />\r
+<color name="lightsalmon" hex="#ffa07a" rgb="255,160,122" />\r
+<color name="lightseagreen" hex="#20b2aa" rgb="32,178,170" />\r
+<color name="lightskyblue" hex="#87cefa" rgb="135,206,250" />\r
+<color name="lightslategray" hex="#778899" rgb="119,136,153" />\r
+<color name="lightslategrey" hex="#778899" rgb="119,136,153" />\r
+<color name="lightsteelblue" hex="#b0c4de" rgb="176,196,222" />\r
+<color name="lightyellow" hex="#ffffe0" rgb="255,255,224" />\r
+<color name="lime" hex="#00ff00" rgb="0,255,0" />\r
+<color name="limegreen" hex="#32cd32" rgb="50,205,50" />\r
+<color name="linen" hex="#faf0e6" rgb="250,240,230" />\r
+<color name="magenta" hex="#ff00ff" rgb="255,0,255" />\r
+<color name="maroon" hex="#800000" rgb="128,0,0" />\r
+<color name="mediumaquamarine" hex="#66cdaa" rgb="102,205,170" />\r
+<color name="mediumblue" hex="#0000cd" rgb="0,0,205" />\r
+<color name="mediumorchid" hex="#ba55d3" rgb="186,85,211" />\r
+<color name="mediumpurple" hex="#9370db" rgb="147,112,219" />\r
+<color name="mediumseagreen" hex="#3cb371" rgb="60,179,113" />\r
+<color name="mediumslateblue" hex="#7b68ee" rgb="123,104,238" />\r
+<color name="mediumspringgreen" hex="#00fa9a" rgb="0,250,154" />\r
+<color name="mediumturquoise" hex="#48d1cc" rgb="72,209,204" />\r
+<color name="mediumvioletred" hex="#c71585" rgb="199,21,133" />\r
+<color name="midnightblue" hex="#191970" rgb="25,25,112" />\r
+<color name="mintcream" hex="#f5fffa" rgb="245,255,250" />\r
+<color name="mistyrose" hex="#ffe4e1" rgb="255,228,225" />\r
+<color name="moccasin" hex="#ffe4b5" rgb="255,228,181" />\r
+<color name="navajowhite" hex="#ffdead" rgb="255,222,173" />\r
+<color name="navy" hex="#000080" rgb="0,0,128" />\r
+<color name="oldlace" hex="#fdf5e6" rgb="253,245,230" />\r
+<color name="olive" hex="#808000" rgb="128,128,0" />\r
+<color name="olivedrab" hex="#6b8e23" rgb="107,142,35" />\r
+<color name="orange" hex="#ffa500" rgb="255,165,0" />\r
+<color name="orangered" hex="#ff4500" rgb="255,69,0" />\r
+<color name="orchid" hex="#da70d6" rgb="218,112,214" />\r
+<color name="palegoldenrod" hex="#eee8aa" rgb="238,232,170" />\r
+<color name="palegreen" hex="#98fb98" rgb="152,251,152" />\r
+<color name="paleturquoise" hex="#afeeee" rgb="175,238,238" />\r
+<color name="palevioletred" hex="#db7093" rgb="219,112,147" />\r
+<color name="papayawhip" hex="#ffefd5" rgb="255,239,213" />\r
+<color name="peachpuff" hex="#ffdab9" rgb="255,218,185" />\r
+<color name="peru" hex="#cd853f" rgb="205,133,63" />\r
+<color name="pink" hex="#ffc0cb" rgb="255,192,203" />\r
+<color name="plum" hex="#dda0dd" rgb="221,160,221" />\r
+<color name="powderblue" hex="#b0e0e6" rgb="176,224,230" />\r
+<color name="purple" hex="#800080" rgb="128,0,128" />\r
+<color name="red" hex="#ff0000" rgb="255,0,0" />\r
+<color name="rosybrown" hex="#bc8f8f" rgb="188,143,143" />\r
+<color name="royalblue" hex="#4169e1" rgb="65,105,225" />\r
+<color name="saddlebrown" hex="#8b4513" rgb="139,69,19" />\r
+<color name="salmon" hex="#fa8072" rgb="250,128,114" />\r
+<color name="sandybrown" hex="#f4a460" rgb="244,164,96" />\r
+<color name="seagreen" hex="#2e8b57" rgb="46,139,87" />\r
+<color name="seashell" hex="#fff5ee" rgb="255,245,238" />\r
+<color name="sienna" hex="#a0522d" rgb="160,82,45" />\r
+<color name="silver" hex="#c0c0c0" rgb="192,192,192" />\r
+<color name="skyblue" hex="#87ceeb" rgb="135,206,235" />\r
+<color name="slateblue" hex="#6a5acd" rgb="106,90,205" />\r
+<color name="slategray" hex="#708090" rgb="112,128,144" />\r
+<color name="slategrey" hex="#708090" rgb="112,128,144" />\r
+<color name="snow" hex="#fffafa" rgb="255,250,250" />\r
+<color name="springgreen" hex="#00ff7f" rgb="0,255,127" />\r
+<color name="steelblue" hex="#4682b4" rgb="70,130,180" />\r
+<color name="tan" hex="#d2b48c" rgb="210,180,140" />\r
+<color name="teal" hex="#008080" rgb="0,128,128" />\r
+<color name="thistle" hex="#d8bfd8" rgb="216,191,216" />\r
+<color name="tomato" hex="#ff6347" rgb="255,99,71" />\r
+<color name="turquoise" hex="#40e0d0" rgb="64,224,208" />\r
+<color name="violet" hex="#ee82ee" rgb="238,130,238" />\r
+<color name="wheat" hex="#f5deb3" rgb="245,222,179" />\r
+<color name="white" hex="#ffffff" rgb="255,255,255" />\r
+<color name="whitesmoke" hex="#f5f5f5" rgb="245,245,245" />\r
+<color name="yellow" hex="#ffff00" rgb="255,255,0" />\r
+<color name="yellowgreen" hex="#9acd32" rgb="154,205,50" />\r
+</colors>\r
diff --git a/share/extensions/svg2xaml.inx b/share/extensions/svg2xaml.inx
new file mode 100644 (file)
index 0000000..c189fd4
--- /dev/null
@@ -0,0 +1,13 @@
+<inkscape-extension>
+    <_name>XAML Output</_name>
+    <id>org.inkscape.output.xaml</id>
+    <output>
+        <extension>.xaml</extension>
+        <mimetype>text/xml+xaml</mimetype>
+        <_filetypename>Microsoft XAML (*.xaml)</_filetypename>
+        <_filetypetooltip>Microsoft's GUI definition format</_filetypetooltip>
+    </output>
+    <xslt>
+        <file reldir="extensions">svg2xaml.xsl</file>
+    </xslt>
+</inkscape-extension>
diff --git a/share/extensions/svg2xaml.xsl b/share/extensions/svg2xaml.xsl
new file mode 100644 (file)
index 0000000..d2e5716
--- /dev/null
@@ -0,0 +1,1167 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0"\r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
+xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+xmlns:msxsl="urn:schemas-microsoft-com:xslt"\r
+exclude-result-prefixes="rdf xlink msxsl">\r
+\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="UTF-8"/>\r
+\r
+<xsl:param name="silverlight_compatible" select="1" />\r
+\r
+<xsl:template name="template_color">\r
+  <xsl:param name="colorspec" />\r
+  <xsl:param name="opacityspec" />\r
+  <xsl:choose>\r
+    <xsl:when test="starts-with($colorspec, 'rgb(') and not(contains($colorspec , '%'))">\r
+      <xsl:value-of select="'#'" />\r
+      <xsl:if test="$opacityspec != '' and number($opacityspec) != 1"><xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number($opacityspec) * 255" /></xsl:with-param></xsl:call-template></xsl:if>\r
+      <xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="substring-before(substring-after($colorspec, 'rgb('), ',')" /></xsl:with-param></xsl:call-template>\r
+      <xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="substring-before(substring-after(substring-after($colorspec, 'rgb('), ','), ',')" /></xsl:with-param></xsl:call-template>\r
+      <xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="substring-before(substring-after(substring-after(substring-after($colorspec, 'rgb('), ','), ','), ')')" /></xsl:with-param></xsl:call-template>\r
+    </xsl:when>\r
+    <xsl:when test="starts-with($colorspec, 'rgb(') and contains($colorspec , '%')">\r
+      <xsl:value-of select="'#'" />\r
+      <xsl:if test="$opacityspec != '' and number($opacityspec) != 1"><xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number($opacityspec) * 255" /></xsl:with-param></xsl:call-template></xsl:if>\r
+      <xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number(substring-before(substring-after($colorspec, 'rgb('), '%,')) * 255 div 100" /></xsl:with-param></xsl:call-template>\r
+      <xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number(substring-before(substring-after(substring-after($colorspec, 'rgb('), ','), '%,')) * 255 div 100" /></xsl:with-param></xsl:call-template>\r
+      <xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number(substring-before(substring-after(substring-after(substring-after($colorspec, 'rgb('), ','), ','), '%)')) * 255 div 100" /></xsl:with-param></xsl:call-template>\r
+    </xsl:when>\r
+    <xsl:when test="starts-with($colorspec, '#')">\r
+      <xsl:value-of select="'#'" />\r
+      <xsl:if test="$opacityspec != ''"><xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number($opacityspec) * 255" /></xsl:with-param></xsl:call-template></xsl:if>\r
+      <xsl:choose>\r
+        <xsl:when test="string-length(substring-after($colorspec, '#')) = 3">\r
+          <xsl:variable name="colorspec3"><xsl:value-of select="translate(substring-after($colorspec, '#'), 'abcdefgh', 'ABCDEFGH')" /></xsl:variable>\r
+          <xsl:value-of select="concat(substring($colorspec3, 1, 1), substring($colorspec3, 1, 1))" />\r
+          <xsl:value-of select="concat(substring($colorspec3, 2, 1), substring($colorspec3, 2, 1))" />\r
+          <xsl:value-of select="concat(substring($colorspec3, 3, 1), substring($colorspec3, 3, 1))" />\r
+        </xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="translate(substring-after($colorspec, '#'), 'abcdefgh', 'ABCDEFGH')" /></xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+    <xsl:otherwise>\r
+      <xsl:variable name="named_color_hex" select="document('colors.xml')/colors/color[@name = translate($colorspec, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]/@hex" />\r
+      <xsl:choose>\r
+        <xsl:when test="$named_color_hex and $named_color_hex != ''">\r
+          <xsl:value-of select="'#'" />\r
+          <xsl:if test="$opacityspec != '' and number($opacityspec) != 1"><xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number($opacityspec) * 255" /></xsl:with-param></xsl:call-template></xsl:if>\r
+          <xsl:value-of select="substring-after($named_color_hex, '#')" />\r
+        </xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="$colorspec" /></xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="fill" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@fill and starts-with(@fill, 'url(#')"><xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@fill, 'url(#'), ')'), '}')" /></xsl:when>\r
+    <xsl:when test="@fill"><xsl:value-of select="@fill" /></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'fill:') and starts-with(substring-after(@style, 'fill:'), 'url(#')"><xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@style, 'url(#'), ')'), '}')" /></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'fill:')">\r
+      <xsl:variable name="Fill" select="substring-after(@style, 'fill:')" />\r
+      <xsl:choose>\r
+        <xsl:when test="contains($Fill, ';')">\r
+          <xsl:value-of select="substring-before($Fill, ';')" />\r
+        </xsl:when>  \r
+        <xsl:otherwise><xsl:value-of select="$Fill" /></xsl:otherwise>\r
+      </xsl:choose> \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="fill" select="parent::*"/></xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="fill_opacity" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@fill-opacity"><xsl:value-of select="@fill-opacity" /></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'fill-opacity:')">\r
+      <xsl:variable name="Opacity" select="substring-after(@style, 'fill-opacity:')" />\r
+      <xsl:choose>\r
+        <xsl:when test="contains($Opacity, ';')"><xsl:value-of select="substring-before($Opacity, ';')" /></xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="$Opacity" /></xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="fill_opacity" select="parent::*" /></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+\r
+<xsl:template mode="fill_rule" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@fill-rule and (@fill-rule = 'nonzero' or @fill-rule = 'evenodd')"><xsl:attribute name="FillRule"><xsl:value-of select="@fill-rule" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'fill-rule:')">\r
+      <xsl:variable name="FillRule" select="substring-after(@style, 'fill-rule:')" />\r
+      <xsl:choose>\r
+        <xsl:when test="contains($FillRule, ';')">\r
+          <xsl:if test="substring-before($FillRule, ';') = 'nonzero' or substring-before($FillRule, ';') = 'evenodd'"><xsl:attribute name="FillRule"><xsl:value-of select="substring-before($FillRule, ';')" /></xsl:attribute></xsl:if>\r
+        </xsl:when>\r
+        <xsl:when test="$FillRule = 'nonzero' or $FillRule = 'evenodd'"><xsl:attribute name="FillRule"><xsl:value-of select="$FillRule" /></xsl:attribute></xsl:when>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="fill_rule" select="parent::*"/></xsl:when>\r
+    <xsl:otherwise><xsl:attribute name="FillRule">NonZero</xsl:attribute></xsl:otherwise>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="template_fill" match="*">\r
+  <xsl:variable name="fill"><xsl:apply-templates mode="fill" select="." /></xsl:variable>\r
+  <xsl:variable name="fill_opacity"><xsl:apply-templates mode="fill_opacity" select="." /></xsl:variable>\r
+  <xsl:if test="not($fill = 'none')">\r
+    <xsl:attribute name="Fill">\r
+      <xsl:choose>\r
+        <xsl:when test="$fill != ''">\r
+          <xsl:call-template name="template_color">\r
+            <xsl:with-param name="colorspec">\r
+              <xsl:if test="$fill != 'none'"><xsl:value-of select="$fill" /></xsl:if>\r
+            </xsl:with-param>\r
+            <xsl:with-param name="opacityspec"><xsl:value-of select="$fill_opacity" /></xsl:with-param>\r
+          </xsl:call-template>\r
+        </xsl:when>\r
+        <xsl:otherwise>#000000</xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+  </xsl:if>   \r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke and starts-with(@stroke, 'url(#')"><xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@stroke, 'url(#'), ')'), '}')" /></xsl:when>\r
+    <xsl:when test="@stroke and @stroke != 'none'"><xsl:value-of select="@stroke" /></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke:') and starts-with(substring-after(@style, 'stroke:'), 'url(#')"><xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@style, 'url(#'), ')'), '}')" /></xsl:when>    \r
+    <xsl:when test="@style and contains(@style, 'stroke:')">\r
+      <xsl:variable name="Stroke" select="substring-after(@style, 'stroke:')" />\r
+      <xsl:choose>\r
+        <xsl:when test="contains($Stroke, ';')">\r
+          <xsl:if test="substring-before($Stroke, ';') != 'none'"><xsl:value-of select="substring-before($Stroke, ';')" /></xsl:if>\r
+        </xsl:when>  \r
+        <xsl:when test="$Stroke != 'none'"><xsl:value-of select="$Stroke" /></xsl:when>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke" select="parent::*"/></xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template mode="stroke_opacity" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-opacity"><xsl:value-of select="@stroke-opacity" /></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-opacity:')">\r
+      <xsl:variable name="Opacity" select="substring-after(@style, 'stroke-opacity:')" />\r
+      <xsl:choose>\r
+        <xsl:when test="contains($Opacity, ';')"><xsl:value-of select="substring-before($Opacity, ';')" /></xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="$Opacity" /></xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_opacity" select="parent::*" /></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="template_stroke" match="*">\r
+  <xsl:variable name="stroke"><xsl:apply-templates mode="stroke" select="." /></xsl:variable>\r
+  <xsl:variable name="stroke_opacity"><xsl:apply-templates mode="stroke_opacity" select="." /></xsl:variable>\r
+  <xsl:if test="$stroke != ''">\r
+    <xsl:attribute name="Stroke">\r
+      <xsl:call-template name="template_color">\r
+        <xsl:with-param name="colorspec"><xsl:value-of select="$stroke" /></xsl:with-param>\r
+        <xsl:with-param name="opacityspec"><xsl:value-of select="$stroke_opacity" /></xsl:with-param>\r
+      </xsl:call-template>  \r
+    </xsl:attribute>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke_width" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-width"><xsl:attribute name="StrokeThickness"><xsl:value-of select="@stroke-width" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-width:')">\r
+      <xsl:variable name="StrokeThickness" select="substring-after(@style, 'stroke-width:')" />\r
+      <xsl:attribute name="StrokeThickness">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($StrokeThickness, ';')"><xsl:value-of select="substring-before($StrokeThickness, ';')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$StrokeThickness" /></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_width" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke_miterlimit" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-miterlimit"><xsl:attribute name="StrokeMiterLimit"><xsl:value-of select="@stroke-miterlimit" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-miterlimit:')">\r
+      <xsl:variable name="StrokeMiterLimit" select="substring-after(@style, 'stroke-miterlimit:')" />\r
+      <xsl:attribute name="StrokeMiterLimit">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($StrokeMiterLimit, ';')"><xsl:value-of select="substring-before($StrokeMiterLimit, ';')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$StrokeMiterLimit" /></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_miterlimit" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke_dasharray" match="*">\r
+  <!-- stroke-dasharray="10,30,20,30" becomes StrokeDashArray="1 3 2 3" ?? -->\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-dasharray and @stroke-dasharray != 'none'"><xsl:attribute name="StrokeDashArray"><xsl:value-of select="@stroke-dasharray" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-dasharray:')">\r
+      <xsl:variable name="StrokeDashArray" select="substring-after(@style, 'stroke-dasharray:')" />\r
+      <xsl:choose>\r
+        <xsl:when test="contains($StrokeDashArray, ';')">\r
+          <xsl:if test="substring-before($StrokeDashArray, ';') != 'none'"><xsl:attribute name="StrokeDashArray"><xsl:value-of select="substring-before($StrokeDashArray, ';')" /></xsl:attribute></xsl:if>\r
+        </xsl:when>\r
+        <xsl:when test="$StrokeDashArray != 'none'"><xsl:attribute name="StrokeDashArray"><xsl:value-of select="$StrokeDashArray" /></xsl:attribute></xsl:when>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_dasharray" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke_dashoffset" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-dashoffset"><xsl:attribute name="StrokeDashOffset"><xsl:value-of select="@stroke-dashoffset" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-dashoffset:')">\r
+      <xsl:variable name="StrokeDashOffset" select="substring-after(@style, 'stroke-dashoffset:')" />\r
+      <xsl:attribute name="StrokeDashOffset">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($StrokeDashOffset, ';')"><xsl:value-of select="substring-before($StrokeDashOffset, ';')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$StrokeDashOffset" /></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_dashoffset" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template name="linejoin_svg_to_xaml">\r
+  <xsl:param name="linejoin" />\r
+  <xsl:choose>\r
+    <xsl:when test="$linejoin = 'bevel'">Bevel</xsl:when>\r
+    <xsl:when test="$linejoin = 'round'">Round</xsl:when>\r
+    <xsl:otherwise>Miter</xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke_linejoin" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-miterlimit">\r
+      <xsl:attribute name="StrokeLineJoin">\r
+        <xsl:call-template name="linejoin_svg_to_xaml"><xsl:with-param name="linejoin"><xsl:value-of select="@stroke-linejoin" /></xsl:with-param></xsl:call-template>\r
+      </xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-linejoin:')">\r
+      <xsl:variable name="StrokeLineJoin" select="substring-after(@style, 'stroke-linejoin:')" />\r
+      <xsl:attribute name="StrokeLineJoin">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($StrokeLineJoin, ';')">\r
+            <xsl:call-template name="linejoin_svg_to_xaml"><xsl:with-param name="linejoin"><xsl:value-of select="substring-before($StrokeLineJoin, ';')" /></xsl:with-param></xsl:call-template>\r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:call-template name="linejoin_svg_to_xaml"><xsl:with-param name="linejoin"><xsl:value-of select="$StrokeLineJoin" /></xsl:with-param></xsl:call-template>\r
+          </xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_linejoin" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template name="linecap_svg_to_xaml">\r
+  <xsl:param name="linecap" />\r
+  <xsl:choose>\r
+    <xsl:when test="$linecap = 'round'">Round</xsl:when>\r
+    <xsl:when test="$linecap = 'square'">Square</xsl:when>\r
+    <xsl:otherwise>Flat</xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="stroke_linecap" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stroke-linecap">\r
+      <xsl:attribute name="StrokeEndLineCap">\r
+        <xsl:call-template name="linecap_svg_to_xaml"><xsl:with-param name="linecap"><xsl:value-of select="@stroke-linecap" /></xsl:with-param></xsl:call-template>\r
+      </xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stroke-linecap:')">\r
+      <xsl:variable name="StrokeEndLineCap" select="substring-after(@style, 'stroke-linecap:')" />\r
+      <xsl:attribute name="StrokeEndLineCap">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($StrokeEndLineCap, ';')">\r
+            <xsl:call-template name="linecap_svg_to_xaml"><xsl:with-param name="linecap"><xsl:value-of select="substring-before($StrokeEndLineCap, ';')" /></xsl:with-param></xsl:call-template>\r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:call-template name="linecap_svg_to_xaml"><xsl:with-param name="linecap"><xsl:value-of select="$StrokeEndLineCap" /></xsl:with-param></xsl:call-template>\r
+          </xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stroke_linecap" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="resources" match="*">\r
+  <!-- should be in-depth -->\r
+  <xsl:if test="ancestor::*[name(.) = 'defs']"><xsl:attribute name="x:Key"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>\r
+</xsl:template>  \r
+\r
+<xsl:template name="to_hex">\r
+  <xsl:param name="convert" />\r
+  <xsl:value-of select="concat(substring('0123456789ABCDEF', 1 + floor(round($convert) div 16), 1), substring('0123456789ABCDEF', 1 + round($convert) mod 16, 1))" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="stop_color" match="*">\r
+  <xsl:variable name="Opacity">\r
+    <xsl:choose>\r
+      <xsl:when test="@stop-opacity"><xsl:value-of select="@stop-opacity" /></xsl:when>\r
+      <xsl:when test="@style and contains(@style, 'stop-opacity:')">\r
+        <xsl:variable name="temp_opacity" select="substring-after(@style, 'stop-opacity:')" />\r
+        <xsl:choose>\r
+          <xsl:when test="contains($temp_opacity, ';')"><xsl:value-of select="substring-before($temp_opacity, ';')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$temp_opacity" /></xsl:otherwise>\r
+        </xsl:choose>          \r
+      </xsl:when>\r
+      <xsl:otherwise><xsl:value-of select="''" /></xsl:otherwise>\r
+    </xsl:choose>\r
+  </xsl:variable>\r
+  <xsl:variable name="hex_opacity">\r
+    <xsl:choose>\r
+      <xsl:when test="$Opacity != ''"><xsl:call-template name="to_hex"><xsl:with-param name="convert"><xsl:value-of select="number($Opacity) * 255" /></xsl:with-param></xsl:call-template>  </xsl:when>  \r
+      <xsl:otherwise><xsl:value-of select="$Opacity" /></xsl:otherwise>\r
+    </xsl:choose>  \r
+  </xsl:variable>\r
+  <xsl:variable name="stopcolor">\r
+    <xsl:choose>\r
+      <xsl:when test="@stop-color">\r
+        <xsl:call-template name="template_color"><xsl:with-param name="colorspec"><xsl:value-of select="@stop-color" /></xsl:with-param></xsl:call-template>  \r
+      </xsl:when>\r
+      <xsl:when test="@style and contains(@style, 'stop-color:')">\r
+        <xsl:variable name="Color" select="substring-after(@style, 'stop-color:')" />\r
+        <xsl:choose>\r
+          <xsl:when test="contains($Color, ';')">\r
+            <xsl:call-template name="template_color"><xsl:with-param name="colorspec"><xsl:value-of select="substring-before($Color, ';')" /></xsl:with-param></xsl:call-template>  \r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:call-template name="template_color"><xsl:with-param name="colorspec"><xsl:value-of select="$Color" /></xsl:with-param></xsl:call-template>  \r
+          </xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:when>\r
+      <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stop_color" select="parent::*"/></xsl:when>\r
+      <xsl:otherwise>#000</xsl:otherwise>\r
+    </xsl:choose>  \r
+  </xsl:variable>\r
+  <xsl:attribute name="Color">\r
+    <xsl:choose>\r
+      <xsl:when test="$hex_opacity != '' and starts-with($stopcolor, '#')"><xsl:value-of select="concat('#', $hex_opacity, substring-after($stopcolor, '#'))" /></xsl:when>\r
+      <xsl:otherwise><xsl:value-of select="$stopcolor" /></xsl:otherwise>\r
+    </xsl:choose>\r
+  </xsl:attribute>\r
+</xsl:template>\r
+\r
+<xsl:template mode="stop_opacity" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@stop-opacity"><xsl:attribute name="Opacity"><xsl:value-of select="@stop-opacity" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'stop-opacity:')">\r
+      <xsl:variable name="Opacity" select="substring-after(@style, 'stop-opacity:')" />\r
+      <xsl:attribute name="Opacity">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($Opacity, ';')"><xsl:value-of select="substring-before($Opacity, ';')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$Opacity" /></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stop_opacity" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="offset" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@offset">\r
+      <xsl:attribute name="Offset">\r
+        <xsl:choose>\r
+          <xsl:when test="contains(@offset, '%')"><xsl:value-of select="number(substring-before(@offset, '%')) div 100" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="@offset" /></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="@style and contains(@style, 'offset:')">\r
+      <xsl:variable name="Offset" select="substring-after(@style, 'offset:')" />\r
+      <xsl:attribute name="Offset">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($Offset, '%')"><xsl:value-of select="number(substring-before($Offset, '%')) div 100" /></xsl:when>        \r
+          <xsl:when test="contains($Offset, ';')"><xsl:value-of select="substring-before($Offset, ';')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$Offset" /></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = 'g' or name(..) = 'svg'"><xsl:apply-templates mode="stop_offset" select="parent::*"/></xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template name="parse_transform">\r
+  <xsl:param name="input" />\r
+  <xsl:choose>\r
+    <xsl:when test="starts-with($input, 'matrix(')">\r
+      <MatrixTransform><xsl:attribute name="Matrix"><xsl:value-of select="substring-before(substring-after($input, 'matrix('), ')')" /></xsl:attribute></MatrixTransform>\r
+      <xsl:call-template name="parse_transform"><xsl:with-param name="input" select="substring-after($input, ') ')" /></xsl:call-template>      \r
+    </xsl:when>\r
+    <xsl:when test="starts-with($input, 'scale(')">\r
+      <ScaleTransform>\r
+        <xsl:variable name="scale" select="substring-before(substring-after($input, 'scale('), ')')" />\r
+        <xsl:choose>\r
+          <xsl:when test="contains($scale, ',')">\r
+            <xsl:attribute name="ScaleX"><xsl:value-of select="substring-before($scale, ',')" /></xsl:attribute>\r
+            <xsl:attribute name="ScaleY"><xsl:value-of select="substring-after($scale, ',')" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:attribute name="ScaleX"><xsl:value-of select="$scale" /></xsl:attribute>\r
+            <xsl:attribute name="ScaleY"><xsl:value-of select="$scale" /></xsl:attribute>\r
+          </xsl:otherwise>\r
+        </xsl:choose>  \r
+      </ScaleTransform>\r
+      <xsl:call-template name="parse_transform"><xsl:with-param name="input" select="substring-after($input, ') ')" /></xsl:call-template>\r
+    </xsl:when>\r
+    <xsl:when test="starts-with($input, 'rotate(')">\r
+      <RotateTransform>\r
+        <xsl:attribute name="Angle"><xsl:value-of select="substring-before(substring-after($input, 'rotate('), ')')" /></xsl:attribute>\r
+        <xsl:if test="@rx"><xsl:attribute name="CenterX"><xsl:value-of select="@rx" /></xsl:attribute></xsl:if>\r
+        <xsl:if test="@ry"><xsl:attribute name="CenterY"><xsl:value-of select="@ry" /></xsl:attribute></xsl:if>\r
+      </RotateTransform>\r
+      <xsl:call-template name="parse_transform"><xsl:with-param name="input" select="substring-after($input, ') ')" /></xsl:call-template>\r
+    </xsl:when>\r
+    <xsl:when test="starts-with($input, 'skewX(')">\r
+      <SkewTransform>\r
+        <xsl:attribute name="AngleX"><xsl:value-of select="substring-before(substring-after($input, 'skewX('), ')')" /></xsl:attribute>\r
+        <xsl:call-template name="parse_transform"><xsl:with-param name="input" select="substring-after($input, ') ')" /></xsl:call-template>\r
+      </SkewTransform>\r
+    </xsl:when>\r
+    <xsl:when test="starts-with($input, 'skewY(')">\r
+      <SkewTransform>\r
+        <xsl:attribute name="AngleY"><xsl:value-of select="substring-before(substring-after($input, 'skewY('), ')')" /></xsl:attribute>\r
+        <xsl:call-template name="parse_transform"><xsl:with-param name="input" select="substring-after($input, ') ')" /></xsl:call-template>\r
+      </SkewTransform>\r
+    </xsl:when>\r
+    <xsl:when test="starts-with($input, 'translate(')">\r
+      <TranslateTransform>\r
+        <xsl:variable name="translate" select="substring-before(substring-after($input, 'translate('), ')')" />\r
+        <xsl:choose>\r
+          <xsl:when test="contains($translate, ',')">\r
+            <xsl:attribute name="X"><xsl:value-of select="substring-before($translate, ',')" /></xsl:attribute>\r
+            <xsl:attribute name="Y"><xsl:value-of select="substring-after($translate, ',')" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:when test="contains($translate, ' ')">\r
+            <xsl:attribute name="X"><xsl:value-of select="substring-before($translate, ' ')" /></xsl:attribute>\r
+            <xsl:attribute name="Y"><xsl:value-of select="substring-after($translate, ' ')" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:attribute name="X"><xsl:value-of select="$translate" /></xsl:attribute></xsl:otherwise>\r
+        </xsl:choose>  \r
+      </TranslateTransform>\r
+      <xsl:call-template name="parse_transform"><xsl:with-param name="input" select="substring-after($input, ') ')" /></xsl:call-template>\r
+    </xsl:when>  \r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="transform" match="*[@transform or @gradientTransform]">\r
+  <xsl:param name="mapped_type" />\r
+  <xsl:variable name="transform">\r
+    <xsl:choose>\r
+       <xsl:when test="@transform"><xsl:value-of select="@transform" /></xsl:when>\r
+       <xsl:otherwise><xsl:value-of select="@gradientTransform" /></xsl:otherwise>\r
+    </xsl:choose>\r
+  </xsl:variable>\r
+  <xsl:variable name="transform_nodes">\r
+    <xsl:call-template name="parse_transform">\r
+      <xsl:with-param name="input" select="$transform" />\r
+    </xsl:call-template>\r
+  </xsl:variable>\r
+  \r
+  <xsl:comment>\r
+    <xsl:value-of select="name(.)" />\r
+  </xsl:comment>\r
+\r
+  <xsl:choose>\r
+    <xsl:when test="system-property('xsl:vendor') = 'Microsoft' and $mapped_type and $mapped_type != ''">\r
+      <xsl:element name="{$mapped_type}.RenderTransform">\r
+        <xsl:choose>\r
+          <xsl:when test="count(msxsl:node-set($transform_nodes)/*) = 1"><xsl:copy-of select="msxsl:node-set($transform_nodes)" /></xsl:when>\r
+          <xsl:when test="count(msxsl:node-set($transform_nodes)/*) &gt; 1"><TransformGroup><xsl:copy-of select="msxsl:node-set($transform_nodes)" /></TransformGroup></xsl:when>\r
+        </xsl:choose>  \r
+      </xsl:element>\r
+    </xsl:when>\r
+    <xsl:when test="system-property('xsl:vendor') = 'Microsoft'">\r
+      <!-- For instance LinearGradient.Transform -->\r
+      <xsl:choose>\r
+        <xsl:when test="count(msxsl:node-set($transform_nodes)/*) = 1"><xsl:copy-of select="msxsl:node-set($transform_nodes)" /></xsl:when>\r
+        <xsl:when test="count(msxsl:node-set($transform_nodes)/*) &gt; 1"><TransformGroup><xsl:copy-of select="msxsl:node-set($transform_nodes)" /></TransformGroup></xsl:when>\r
+      </xsl:choose>  \r
+    </xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template mode="clip" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@clip-path and defs/clipPath/path/@d"><xsl:attribute name="Clip"><xsl:value-of select="defs/clipPath/path/@d" /></xsl:attribute></xsl:when>  \r
+    <xsl:when test="@clip-path and starts-with(@clip-path, 'url(#')"><xsl:attribute name="Clip"><xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@clip-path, 'url(#'), ')'), '}')" /></xsl:attribute></xsl:when>  \r
+    <xsl:when test="@style and contains(@style, 'clip-path:url(#')"><xsl:attribute name="Clip"><xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@style, 'url(#'), ')'), '}')" /></xsl:attribute></xsl:when>  \r
+    <xsl:when test="clipPath"><xsl:apply-templates mode="forward" /></xsl:when>  \r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="id" match="*">\r
+<xsl:if test="@id">\r
+  <xsl:attribute name="Name"><xsl:value-of select="translate(@id, '- ', '')" /></xsl:attribute>\r
+  <!--\r
+    <xsl:attribute name="x:Key"><xsl:value-of select="translate(@id, '- ', '')" /></xsl:attribute>\r
+  -->\r
+</xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template match="/">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <xsl:choose>\r
+    <xsl:when test="$silverlight_compatible = 1">\r
+      <xsl:apply-templates mode="forward" />\r
+    </xsl:when>\r
+    <xsl:otherwise>\r
+      <Viewbox Stretch="Uniform">\r
+        <xsl:apply-templates mode="forward" />\r
+      </Viewbox>\r
+    </xsl:otherwise>   \r
+  </xsl:choose>   \r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="defs">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'svg' or name(.) = 'g']">\r
+  <xsl:choose>\r
+    <xsl:when test="name(.) = 'svg' or @transform or @viewBox or @id or @clip-path or (@style and contains(@style, 'clip-path:url(#')) or (@width and not(contains(@width, '%'))) or @x or @y or (@height and not(contains(@height, '%'))) or *[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath']">\r
+      <Canvas>\r
+        <xsl:apply-templates mode="id" select="." />\r
+        <!--\r
+        <xsl:apply-templates mode="clip" select="." />\r
+        -->\r
+        <xsl:if test="@width and not(contains(@width, '%'))"><xsl:attribute name="Width"><xsl:value-of select="@width" /></xsl:attribute></xsl:if>\r
+        <xsl:if test="@height and not(contains(@height, '%'))"><xsl:attribute name="Height"><xsl:value-of select="@height" /></xsl:attribute></xsl:if>    \r
+        <xsl:if test="@x"><xsl:attribute name="Canvas.Left"><xsl:value-of select="@x" /></xsl:attribute></xsl:if>\r
+        <xsl:if test="@y"><xsl:attribute name="Canvas.Top"><xsl:value-of select="@y" /></xsl:attribute></xsl:if>    \r
+        <xsl:if test="@viewBox">\r
+          <xsl:variable name="viewBox"><xsl:value-of select="normalize-space(translate(@viewBox, ',', ' '))" /></xsl:variable>\r
+          <xsl:attribute name="Width"><xsl:value-of select="substring-before(substring-after(substring-after($viewBox, ' '), ' '), ' ')" /></xsl:attribute>\r
+          <xsl:attribute name="Height"><xsl:value-of select="substring-after(substring-after(substring-after($viewBox, ' '), ' '), ' ')" /></xsl:attribute>\r
+          <Canvas.RenderTransform>\r
+            <TranslateTransform>\r
+              <xsl:attribute name="X"><xsl:value-of select="-number(substring-before($viewBox, ' '))" /></xsl:attribute>\r
+              <xsl:attribute name="Y"><xsl:value-of select="-number(substring-before(substring-after($viewBox, ' '), ' '))" /></xsl:attribute>\r
+            </TranslateTransform>\r
+          </Canvas.RenderTransform><xsl:text>&#13;</xsl:text>\r
+        </xsl:if>\r
+    <xsl:if test="@transform">\r
+      <Canvas>\r
+        <Canvas.RenderTransform>\r
+          <TransformGroup><xsl:apply-templates mode="transform" select="." /></TransformGroup>\r
+        </Canvas.RenderTransform>\r
+        <xsl:apply-templates mode="forward" select="*" />\r
+      </Canvas><xsl:text>&#13;</xsl:text>\r
+    </xsl:if>\r
+\r
+        <xsl:if test="*[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath']">\r
+          <xsl:text>&#13;</xsl:text>\r
+          <Canvas.Resources>\r
+            <xsl:apply-templates mode="forward" select="*[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath']" />\r
+          </Canvas.Resources>\r
+        </xsl:if>\r
+        <xsl:if test="not(@transform)">\r
+          <xsl:apply-templates mode="forward" select="*[name(.) != 'linearGradient' and name(.) != 'radialGradient' and name(.) != 'defs' and name(.) != 'clipPath']" />\r
+        </xsl:if>  \r
+      </Canvas><xsl:text>&#13;</xsl:text>\r
+    </xsl:when>\r
+    <xsl:when test="not(@transform)">\r
+      <xsl:apply-templates mode="forward" select="*" />\r
+    </xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="transform2" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="@transform">\r
+      <Canvas>\r
+        <Canvas.RenderTransform>\r
+          <TransformGroup><xsl:apply-templates mode="transform" select="." /></TransformGroup>\r
+        </Canvas.RenderTransform>\r
+        <xsl:apply-templates mode="forward" select="." />\r
+      </Canvas><xsl:text>&#13;</xsl:text>\r
+    </xsl:when>\r
+    <xsl:otherwise>\r
+      <xsl:apply-templates mode="forward" select="." />\r
+    </xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'image']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Image>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="clip" select="." />\r
+    <xsl:if test="@xlink:href"><xsl:attribute name="Source"><xsl:value-of select="@xlink:href" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@width"><xsl:attribute name="Width"><xsl:value-of select="@width" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@height"><xsl:attribute name="Height"><xsl:value-of select="@height" /></xsl:attribute></xsl:if>\r
+    <!--xsl:apply-templates mode="transform" /-->\r
+    <xsl:apply-templates mode="forward" />\r
+  </Image><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'text']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <TextBlock>\r
+    <xsl:if test="@font-size"><xsl:attribute name="FontSize"><xsl:value-of select="@font-size" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@style and contains(@style, 'font-size:')">\r
+      <xsl:variable name="font_size" select="substring-after(@style, 'font-size:')" />\r
+      <xsl:attribute name="FontSize">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($font_size, ';')">\r
+            <xsl:value-of select="substring-before($font_size, ';')" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$font_size" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </xsl:attribute>  \r
+    </xsl:if>\r
+    <xsl:if test="@font-weight"><xsl:attribute name="FontWeight"><xsl:value-of select="@font-weight" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@style and contains(@style, 'font-weight:')">\r
+      <xsl:variable name="font_weight" select="substring-after(@style, 'font-weight:')" />\r
+      <xsl:attribute name="FontWeight">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($font_weight, ';')">\r
+            <xsl:value-of select="substring-before($font_weight, ';')" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$font_weight" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </xsl:attribute>  \r
+    </xsl:if>\r
+    <xsl:if test="@font-family"><xsl:attribute name="FontFamily"><xsl:value-of select="@font-family" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@style and contains(@style, 'font-family:')">\r
+      <xsl:variable name="font_family" select="substring-after(@style, 'font-family:')" />\r
+      <xsl:attribute name="FontFamily">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($font_family, ';')">\r
+            <xsl:value-of select="substring-before($font_family, ';')" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$font_family" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </xsl:attribute>  \r
+    </xsl:if>\r
+    <xsl:if test="@font-style"><xsl:attribute name="FontStyle"><xsl:value-of select="@font-style" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@style and contains(@style, 'font-style:')">\r
+      <xsl:variable name="font_style" select="substring-after(@style, 'font-style:')" />\r
+      <xsl:attribute name="FontStyle">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($font_style, ';')">\r
+            <xsl:value-of select="substring-before($font_style, ';')" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$font_style" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </xsl:attribute>  \r
+    </xsl:if>\r
+    <xsl:if test="@fill"><xsl:attribute name="Foreground"><xsl:value-of select="@fill" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@style and contains(@style, 'fill')">\r
+      <xsl:variable name="fill" select="substring-after(@style, 'fill:')" />\r
+      <xsl:attribute name="Foreground">\r
+        <xsl:choose>\r
+          <xsl:when test="contains($fill, ';')">\r
+            <xsl:value-of select="substring-before($fill, ';')" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="$fill" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </xsl:attribute>  \r
+    </xsl:if>\r
+    <xsl:if test="@text-anchor">\r
+      <xsl:attribute name="HorizontalAlignment">\r
+        <xsl:choose>\r
+          <xsl:when test="@text-anchor = 'start'">Left</xsl:when>\r
+          <xsl:when test="@text-anchor = 'middle'">Center</xsl:when>\r
+          <xsl:when test="@text-anchor = 'end'">Right</xsl:when>\r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:if test="@width"><xsl:attribute name="Width"><xsl:value-of select="@width" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@height"><xsl:attribute name="Height"><xsl:value-of select="@height" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@x"><xsl:attribute name="Canvas.Left"><xsl:value-of select="@x" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@y"><xsl:attribute name="Canvas.Top"><xsl:value-of select="@y" /></xsl:attribute></xsl:if>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="clip" select="." />\r
+    <!--xsl:apply-templates mode="transform" select="." /-->\r
+    <!--xsl:apply-templates mode="forward" /-->\r
+    <xsl:if test="text()"><xsl:value-of select="text()" /></xsl:if>\r
+    <xsl:if test="*[name(.) = 'tspan']/text()"><xsl:value-of select="*[name(.) = 'tspan']/text()" /></xsl:if>\r
+  </TextBlock><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'title' or name(.) = 'desc']">\r
+  <!-- -->\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'marker' or name(.) = 'pattern' or name(.) = 'style']">\r
+  <!-- -->\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'symbol']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Style>\r
+    <xsl:if test="@id"><xsl:attribute name="x:Key"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>\r
+    <xsl:text>&#13;</xsl:text>\r
+    <Canvas>\r
+      <xsl:apply-templates mode="forward" />\r
+    </Canvas><xsl:text>&#13;</xsl:text>\r
+  </Style><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'use']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Canvas>\r
+    <xsl:if test="@xlink:href"><xsl:attribute name="Style"><xsl:value-of select="@xlink:href" /></xsl:attribute></xsl:if>\r
+    <!--xsl:apply-templates mode="transform" select="." /-->\r
+    <xsl:apply-templates mode="forward" />\r
+  </Canvas><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="rdf:RDF | *[name(.) = 'foreignObject']">\r
+  <!-- -->\r
+</xsl:template>\r
+\r
+<xsl:template match="*">\r
+<xsl:comment><xsl:value-of select="concat('Unknown tag: ', name(.))" /></xsl:comment>\r
+</xsl:template>\r
+\r
+<!-- BRUSHES -->\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'linearGradient']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <LinearGradientBrush>\r
+    <xsl:if test="@id"><xsl:attribute name="x:Key"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>\r
+    <xsl:attribute name="MappingMode">\r
+      <xsl:choose>\r
+        <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">Absolute</xsl:when>\r
+        <xsl:otherwise>RelativeToBoundingBox</xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:if test="@spreadMethod">\r
+      <xsl:attribute name="SpreadMethod">\r
+        <xsl:choose>\r
+          <xsl:when test="@spreadMethod = 'pad'">Pad</xsl:when>\r
+          <xsl:when test="@spreadMethod = 'reflect'">Reflect</xsl:when>\r
+          <xsl:when test="@spreadMethod = 'repeat'">Repeat</xsl:when>\r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:choose>\r
+      <xsl:when test="@x1 and @y1 and @x2 and @y2">\r
+        <xsl:choose>\r
+          <xsl:when test="contains(@x1, '%') and contains(@y1, '%')">\r
+            <xsl:attribute name="StartPoint"><xsl:value-of select="concat(substring-before(@x1, '%') div 100, ',', substring-before(@y1,'%') div 100)" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:attribute name="StartPoint"><xsl:value-of select="concat(@x1, ',', @y1)" /></xsl:attribute>\r
+          </xsl:otherwise>\r
+        </xsl:choose>  \r
+        <xsl:choose>\r
+          <xsl:when test="contains(@x2, '%') and contains(@y2, '%')">\r
+            <xsl:attribute name="EndPoint"><xsl:value-of select="concat(substring-before(@x2, '%') div 100, ',', substring-before(@y2,'%') div 100)" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:attribute name="EndPoint"><xsl:value-of select="concat(@x2, ',', @y2)" /></xsl:attribute>\r
+          </xsl:otherwise>\r
+        </xsl:choose>  \r
+      </xsl:when>\r
+      <xsl:otherwise>\r
+        <xsl:attribute name="StartPoint"><xsl:value-of select="'0,0'" /></xsl:attribute>\r
+        <xsl:attribute name="EndPoint"><xsl:value-of select="'1,1'" /></xsl:attribute>\r
+      </xsl:otherwise>\r
+    </xsl:choose>\r
+    <LinearGradientBrush.GradientStops>\r
+      <xsl:text>&#13;</xsl:text>\r
+      <GradientStopCollection>\r
+        <xsl:choose>\r
+          <xsl:when test="@xlink:href">\r
+            <xsl:variable name="reference_id" select="@xlink:href" />\r
+            <xsl:apply-templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:apply-templates mode="forward" /></xsl:otherwise>  \r
+        </xsl:choose>  \r
+      </GradientStopCollection>\r
+    </LinearGradientBrush.GradientStops><xsl:text>&#13;</xsl:text>\r
+    <xsl:if test="@gradientTransform">\r
+    <LinearGradientBrush.Transform>\r
+      <xsl:apply-templates mode="transform" select="." />\r
+    </LinearGradientBrush.Transform>\r
+  </xsl:if>  \r
+  </LinearGradientBrush><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'radialGradient']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <RadialGradientBrush>\r
+    <xsl:if test="@id"><xsl:attribute name="x:Key"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>\r
+    <xsl:attribute name="MappingMode">\r
+      <xsl:choose>\r
+        <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">Absolute</xsl:when>\r
+        <xsl:otherwise>RelativeToBoundingBox</xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:if test="@spreadMethod">\r
+      <xsl:attribute name="SpreadMethod">\r
+        <xsl:choose>\r
+          <xsl:when test="@spreadMethod = 'pad'">Pad</xsl:when>\r
+          <xsl:when test="@spreadMethod = 'reflect'">Reflect</xsl:when>\r
+          <xsl:when test="@spreadMethod = 'repeat'">Repeat</xsl:when>\r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:if test="@cx and @cy">\r
+      <xsl:attribute name="Center">\r
+        <xsl:choose>\r
+          <xsl:when test="contains(@cx, '%') and contains(@cy, '%')">\r
+            <xsl:value-of select="concat(number(substring-before(@cx, '%')) div 100, ',', number(substring-before(@cy, '%')) div 100)" />\r
+          </xsl:when>  \r
+          <xsl:otherwise>\r
+            <xsl:value-of select="concat(@cx, ',', @cy)" />\r
+          </xsl:otherwise>  \r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>  \r
+    <xsl:if test="@fx and @fy">\r
+      <xsl:attribute name="GradientOrigin">\r
+        <xsl:choose>\r
+          <xsl:when test="contains(@fx, '%') and contains(@fy, '%')">\r
+            <xsl:value-of select="concat(number(substring-before(@fx, '%')) div 100, ',', number(substring-before(@fy, '%')) div 100)" />\r
+          </xsl:when>  \r
+          <xsl:otherwise>\r
+            <xsl:value-of select="concat(@fx, ',', @fy)" />\r
+          </xsl:otherwise>  \r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>  \r
+    <xsl:if test="@r">\r
+      <xsl:choose>\r
+        <xsl:when test="contains(@r, '%')">\r
+          <xsl:attribute name="RadiusX"><xsl:value-of select="number(substring-before(@r, '%')) div 100" /></xsl:attribute>\r
+          <xsl:attribute name="RadiusY"><xsl:value-of select="number(substring-before(@r, '%')) div 100" /></xsl:attribute>\r
+        </xsl:when>  \r
+        <xsl:otherwise>\r
+          <xsl:attribute name="RadiusX"><xsl:value-of select="@r" /></xsl:attribute>\r
+          <xsl:attribute name="RadiusY"><xsl:value-of select="@r" /></xsl:attribute>\r
+        </xsl:otherwise>  \r
+      </xsl:choose>\r
+    </xsl:if>  \r
+    <RadialGradientBrush.GradientStops>\r
+      <GradientStopCollection>\r
+        <xsl:choose>\r
+          <xsl:when test="@xlink:href">\r
+            <xsl:variable name="reference_id" select="@xlink:href" />\r
+            <xsl:apply-templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />\r
+          </xsl:when>\r
+          <xsl:otherwise><xsl:apply-templates mode="forward" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </GradientStopCollection><xsl:text>&#13;</xsl:text>\r
+    </RadialGradientBrush.GradientStops><xsl:text>&#13;</xsl:text>\r
+    <xsl:if test="@gradientTransform">\r
+    <RadialGradientBrush.Transform>\r
+      <xsl:apply-templates mode="transform" select="." />\r
+    </RadialGradientBrush.Transform>\r
+    </xsl:if>  \r
+  </RadialGradientBrush><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'stop']">\r
+  <GradientStop>\r
+    <!--xsl:apply-templates mode="stop_opacity" select="." /-->\r
+    <xsl:apply-templates mode="stop_color" select="." />\r
+    <xsl:apply-templates mode="offset" select="." />\r
+    <xsl:apply-templates mode="forward" />\r
+  </GradientStop><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<!-- SHAPES -->\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'line']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Line>\r
+    <xsl:if test="@x1"><xsl:attribute name="X1"><xsl:value-of select="@x1" /></xsl:attribute></xsl:if> \r
+    <xsl:if test="@y1"><xsl:attribute name="Y1"><xsl:value-of select="@y1" /></xsl:attribute></xsl:if> \r
+    <xsl:if test="@x2"><xsl:attribute name="X2"><xsl:value-of select="@x2" /></xsl:attribute></xsl:if> \r
+    <xsl:if test="@y2"><xsl:attribute name="Y2"><xsl:value-of select="@y2" /></xsl:attribute></xsl:if>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Line'" />\r
+    </xsl:apply-templates>    \r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Line><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'rect']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Rectangle>\r
+    <xsl:if test="@x"><xsl:attribute name="Canvas.Left"><xsl:value-of select="@x" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@y"><xsl:attribute name="Canvas.Top"><xsl:value-of select="@y" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@width"><xsl:attribute name="Width"><xsl:value-of select="@width" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@height"><xsl:attribute name="Height"><xsl:value-of select="@height" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@rx"><xsl:attribute name="RadiusX"><xsl:value-of select="@rx" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@ry"><xsl:attribute name="RadiusY"><xsl:value-of select="@ry" /></xsl:attribute></xsl:if>  \r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    \r
+    <xsl:apply-templates mode="resources" select="." />\r
+    \r
+    <xsl:apply-templates mode="clip" select="." />\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Rectangle'" />\r
+    </xsl:apply-templates>    \r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Rectangle><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'polygon']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Polygon>\r
+    <xsl:if test="@points"><xsl:attribute name="Points"><xsl:value-of select="@points" /></xsl:attribute></xsl:if>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="fill_rule" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Polygon'" />\r
+    </xsl:apply-templates>    \r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Polygon><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'polyline']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Polyline>\r
+    <xsl:if test="@points"><xsl:attribute name="Points"><xsl:value-of select="@points" /></xsl:attribute></xsl:if>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="fill_rule" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Polyline'" />\r
+    </xsl:apply-templates>    \r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Polyline><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'path']">\r
+  <Path>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    <xsl:if test="@d">\r
+      <xsl:choose>\r
+        <xsl:when test="$silverlight_compatible = 1">\r
+          <xsl:attribute name="Data">\r
+           <xsl:value-of select="translate(@d , ',', ' ')" />\r
+          </xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:otherwise>\r
+          <Path.Data>\r
+            <PathGeometry>\r
+              <xsl:attribute name="Figures">\r
+                <xsl:value-of select="translate(@d , ',', ' ')" />\r
+              </xsl:attribute>\r
+              <xsl:apply-templates mode="fill_rule" select="." />\r
+            </PathGeometry>  \r
+          </Path.Data>\r
+         </xsl:otherwise>   \r
+      </xsl:choose>   \r
+    </xsl:if>\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Path'" />\r
+    </xsl:apply-templates>\r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Path><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'ellipse']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Ellipse>\r
+    <xsl:variable name="cx">\r
+      <xsl:choose>\r
+        <xsl:when test="@cx"><xsl:value-of select="@cx" /></xsl:when>\r
+        <xsl:otherwise>0</xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:variable>\r
+    <xsl:variable name="cy">\r
+      <xsl:choose>\r
+        <xsl:when test="@cy"><xsl:value-of select="@cy" /></xsl:when>\r
+        <xsl:otherwise>0</xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:variable>\r
+    <xsl:if test="@rx">\r
+      <xsl:attribute name="Canvas.Left"><xsl:value-of select="$cx - @rx" /></xsl:attribute>\r
+      <xsl:attribute name="Width"><xsl:value-of select="2 * @rx" /></xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:if test="@ry">\r
+      <xsl:attribute name="Canvas.Top"><xsl:value-of select="$cy - @ry" /></xsl:attribute>\r
+      <xsl:attribute name="Height"><xsl:value-of select="2 * @ry" /></xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    \r
+    <xsl:apply-templates mode="clip" select="." />\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Ellipse'" />\r
+    </xsl:apply-templates>\r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Ellipse><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'circle']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <Ellipse>\r
+    <xsl:variable name="cx">\r
+      <xsl:choose>\r
+        <xsl:when test="@cx"><xsl:value-of select="@cx" /></xsl:when>\r
+        <xsl:otherwise>0</xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:variable>\r
+    <xsl:variable name="cy">\r
+      <xsl:choose>\r
+        <xsl:when test="@cy"><xsl:value-of select="@cy" /></xsl:when>\r
+        <xsl:otherwise>0</xsl:otherwise>\r
+      </xsl:choose>  \r
+    </xsl:variable>\r
+    <xsl:if test="@r">\r
+      <xsl:attribute name="Canvas.Left"><xsl:value-of select="$cx - @r" /></xsl:attribute>\r
+      <xsl:attribute name="Canvas.Top"><xsl:value-of select="$cy - @r" /></xsl:attribute>\r
+      <xsl:attribute name="Width"><xsl:value-of select="2 * @r" /></xsl:attribute>\r
+      <xsl:attribute name="Height"><xsl:value-of select="2 * @r" /></xsl:attribute>      \r
+    </xsl:if>\r
+    <xsl:apply-templates mode="id" select="." />\r
+    <xsl:apply-templates mode="template_fill" select="." />\r
+    <xsl:apply-templates mode="template_stroke" select="." />\r
+    <xsl:apply-templates mode="stroke_width" select="." />\r
+    <xsl:apply-templates mode="stroke_miterlimit" select="." />\r
+    <xsl:apply-templates mode="stroke_dasharray" select="." />\r
+    <xsl:apply-templates mode="stroke_dashoffset" select="." />\r
+    <xsl:apply-templates mode="stroke_linejoin" select="." />\r
+    <xsl:apply-templates mode="stroke_linecap" select="." />\r
+    \r
+    <xsl:apply-templates mode="clip" select="." />\r
+    \r
+    <xsl:apply-templates mode="transform" select=".">\r
+      <xsl:with-param name="mapped_type" select="'Ellipse'" />\r
+    </xsl:apply-templates>\r
+    \r
+    <xsl:apply-templates mode="forward" />\r
+  </Ellipse><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'clipPath']">\r
+  <xsl:apply-templates mode="geometry" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="geometry" match="*[name(.) = 'circle']">\r
+  <EllipseGeometry>\r
+    <xsl:if test="../@id"><xsl:attribute name="x:Key"><xsl:value-of select="../@id" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@cx and @cy"><xsl:attribute name="Center"><xsl:value-of select="concat(@cx, ',', @cy)" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@r">\r
+      <xsl:attribute name="RadiusX"><xsl:value-of select="@r" /></xsl:attribute>\r
+      <xsl:attribute name="RadiusY"><xsl:value-of select="@r" /></xsl:attribute>\r
+    </xsl:if>\r
+  </EllipseGeometry>\r
+</xsl:template>\r
+\r
+<xsl:template mode="geometry" match="*[name(.) = 'rect']">\r
+  <RectangleGeometry>\r
+    <xsl:if test="../@id"><xsl:attribute name="x:Key"><xsl:value-of select="../@id" /></xsl:attribute></xsl:if>  \r
+    <!--\r
+    <xsl:if test="@x"><xsl:attribute name="Canvas.Left"><xsl:value-of select="@x" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@y"><xsl:attribute name="Canvas.Top"><xsl:value-of select="@y" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@width"><xsl:attribute name="Width"><xsl:value-of select="@width" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@height"><xsl:attribute name="Height"><xsl:value-of select="@height" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@rx"><xsl:attribute name="RadiusX"><xsl:value-of select="@rx" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@ry"><xsl:attribute name="RadiusY"><xsl:value-of select="@ry" /></xsl:attribute></xsl:if>  \r
+    -->\r
+    <xsl:attribute name="Rect"><xsl:value-of select="concat('0, 0, ', @width, ', ', @height)" /></xsl:attribute>\r
+  </RectangleGeometry>\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg.inx b/share/extensions/xaml2svg.inx
new file mode 100644 (file)
index 0000000..36b8cf4
--- /dev/null
@@ -0,0 +1,13 @@
+<inkscape-extension>
+    <_name>XAML Input</_name>
+    <id>org.inkscape.input.xaml</id>
+    <input>
+        <extension>.xaml</extension>
+        <mimetype>text/xml+xaml</mimetype>
+        <_filetypename>Microsoft XAML (*.xaml)</_filetypename>
+        <_filetypetooltip>Microsoft's GUI definition format</_filetypetooltip>
+    </input>
+    <xslt>
+        <file reldir="extensions">xaml2svg.xsl</file>
+    </xslt>
+</inkscape-extension>
diff --git a/share/extensions/xaml2svg.xsl b/share/extensions/xaml2svg.xsl
new file mode 100644 (file)
index 0000000..902f16e
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0"\r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+xmlns:msxsl="urn:schemas-microsoft-com:xslt">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="UTF-8"/>\r
+<xsl:include href="xaml2svg/animation.xsl" />\r
+<xsl:include href="xaml2svg/brushes.xsl" />\r
+<xsl:include href="xaml2svg/canvas.xsl" />\r
+<xsl:include href="xaml2svg/geometry.xsl" />\r
+<xsl:include href="xaml2svg/properties.xsl" />\r
+<xsl:include href="xaml2svg/shapes.xsl" />\r
+<xsl:include href="xaml2svg/transform.xsl" />\r
+\r
+<xsl:template match="/">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <svg>\r
+    <xsl:attribute name="overflow">visible</xsl:attribute>\r
+    <xsl:variable name="viewBox"><xsl:apply-templates mode="boundingbox" /></xsl:variable>\r
+    <xsl:if test="system-property('xsl:vendor') = 'Microsoft'">\r
+      <xsl:attribute name="viewBox">\r
+        <xsl:value-of select="concat(msxsl:node-set($viewBox)/boundingbox/@x1, ' ')" />\r
+        <xsl:value-of select="concat(msxsl:node-set($viewBox)/boundingbox/@y1, ' ')" />\r
+        <xsl:value-of select="concat(msxsl:node-set($viewBox)/boundingbox/@x2 - msxsl:node-set($viewBox)/boundingbox/@x1, ' ')" />\r
+        <xsl:value-of select="msxsl:node-set($viewBox)/boundingbox/@y2 - msxsl:node-set($viewBox)/boundingbox/@y1" />\r
+      </xsl:attribute>\r
+    </xsl:if>  \r
+    <xsl:apply-templates mode="svg" />\r
+  </svg><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Image']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <xsl:if test="@Canvas.Left or @Canvas.Top"><xsl:value-of disable-output-escaping="yes" select="concat('&lt;svg x=&quot;', @Canvas.Left, '&quot; y=&quot;', @Canvas.Top, '&quot;&gt;')" /></xsl:if>\r
+  <image>\r
+    <xsl:if test="@Source"><xsl:attribute name="xlink:href"><xsl:value-of select="@Source" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>\r
+    <xsl:call-template name="template_properties" />\r
+    <xsl:call-template name="template_transform" />\r
+    <xsl:apply-templates mode="forward" />\r
+  </image><xsl:text>&#13;</xsl:text>\r
+  <xsl:if test="@Canvas.Left or @Canvas.Top"><xsl:value-of disable-output-escaping="yes" select="'&lt;/svg&gt;&#13;'" /></xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'TextBlock']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <xsl:if test="@Canvas.Left or @Canvas.Top"><xsl:value-of disable-output-escaping="yes" select="concat('&lt;svg x=&quot;', @Canvas.Left, '&quot; y=&quot;', @Canvas.Top, '&quot;&gt;')" /></xsl:if>\r
+  <text>\r
+    <xsl:if test="@FontSize"><xsl:attribute name="font-size"><xsl:value-of select="@FontSize" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@FontWeight"><xsl:attribute name="font-weight"><xsl:value-of select="@FontWeight" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@FontFamily"><xsl:attribute name="font-family"><xsl:value-of select="@FontFamily" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@FontStyle"><xsl:attribute name="font-style"><xsl:value-of select="@FontStyle" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Foreground"><xsl:attribute name="fill"><xsl:value-of select="@Foreground" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@HorizontalAlignment">\r
+      <xsl:attribute name="text-anchor">\r
+        <xsl:choose>\r
+          <xsl:when test="@HorizontalAlignment = 'Left'">start</xsl:when>\r
+          <xsl:when test="@HorizontalAlignment = 'Center'">middle</xsl:when>\r
+          <xsl:when test="@HorizontalAlignment = 'Right'">end</xsl:when>\r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:attribute name="dominant-baseline">hanging</xsl:attribute>\r
+    <xsl:call-template name="template_properties" />\r
+    <xsl:call-template name="template_transform" />\r
+    <xsl:apply-templates />\r
+  </text><xsl:text>&#13;</xsl:text>\r
+  <xsl:if test="@Canvas.Left or @Canvas.Top"><xsl:value-of disable-output-escaping="yes" select="'&lt;/svg&gt;&#13;'" /></xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template match="*">\r
+<xsl:comment><xsl:value-of select="concat('Unknown tag: ', name(.))" /></xsl:comment>\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg/Makefile.am b/share/extensions/xaml2svg/Makefile.am
new file mode 100644 (file)
index 0000000..89a901f
--- /dev/null
@@ -0,0 +1,19 @@
+
+xaml2svg_otherstuffdir = $(datadir)/inkscape/extensions/xaml2svg
+
+xaml2svg_otherstuff = \
+       animation.xsl \
+       brushes.xsl \
+       canvas.xsl \
+       geometry.xsl \
+       Makefile.am \
+       properties.xsl \
+       shapes.xsl \
+       transform.xsl
+
+xaml2svg_otherstuff_DATA = \
+       $(xaml2svg_otherstuff)
+
+EXTRA_DIST = \
+       $(xaml2svg_otherstuff_DATA)
+
diff --git a/share/extensions/xaml2svg/animation.xsl b/share/extensions/xaml2svg/animation.xsl
new file mode 100644 (file)
index 0000000..92e5909
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0" \r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:def="Definition"\r
+exclude-result-prefixes="def">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template name="template_animation">\r
+  <xsl:if test="@From"><xsl:attribute name="from"><xsl:value-of select="@From" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@To"><xsl:attribute name="to"><xsl:value-of select="@To" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@Duration"><xsl:attribute name="dur"><xsl:value-of select="@Duration" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@RepeatDuration"><xsl:attribute name="repeatDur"><xsl:value-of select="translate(@RepeatDuration, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@RepeatCount"><xsl:attribute name="repeatCount"><xsl:value-of select="@RepeatCount" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@AutoReverse">\r
+    <xsl:attribute name="fill">\r
+      <xsl:choose>\r
+        <xsl:when test="@AutoReverse = 'True'">remove</xsl:when>\r
+        <xsl:otherwise>freeze</xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>  \r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template name="template_timeline_animations">\r
+  <xsl:variable name="id" select="@ID" />\r
+  <xsl:variable name="name" select="@Name" />\r
+  <xsl:apply-templates select="//*[name(.) = 'SetterTimeline' and ($id = @TargetID or $name = @TargetName)]" />\r
+</xsl:template>\r
+\r
+<xsl:template name="template_animation_path">\r
+  <xsl:param name="target" />\r
+  <xsl:choose>\r
+    <xsl:when test="$target = '(Line.X2)'">x2</xsl:when>\r
+    <xsl:when test="$target = '(Rectangle.Opacity)'">opacity</xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = concat(name(..), '.Storyboards')]">\r
+  <!--xsl:apply-templates /-->\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'ParallelTimeLine']">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'SetterTimeline']">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'ByteAnimationCollection' or name(.) = 'DecimalAnimationCollection' or name(.) = 'DoubleAnimationCollection' or name(.) = 'Int16AnimationCollection' or name(.) = 'Int32AnimationCollection' or name(.) = 'Int64AnimationCollection' or name(.) = 'LengthAnimationCollection' or name(.) = 'SingleAnimationCollection' or name(.) = 'SizeAnimationCollection' or name(.) = 'ThicknessAnimationCollection']">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'ByteAnimation' or name(.) = 'DecimalAnimation' or name(.) = 'DoubleAnimation' or name(.) = 'Int16Animation' or name(.) = 'Int32Animation' or name(.) = 'Int64Animation' or name(.) = 'LengthAnimation' or name(.) = 'SingleAnimation' or name(.) = 'SizeAnimation' or name(.) = 'ThicknessAnimation']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <xsl:choose>\r
+    <xsl:when test="../@Path">\r
+      <animate>\r
+        <xsl:attribute name="attributeName"><xsl:call-template name="template_animation_path"><xsl:with-param name="target" select="../@Path" /></xsl:call-template></xsl:attribute>\r
+        <xsl:call-template name="template_animation" />\r
+      </animate><xsl:text>&#13;</xsl:text>  \r
+    </xsl:when>\r
+    <xsl:when test="name(..) = concat(name(.), 'Collection')">\r
+      <animate>\r
+        <xsl:attribute name="attributeName"><xsl:value-of select="translate(substring-after(name(../..), concat(name(../../..), '.')), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" /></xsl:attribute>\r
+        <xsl:call-template name="template_animation" />\r
+      </animate><xsl:text>&#13;</xsl:text>\r
+    </xsl:when>\r
+    <xsl:when test="name(..) = concat(name(../..), '.AngleAnimations')">\r
+      <animateTransform attributeName="transform" type="rotate">\r
+        <xsl:call-template name="template_animation" />\r
+      </animateTransform><xsl:text>&#13;</xsl:text>\r
+    </xsl:when>\r
+  </xsl:choose>  \r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = concat(name(..), '.ColorAnimations')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = concat(name(..), '.AngleAnimations')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'ColorAnimation']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <animateColor>\r
+    <xsl:if test="../@Path">\r
+      <xsl:attribute name="attributeName"><xsl:call-template name="template_animation_path"><xsl:with-param name="target" select="../@Path" /></xsl:call-template></xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:if test="name(..) = concat(name(../..), '.ColorAnimations')">\r
+      <xsl:choose>\r
+        <xsl:when test="name(../..) = 'SolidColorBrush'">\r
+          <xsl:attribute name="attributeName">\r
+            <xsl:value-of select="translate(substring-after(name(../../..), concat(name(../../../..), '.')), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" />\r
+          </xsl:attribute>\r
+        </xsl:when>\r
+      </xsl:choose>  \r
+    </xsl:if>    \r
+    <xsl:call-template name="template_animation" />\r
+  </animateColor><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'PointAnimation']">\r
+  <animateMotion>\r
+    <xsl:if test="../@Path">\r
+      <xsl:attribute name="attributeName"><xsl:call-template name="template_animation_path"><xsl:with-param name="target" select="../@Path" /></xsl:call-template></xsl:attribute>\r
+    </xsl:if>  \r
+    <xsl:call-template name="template_animation" />\r
+  </animateMotion>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'RectAnimation']">\r
+<!-- -->\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg/brushes.xsl b/share/extensions/xaml2svg/brushes.xsl
new file mode 100644 (file)
index 0000000..7dd1968
--- /dev/null
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0"\r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+exclude-result-prefixes="x">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'LinearGradientBrush']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <linearGradient>\r
+    <xsl:attribute name="id">\r
+      <xsl:choose>\r
+        <xsl:when test="@x:Key"><xsl:value-of select="@x:Key" /></xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:attribute name="gradientUnits">\r
+      <xsl:choose>\r
+        <xsl:when test="@MappingMode = 'RelativeToBoundingBox' or not(@StartPoint and @EndPoint)"><xsl:value-of select="'boundingBox'" /></xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="'userSpaceOnUse'" /></xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:if test="@SpreadMethod">\r
+      <xsl:attribute name="spreadMethod">\r
+        <xsl:value-of select="translate(@SpreadMethod, 'PR', 'pr')" />\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:choose>\r
+      <xsl:when test="@MappingMode = 'Absolute' and @StartPoint and @EndPoint">\r
+        <xsl:attribute name="x1"><xsl:value-of select="substring-before(@StartPoint,',')" /></xsl:attribute>\r
+        <xsl:attribute name="x1"><xsl:value-of select="substring-before(@StartPoint,',')" /></xsl:attribute>\r
+        <xsl:attribute name="y1"><xsl:value-of select="substring-after(@StartPoint,',')" /></xsl:attribute>\r
+        <xsl:attribute name="x2"><xsl:value-of select="substring-before(@EndPoint,',')" /></xsl:attribute>\r
+        <xsl:attribute name="y2"><xsl:value-of select="substring-after(@EndPoint,',')" /></xsl:attribute>\r
+      </xsl:when>\r
+      <xsl:when test="@StartPoint and @EndPoint">\r
+        <xsl:attribute name="x1"><xsl:value-of select="concat(100 * number(substring-before(@StartPoint,',')), '%')" /></xsl:attribute>\r
+        <xsl:attribute name="y1"><xsl:value-of select="concat(100 * number(substring-after(@StartPoint,',')), '%')" /></xsl:attribute>\r
+        <xsl:attribute name="x2"><xsl:value-of select="concat(100 * number(substring-before(@EndPoint,',')), '%')" /></xsl:attribute>\r
+        <xsl:attribute name="y2"><xsl:value-of select="concat(100 * number(substring-after(@EndPoint,',')), '%')" /></xsl:attribute>\r
+      </xsl:when>\r
+      <xsl:otherwise>\r
+        <xsl:attribute name="x1"><xsl:value-of select="0" /></xsl:attribute>\r
+        <xsl:attribute name="y1"><xsl:value-of select="0" /></xsl:attribute>\r
+        <xsl:attribute name="x2"><xsl:value-of select="'100%'" /></xsl:attribute>\r
+        <xsl:attribute name="y2"><xsl:value-of select="'100%'" /></xsl:attribute>\r
+      </xsl:otherwise>\r
+    </xsl:choose>\r
+    <xsl:call-template name="template_gradienttransform" />\r
+    <xsl:apply-templates select="*[name(.) != 'Brush.Transform' and name(.) != concat(name(..), '.Transform') and name(.) != 'Brush.RelativeTransform' and name(.) != concat(name(..), '.RelativeTransform')]" />\r
+    <xsl:text>&#13;</xsl:text>\r
+  </linearGradient><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'RadialGradientBrush']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <radialGradient>\r
+    <xsl:attribute name="id">\r
+      <xsl:choose>\r
+        <xsl:when test="@x:Key"><xsl:value-of select="@x:Key" /></xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:attribute name="gradientUnits">\r
+      <xsl:choose>\r
+        <xsl:when test="@MappingMode = 'RelativeToBoundingBox' or not(@StartPoint and @EndPoint)"><xsl:value-of select="'boundingBox'" /></xsl:when>\r
+        <xsl:otherwise><xsl:value-of select="'userSpaceOnUse'" /></xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:if test="@SpreadMethod">\r
+      <xsl:attribute name="spreadMethod">\r
+        <xsl:value-of select="translate(@SpreadMethod, 'PR', 'pr')" />\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:if test="@Center">\r
+      <xsl:attribute name="cx"><xsl:value-of select="substring-before(@Center, ',')" /></xsl:attribute>\r
+    <xsl:attribute name="cy"><xsl:value-of select="substring-after(@Center, ',')" /></xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:if test="@GradientOrigin">\r
+      <xsl:attribute name="fx"><xsl:value-of select="substring-before(@GradientOrigin, ',')" /></xsl:attribute>\r
+      <xsl:attribute name="fy"><xsl:value-of select="substring-after(@GradientOrigin, ',')" /></xsl:attribute>\r
+    </xsl:if>\r
+    <!-- Xamlon uses Focus -->\r
+    <xsl:if test="@Focus">\r
+      <xsl:attribute name="fx"><xsl:value-of select="substring-before(@Focus, ',')" /></xsl:attribute>\r
+      <xsl:attribute name="fy"><xsl:value-of select="substring-after(@Focus, ',')" /></xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:attribute name="r"><xsl:value-of select="@RadiusX" /></xsl:attribute>\r
+    <xsl:call-template name="template_gradienttransform" />\r
+    <xsl:apply-templates select="*[name(.) != 'Brush.Transform' and name(.) != concat(name(..), '.Transform') and name(.) != 'Brush.RelativeTransform' and name(.) != concat(name(..), '.RelativeTransform')]" />\r
+  </radialGradient><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'GradientStopCollection' or name(.) = 'GradientBrush.GradientStops' or name(.) = concat(name(..), '.GradientStops')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'GradientStop']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <stop>\r
+    <xsl:if test="@Offset"><xsl:attribute name="offset"><xsl:value-of select="@Offset" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Color">\r
+      <xsl:attribute name="stop-color"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:attribute>\r
+      <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:variable>\r
+      <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="stop-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>\r
+    </xsl:if>\r
+  </stop>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'SolidColorBrush']">\r
+  <xsl:call-template name="template_properties" />\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'ImageBrush']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <defs>\r
+    <xsl:text>&#13;</xsl:text>\r
+    <pattern>\r
+      <xsl:choose>\r
+        <xsl:when test="@TileMode != 'none' and @Viewport and @ViewportUnits = 'Absolute'">\r
+          <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>\r
+          <xsl:attribute name="x"><xsl:value-of select="substring-before(@Viewport, ',')" /></xsl:attribute>\r
+          <xsl:attribute name="y"><xsl:value-of select="substring-before(substring-after(@Viewport, ','), ',')" /></xsl:attribute>\r
+          <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>\r
+          <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:when test="@TileMode != 'none' and @Viewport">\r
+          <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>\r
+          <xsl:attribute name="x"><xsl:value-of select="concat(100 * number(substring-before(@Viewport, ',')), '%')" /></xsl:attribute>\r
+          <xsl:attribute name="y"><xsl:value-of select="concat(100 * number(substring-before(substring-after(@Viewport, ','), ',')), '%')" /></xsl:attribute>\r
+          <xsl:attribute name="width"><xsl:value-of select="concat(100 * number(substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>\r
+          <xsl:attribute name="height"><xsl:value-of select="concat(100 * number(substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:when test="@Viewport and ../../@Width and ../../@Height">\r
+          <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>\r
+          <xsl:attribute name="x">0</xsl:attribute>\r
+          <xsl:attribute name="y">0</xsl:attribute>\r
+          <xsl:attribute name="width"><xsl:value-of select="../../@Width" /></xsl:attribute>\r
+          <xsl:attribute name="height"><xsl:value-of select="../../@Height" /></xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:otherwise>\r
+          <xsl:attribute name="patternUnits">boundingBox </xsl:attribute>\r
+          <xsl:attribute name="x">0</xsl:attribute>\r
+          <xsl:attribute name="y">0</xsl:attribute>\r
+          <xsl:attribute name="width">100%</xsl:attribute>\r
+          <xsl:attribute name="height">100%</xsl:attribute>\r
+        </xsl:otherwise>\r
+      </xsl:choose>\r
+      <xsl:attribute name="id"><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:attribute>\r
+      <xsl:text>&#13;</xsl:text>\r
+      <image>\r
+        <xsl:attribute name="xlink:href"><xsl:value-of select="@ImageSource" /></xsl:attribute>\r
+        <xsl:choose>\r
+          <xsl:when test="@Viewport and @ViewportUnits = 'Absolute'">\r
+            <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>\r
+            <xsl:attribute name="x"><xsl:value-of select="0" /></xsl:attribute>\r
+            <xsl:attribute name="y"><xsl:value-of select="0" /></xsl:attribute>\r
+            <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>\r
+            <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:when test="@Viewport">\r
+            <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>\r
+            <xsl:attribute name="x"><xsl:value-of select="0" /></xsl:attribute>\r
+            <xsl:attribute name="y"><xsl:value-of select="0" /></xsl:attribute>\r
+            <xsl:attribute name="width"><xsl:value-of select="concat(100 * number(substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>\r
+            <xsl:attribute name="height"><xsl:value-of select="concat(100 * number(substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>\r
+          </xsl:when>\r
+          <xsl:otherwise>\r
+            <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>\r
+            <xsl:attribute name="x">0</xsl:attribute>\r
+            <xsl:attribute name="y">0</xsl:attribute>\r
+            <xsl:attribute name="width">100%</xsl:attribute>\r
+            <xsl:attribute name="height">100%</xsl:attribute>\r
+          </xsl:otherwise>\r
+        </xsl:choose>\r
+        <xsl:attribute name="style">opacity:1</xsl:attribute>\r
+        <xsl:attribute name="image-rendering">optimizeSpeed</xsl:attribute>\r
+      </image><xsl:text>&#13;</xsl:text>\r
+    </pattern><xsl:text>&#13;</xsl:text>\r
+  </defs><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'DrawingBrush']">\r
+    <pattern>\r
+      <xsl:choose>\r
+        <xsl:when test="@TileMode != 'none' and @Viewport and @ViewportUnits = 'Absolute'">\r
+          <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>\r
+          <xsl:attribute name="x"><xsl:value-of select="substring-before(@Viewport, ',')" /></xsl:attribute>\r
+          <xsl:attribute name="y"><xsl:value-of select="substring-before(substring-after(@Viewport, ','), ',')" /></xsl:attribute>\r
+          <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>\r
+          <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:when test="@TileMode != 'none' and @Viewport">\r
+          <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>\r
+          <xsl:attribute name="x"><xsl:value-of select="concat(100 * number(substring-before(@Viewport, ',')), '%')" /></xsl:attribute>\r
+          <xsl:attribute name="y"><xsl:value-of select="concat(100 * number(substring-before(substring-after(@Viewport, ','), ',')), '%')" /></xsl:attribute>\r
+          <xsl:attribute name="width"><xsl:value-of select="concat(100 * number(substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>\r
+          <xsl:attribute name="height"><xsl:value-of select="concat(100 * number(substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:when test="@Viewport and ../../@Width and ../../@Height">\r
+          <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>\r
+          <xsl:attribute name="x">0</xsl:attribute>\r
+          <xsl:attribute name="y">0</xsl:attribute>\r
+          <xsl:attribute name="width"><xsl:value-of select="../../@Width" /></xsl:attribute>\r
+          <xsl:attribute name="height"><xsl:value-of select="../../@Height" /></xsl:attribute>\r
+        </xsl:when>\r
+        <xsl:otherwise>\r
+          <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>\r
+          <xsl:attribute name="x">0</xsl:attribute>\r
+          <xsl:attribute name="y">0</xsl:attribute>\r
+          <xsl:attribute name="width">100%</xsl:attribute>\r
+          <xsl:attribute name="height">100%</xsl:attribute>\r
+        </xsl:otherwise>\r
+      </xsl:choose>\r
+      <xsl:attribute name="id"><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:attribute>\r
+      <xsl:apply-templates mode="forward" />\r
+    </pattern>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'DrawingBrush.Drawing']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg/canvas.xsl b/share/extensions/xaml2svg/canvas.xsl
new file mode 100644 (file)
index 0000000..0b4a93e
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0"\r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Canvas' or name(.) = 'Window' or name(.) = 'StackPanel']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <svg>\r
+    <xsl:choose>\r
+    <!--\r
+      <xsl:when test="@ID"><xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute></xsl:when>\r
+    -->\r
+      <xsl:when test="@x:Key"><xsl:attribute name="id"><xsl:value-of select="@x:Key" /></xsl:attribute></xsl:when>\r
+      <xsl:when test="@Name"><xsl:attribute name="id"><xsl:value-of select="@Name" /></xsl:attribute></xsl:when>\r
+    </xsl:choose>\r
+    <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>\r
+    <xsl:call-template name="template_properties" />\r
+    <xsl:choose>\r
+      <xsl:when test="@Transform or *[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]">\r
+        <xsl:text>&#13;</xsl:text>\r
+        <g>\r
+          <xsl:call-template name="template_transform" />\r
+          <xsl:apply-templates select="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]" />\r
+          <xsl:apply-templates mode="svg" />\r
+        </g>\r
+      </xsl:when>\r
+      <xsl:otherwise><xsl:apply-templates mode="svg" /></xsl:otherwise>\r
+    </xsl:choose>\r
+  </svg><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Border']">\r
+  <rect>\r
+    <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@BorderThickness"><xsl:attribute name="stroke-width"><xsl:value-of select="@BorderThickness" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Background">\r
+      <xsl:attribute name="fill"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Background" /></xsl:call-template></xsl:attribute>\r
+      <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Background" /></xsl:call-template></xsl:variable>\r
+      <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="fill-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>\r
+    </xsl:if>\r
+    <xsl:if test="@BorderBrush">\r
+      <xsl:attribute name="stroke"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@BorderBrush" /></xsl:call-template></xsl:attribute>\r
+      <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@BorderBrush" /></xsl:call-template></xsl:variable>\r
+      <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="stroke-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>\r
+    </xsl:if>\r
+    <xsl:call-template name="template_properties" />\r
+  </rect>\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg/geometry.xsl b/share/extensions/xaml2svg/geometry.xsl
new file mode 100644 (file)
index 0000000..a3ccd70
--- /dev/null
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0"\r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:def="Definition"\r
+exclude-result-prefixes="def">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'ClipGeometry']">\r
+<!-- -->\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'GlyphRunDrawing']">\r
+<!-- -->\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'ImageDrawing']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <image>\r
+    <xsl:if test="@ImageSource"><xsl:attribute name="xlink:href"><xsl:value-of select="@ImageSource" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@Rect">\r
+      <xsl:attribute name="x"><xsl:value-of select="substring-before(@Rect, ',')" /></xsl:attribute>\r
+      <xsl:attribute name="y"><xsl:value-of select="substring-before(substring-after(@Rect, ','), ',')" /></xsl:attribute>\r
+      <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Rect, ','), ','), ',')" /></xsl:attribute>\r
+      <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Rect, ','), ','), ',')" /></xsl:attribute>\r
+    </xsl:if>  \r
+  </image>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'DrawingGroup']">\r
+  <xsl:call-template name="template_properties" />\r
+  <xsl:call-template name="template_transform" />\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'EllipseGeometry']">\r
+  <xsl:variable name="cx" select="substring-before(@Center, ',')" />\r
+  <xsl:variable name="cy" select="substring-after(@Center, ',')" />\r
+  <xsl:value-of select="concat('M ', $cx + @RadiusX, ',', $cy, ' ')" />\r
+  <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx, ',', $cy + @RadiusY, ' ')" />\r
+  <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx - @RadiusX, ',', $cy, ' ')" />\r
+  <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx, ',', $cy - @RadiusY, ' ')" />\r
+  <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx + @RadiusX, ',', $cy, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'LineGeometry']">\r
+  <xsl:value-of select="concat('M ', @StartPoint, ' ')" />\r
+  <xsl:value-of select="concat('L ', @EndPoint, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PathGeometry']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PathGeometry.Figures']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PathFigureCollection']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PathFigure']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PathFigure.Segments']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PathSegmentCollection']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'StartSegment']">\r
+  <xsl:value-of select="concat('M ', @Point, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'CloseSegment']">\r
+  <xsl:value-of select="'z '" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'LineSegment']">\r
+  <xsl:value-of select="concat('L ', @Point, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'ArcSegment']">\r
+  <xsl:value-of select="concat('A ', substring-before(@Size, ','), ',', substring-after(@Size, ','), ' ', @XRotation, ' ', number(@LargeArc = 'True'), ' ', number(@Sweepflag = 'True'), ' ', @Point, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'BezierSegment']">\r
+  <xsl:value-of select="concat('C ', @Point1, ' ', @Point2, ' ', @Point3, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'QuadraticBezierSegment']">\r
+  <xsl:value-of select="concat('Q ', @Point1, ' ', @Point2, ' ', @Point3, ' ')" />\r
+</xsl:template>\r
+\r
+<xsl:template name="PrintPolyBezierPoints">\r
+  <xsl:param name="segments" />\r
+  <xsl:param name="segmentsize" />\r
+  <xsl:param name="cursor" />\r
+  <xsl:text>C </xsl:text>\r
+  <xsl:value-of select="concat(substring-before($segments, ','), ',')" />\r
+  <xsl:variable name="segments1"><xsl:value-of select="substring-after($segments, ',')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments1, ' '), ' ')" />\r
+  <xsl:variable name="segments2"><xsl:value-of select="substring-after($segments1, ' ')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments2, ','), ',')" />\r
+  <xsl:variable name="segments3"><xsl:value-of select="substring-after($segments2, ',')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments3, ' '), ' ')" />\r
+  <xsl:variable name="segments4"><xsl:value-of select="substring-after($segments3, ' ')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments4, ','), ',')" />\r
+  <xsl:variable name="segments5"><xsl:value-of select="substring-after($segments4, ',')" /></xsl:variable>\r
+  <xsl:choose>\r
+    <xsl:when test="contains($segments5, ' ')">\r
+      <xsl:value-of select="concat(substring-before($segments5, ' '), ' ')" />\r
+    </xsl:when>\r
+    <xsl:otherwise>\r
+      <xsl:value-of select="$segments5" />\r
+    </xsl:otherwise>\r
+  </xsl:choose>\r
+  <xsl:variable name="segments6"><xsl:value-of select="substring-after($segments5, ' ')" /></xsl:variable>\r
+  <xsl:if test="contains($segments6, ' ')">\r
+    <xsl:call-template name="PrintPolyBezierPoints">\r
+      <xsl:with-param name="segments" select="$segments6" />\r
+    </xsl:call-template>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template name="PrintPolyLinePoints">\r
+  <xsl:param name="segments" />\r
+  <xsl:text>L </xsl:text>\r
+  <xsl:value-of select="concat(substring-before($segments, ','), ',')" />\r
+  <xsl:variable name="segments1"><xsl:value-of select="substring-after($segments, ',')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments1, ' '), ' ')" />\r
+  <xsl:variable name="segments2"><xsl:value-of select="substring-after($segments1, ' ')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments2, ','), ',')" />\r
+  <xsl:variable name="segments3"><xsl:value-of select="substring-after($segments2, ',')" /></xsl:variable>\r
+  <xsl:choose>\r
+    <xsl:when test="contains($segments3, ' ')">\r
+      <xsl:value-of select="concat(substring-before($segments3, ' '), ' ')" />\r
+    </xsl:when>\r
+    <xsl:otherwise>\r
+      <xsl:value-of select="$segments3" />\r
+    </xsl:otherwise>\r
+  </xsl:choose>\r
+  <xsl:variable name="segments4"><xsl:value-of select="substring-after($segments3, ' ')" /></xsl:variable>\r
+  <xsl:if test="contains($segments4, ' ')">\r
+    <xsl:call-template name="PrintPolyLinePoints">\r
+      <xsl:with-param name="segments" select="$segments4" />\r
+    </xsl:call-template>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template name="PrintQuadraticBezierPoints">\r
+  <xsl:param name="segments" />\r
+  <xsl:text>Q </xsl:text>\r
+  <xsl:value-of select="concat(substring-before($segments, ','), ',')" />\r
+  <xsl:variable name="segments1"><xsl:value-of select="substring-after($segments, ',')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments1, ' '), ' ')" />\r
+  <xsl:variable name="segments2"><xsl:value-of select="substring-after($segments1, ' ')" /></xsl:variable>\r
+  <xsl:value-of select="concat(substring-before($segments2, ','), ',')" />\r
+  <xsl:variable name="segments3"><xsl:value-of select="substring-after($segments2, ',')" /></xsl:variable>\r
+  <xsl:choose>\r
+    <xsl:when test="contains($segments3, ' ')">\r
+      <xsl:value-of select="concat(substring-before($segments3, ' '), ' ')" />\r
+    </xsl:when>\r
+    <xsl:otherwise>\r
+      <xsl:value-of select="$segments3" />\r
+    </xsl:otherwise>\r
+  </xsl:choose>\r
+  <xsl:variable name="segments4"><xsl:value-of select="substring-after($segments3, ' ')" /></xsl:variable>\r
+  <xsl:if test="contains($segments4, ' ')">\r
+    <xsl:call-template name="PrintQuadraticBezierPoints">\r
+      <xsl:with-param name="segments" select="$segments4" />\r
+    </xsl:call-template>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PolyBezierSegment']">\r
+  <xsl:call-template name="PrintPolyBezierPoints">\r
+    <xsl:with-param name="segments" select="@Points" />\r
+  </xsl:call-template>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PolyLineSegment']">\r
+  <xsl:call-template name="PrintPolyLinePoints">\r
+    <xsl:with-param name="segments" select="@Points" />\r
+  </xsl:call-template>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'PolyQuadraticBezierSegment']">\r
+  <xsl:call-template name="PrintQuadraticBezierPoints">\r
+    <xsl:with-param name="segments" select="@Points" />\r
+  </xsl:call-template>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'RectangleGeometry']">\r
+  <xsl:variable name="rect" select="RectangleGeometry.Rect/Rect" />\r
+  <xsl:choose>\r
+    <xsl:when test="$rect">\r
+      <xsl:value-of select="concat('M ', $rect/@X, ',', $rect/@Y, ' ')" />\r
+      <xsl:value-of select="concat('H ', $rect/@X + $rect/@Width, ' V ',  $rect/@Y + $rect/@Height, ' H ', $rect/@X,' V ', $rect/@Y, ' ')" />\r
+    </xsl:when>\r
+    <xsl:when test="@Rect">\r
+      <xsl:variable name="x" select="substring-before(substring-before(@Rect, ' '), ',')" />\r
+      <xsl:variable name="y" select="substring-after(substring-before(@Rect, ' '), ',')" />\r
+      <xsl:variable name="width" select="substring-before(substring-after(@Rect, ' '), ',')" />\r
+      <xsl:variable name="height" select="substring-after(substring-after(@Rect, ' '), ',')" />\r
+      <xsl:value-of select="concat('M ', $x, ',', $y, ' ')" />\r
+      <xsl:value-of select="concat('H ', $x + $width, ' V ',  $y + $height, ' H ', $x,' V ', $y, ' ')" />\r
+    </xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<!--\r
+<xsl:template mode="forward" match="*[name(.) = 'GeometryCollection']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+-->\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'GeometryGroup']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'GeometryDrawing']">\r
+  <path>\r
+    <xsl:attribute name="d"><xsl:apply-templates select="*[name(.) = 'GeometryDrawing.Geometry']" mode="forward" /></xsl:attribute>\r
+    <xsl:attribute name="fill"><xsl:value-of select="@Brush" /></xsl:attribute>\r
+    <xsl:apply-templates mode="forward" select="*[name(.) = 'GeometryDrawing.Pen']" />\r
+  </path>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'GeometryDrawing.Geometry']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'GeometryDrawing.Pen']">\r
+  <xsl:variable name="pen" select="*[name(.) = 'Pen']" />\r
+  <xsl:if test="$pen/@Brush"><xsl:attribute name="stroke"><xsl:value-of select="$pen/@Brush" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="$pen/@Thickness"><xsl:attribute name="stroke-width"><xsl:value-of select="$pen/@Thickness" /></xsl:attribute></xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'CombinedGeometry' or name(.) = 'CombinedGeometry.Geometry1' or name(.) = 'CombinedGeometry.Geometry2']">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg/properties.xsl b/share/extensions/xaml2svg/properties.xsl
new file mode 100644 (file)
index 0000000..e7cedda
--- /dev/null
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0"\r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+xmlns:msxsl="urn:schemas-microsoft-com:xslt">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template mode="boundingbox" match="*">\r
+<xsl:if test="system-property('xsl:vendor') = 'Microsoft'">\r
+  <xsl:choose>\r
+    <xsl:when test="@Canvas.Left and @Canvas.Top and @Width and @Height">\r
+      <boundingbox>\r
+        <xsl:attribute name="x1">\r
+          <xsl:value-of select="@Canvas.Left" />\r
+        </xsl:attribute>  \r
+        <xsl:attribute name="x2">\r
+          <xsl:value-of select="@Canvas.Left + @Width" />\r
+        </xsl:attribute>  \r
+        <xsl:attribute name="y1">\r
+          <xsl:value-of select="@Canvas.Top" />\r
+        </xsl:attribute>  \r
+        <xsl:attribute name="y2">\r
+          <xsl:value-of select="@Canvas.Top + @Height" />\r
+        </xsl:attribute>  \r
+      </boundingbox>\r
+    </xsl:when>\r
+    <xsl:when test="count(*) &gt; 0">\r
+      <xsl:variable name="boundingboxes"><xsl:apply-templates mode="boundingbox" select="*" />\r
+      </xsl:variable>\r
+      <boundingbox>\r
+      <xsl:attribute name="x1">\r
+        <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">\r
+          <xsl:sort data-type="number" select="@x1" order="ascending"/>\r
+          <xsl:if test="position() = 1"><xsl:value-of select="@x1" /></xsl:if>\r
+        </xsl:for-each>\r
+      </xsl:attribute>  \r
+      <xsl:attribute name="x2">\r
+        <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">\r
+          <xsl:sort data-type="number" select="@x2" order="descending"/>\r
+          <xsl:if test="position() = 1"><xsl:value-of select="@x2" /></xsl:if>\r
+        </xsl:for-each>\r
+      </xsl:attribute>  \r
+      <xsl:attribute name="y1">\r
+        <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">\r
+          <xsl:sort data-type="number" select="@y1" order="ascending"/>\r
+          <xsl:if test="position() = 1"><xsl:value-of select="@y1" /></xsl:if>\r
+        </xsl:for-each>\r
+      </xsl:attribute>  \r
+      <xsl:attribute name="y2">\r
+        <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">\r
+          <xsl:sort data-type="number" select="@y2" order="descending"/>\r
+          <xsl:if test="position() = 1"><xsl:value-of select="@y2" /></xsl:if>\r
+        </xsl:for-each>\r
+      </xsl:attribute>\r
+      </boundingbox>\r
+    </xsl:when>\r
+  </xsl:choose>\r
+</xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="svg" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="false() and name(.) != 'Canvas' and name(.) != 'Image' and name(.) != 'Rect' and name(.) != 'Ellipse' and name(.) != 'Text' and name(.) != 'TextBlock' and (@Canvas.Left or @Canvas.Top)">\r
+      <xsl:text>&#13;</xsl:text>\r
+      <svg>\r
+        <xsl:if test="@Canvas.Left and @Canvas.Top and @Width and @Height">\r
+          <xsl:attribute name="viewBox">\r
+           <xsl:value-of select="concat(@Canvas.Left, ' ')" />\r
+           <xsl:value-of select="concat(@Canvas.Top, ' ')" />\r
+           <xsl:value-of select="concat(@Width - @Canvas.Left, ' ')" />\r
+           <xsl:value-of select="@Height - @Canvas.Top" />\r
+         </xsl:attribute>\r
+        </xsl:if>\r
+        <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>\r
+        <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>\r
+        <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>\r
+        <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>\r
+        <xsl:apply-templates mode="g" select="." />\r
+      </svg><xsl:text>&#13;</xsl:text>\r
+    </xsl:when>\r
+    <xsl:otherwise><xsl:apply-templates mode="g" select="." /></xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="g" match="*">\r
+  <xsl:choose>\r
+    <xsl:when test="*[(name(.) = 'Shape.Fill' or name(.) = concat(name(..), '.Fill')) and not(*[name(.) = 'SolidColorBrush']) or (name(.) = 'Shape.Stroke' or name(.) = concat(name(..), '.Stroke')) and not(*[name(.) = 'SolidColorBrush']) or name(.) = 'UIElement.OpacityMask' or name(.) = concat(name(..), '.OpacityMask') or name(.) = 'UIElement.Clip' or name(.) = concat(name(..), '.Clip')]">\r
+      <g>\r
+        <xsl:apply-templates mode="defs" select="." />\r
+        <xsl:apply-templates mode="forward" select="." />\r
+      </g>\r
+    </xsl:when>\r
+    <xsl:otherwise><xsl:apply-templates mode="forward" select="." /></xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template name="template_color">\r
+  <xsl:param name="colorspec" />\r
+  <xsl:choose>\r
+    <xsl:when test="contains($colorspec, '#') and (string-length($colorspec) = 7 or string-length($colorspec) = 9)">\r
+      <xsl:value-of select="concat('#', substring($colorspec, string-length($colorspec) - 5, 6))" />\r
+    </xsl:when>\r
+    <xsl:when test="contains($colorspec, '#') and (string-length($colorspec) = 4 or string-length($colorspec) = 5)">\r
+      <xsl:value-of select="concat('#', substring($colorspec, string-length($colorspec) - 5, 3))" />\r
+    </xsl:when>\r
+    <xsl:when test="contains($colorspec, '{StaticResource ')"><xsl:value-of select="concat('url(#', substring-before(substring-after($colorspec, '{StaticResource '), '}'), ')')" /></xsl:when>\r
+    <xsl:otherwise><xsl:value-of select="$colorspec" /></xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template name="template_opacity">\r
+  <xsl:param name="colorspec" />\r
+  <xsl:if test="contains($colorspec, '#') and (string-length($colorspec) = 4 or string-length($colorspec) = 9)">\r
+    <xsl:variable name="opacityspec"><xsl:value-of select="translate(substring($colorspec, 2, 2), 'abcdefgh', 'ABCDEFGH')" /></xsl:variable>\r
+    <xsl:choose>\r
+      <xsl:when test="$opacityspec != 'FF'">\r
+        <xsl:value-of select="format-number(number(string-length(substring-before('0123456789ABCDEF', substring($colorspec, 2, 1))) * 16 + string-length(substring-before('0123456789ABCDEF', substring($colorspec, 3, 1)))) div 255, '#0.00')" />\r
+      </xsl:when>\r
+      <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>\r
+    </xsl:choose>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template name="template_properties">\r
+  <xsl:choose>\r
+    <!--\r
+    <xsl:when test="@ID"><xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute></xsl:when>\r
+    -->\r
+    <xsl:when test="@x:Key"><xsl:attribute name="id"><xsl:value-of select="@x:Key" /></xsl:attribute></xsl:when>\r
+    <xsl:when test="@Name"><xsl:attribute name="id"><xsl:value-of select="@Name" /></xsl:attribute></xsl:when>\r
+  </xsl:choose>\r
+  <xsl:choose>\r
+    <xsl:when test="@Fill">\r
+      <xsl:attribute name="fill"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Fill" /></xsl:call-template></xsl:attribute>\r
+      <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Fill" /></xsl:call-template></xsl:variable>\r
+      <xsl:if test="string-length($test_opacity) &gt; 0">\r
+        <xsl:attribute name="fill-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute>\r
+      </xsl:if>\r
+    </xsl:when>\r
+    <xsl:when test="not(name(.) = 'Canvas') and not(@Foreground or *[name(.) = 'Shape.Fill' or name(.) = concat(name(..), '.Fill')])"><xsl:attribute name="fill">none</xsl:attribute></xsl:when>\r
+  </xsl:choose>\r
+  <xsl:if test="@Stroke">\r
+    <xsl:attribute name="stroke"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Stroke" /></xsl:call-template></xsl:attribute>\r
+    <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Stroke" /></xsl:call-template></xsl:variable>\r
+    <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="stroke-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>\r
+  </xsl:if>\r
+  <xsl:if test="@StrokeThickness"><xsl:attribute name="stroke-width"><xsl:value-of select="@StrokeThickness" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@StrokeMiterLimit"><xsl:attribute name="stroke-miterlimit"><xsl:value-of select="@StrokeMiterLimit" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@StrokeDashArray"><xsl:attribute name="stroke-dasharray"><xsl:value-of select="@StrokeDashArray" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@StrokeDashOffset"><xsl:attribute name="stroke-dashoffset"><xsl:value-of select="@StrokeDashOffset" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@StrokeLineJoin"><xsl:attribute name="stroke-linejoin"><xsl:value-of select="@StrokeLineJoin" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@StrokeEndLineCap"><xsl:attribute name="stroke-linecap"><xsl:value-of select="@StrokeEndLineCap" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@Opacity"><xsl:attribute name="fill-opacity"><xsl:value-of select="@Opacity" /></xsl:attribute></xsl:if>\r
+  <xsl:if test="@Color">\r
+    <xsl:attribute name="fill"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:attribute>\r
+    <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:variable>\r
+    <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="fill-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>\r
+  </xsl:if>\r
+  <xsl:if test="@Clip">\r
+    <xsl:choose>\r
+      <xsl:when test="contains(@Clip, '{')"><xsl:attribute name="fill"><xsl:value-of select="concat('url(#', substring-before(substring-after(@Clip, '{'), '}'), ')')" /></xsl:attribute></xsl:when>\r
+      <xsl:otherwise>\r
+        <xsl:attribute name="clip-path"><xsl:value-of select="concat('url(#clippath_', generate-id(.),')')" /></xsl:attribute>\r
+       <defs><xsl:text>&#13;</xsl:text>\r
+         <clipPath>\r
+           <xsl:attribute name="id"><xsl:value-of select="concat('clippath_', generate-id(.))" /></xsl:attribute>\r
+           <xsl:text>&#13;</xsl:text>\r
+           <path>\r
+             <xsl:attribute name="d">\r
+                <xsl:choose>\r
+                  <xsl:when test="contains(@Clip, 'F1')"><xsl:value-of select="substring-after(@Clip, 'F1')" /></xsl:when>\r
+                  <xsl:otherwise><xsl:value-of select="@Clip" /></xsl:otherwise>\r
+                </xsl:choose>  \r
+             </xsl:attribute></path><xsl:text>&#13;</xsl:text>\r
+         </clipPath><xsl:text>&#13;</xsl:text>\r
+        </defs><xsl:text>&#13;</xsl:text>\r
+      </xsl:otherwise>\r
+    </xsl:choose>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = concat(name(..), '.Resources')]">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <defs><xsl:apply-templates mode="forward" /></defs><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = concat(name(..), '.Children')]">\r
+  <xsl:apply-templates mode="forward" />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Shape.Fill' or name(.) = concat(name(..), '.Fill')]">\r
+  <xsl:choose>\r
+    <xsl:when test="not(*[name(.) = 'SolidColorBrush'])">\r
+      <xsl:attribute name="fill"><xsl:value-of select="concat('url(#id_', generate-id(.), ')')" /></xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:otherwise><xsl:apply-templates select="*[name(.) = 'SolidColorBrush']" /></xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="defs" match="*[(name(.) = 'Shape.Fill' or name(.) = concat(name(..), '.Fill')) and not(*[name(.) = 'SolidColorBrush'])]">\r
+  <defs><xsl:apply-templates mode="forward" /></defs>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Shape.Opacity' or name(.) = concat(name(..), '.Opacity')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = concat(name(..), '.Height') or name(.) = concat(name(..), '.Width')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Shape.Stroke' or name(.) = concat(name(..), '.Stroke')]">\r
+  <xsl:choose>\r
+    <xsl:when test="not(*[name(.) = 'SolidColorBrush'])">\r
+      <xsl:attribute name="stroke"><xsl:value-of select="concat('url(#id_', generate-id(.), ')')" /></xsl:attribute>\r
+    </xsl:when>\r
+    <xsl:otherwise><xsl:apply-templates select="*[name(.) = 'SolidColorBrush']" /></xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+<xsl:template mode="defs" match="*[(name(.) = 'Shape.Stroke' or name(.) = concat(name(..), '.Stroke')) and not(*[name(.) = 'SolidColorBrush'])]">\r
+  <defs><xsl:apply-templates mode="forward" /></defs>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'UIElement.Clip' or name(.) = concat(name(..), '.Clip')]">\r
+  <xsl:attribute name="clip-path"><xsl:value-of select="concat('url(#clippath_', generate-id(.),')')" /></xsl:attribute>\r
+</xsl:template>\r
+\r
+<xsl:template mode="defs" match="*[name(.) = 'UIElement.Clip' or name(.) = concat(name(..), '.Clip')]">\r
+  <defs><xsl:text>&#13;</xsl:text>\r
+    <clipPath>\r
+      <xsl:attribute name="id"><xsl:value-of select="concat('clippath_', generate-id(.))" /></xsl:attribute>\r
+      <xsl:text>&#13;</xsl:text>\r
+      <path>\r
+        <xsl:attribute name="d">\r
+          <xsl:apply-templates mode="forward" />\r
+        </xsl:attribute>\r
+      </path><xsl:text>&#13;</xsl:text>\r
+    </clipPath><xsl:text>&#13;</xsl:text>\r
+  </defs><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'UIElement.OpacityMask' or name(.) = concat(name(..), '.OpacityMask')]">\r
+  <xsl:attribute name="mask"><xsl:value-of select="concat('url(#mask_', generate-id(.),')')" /></xsl:attribute>\r
+</xsl:template>\r
+\r
+<xsl:template mode="defs" match="*[name(.) = 'UIElement.OpacityMask' or name(.) = concat(name(..), '.OpacityMask')]">\r
+  <defs><xsl:text>&#13;</xsl:text>\r
+    <mask>\r
+      <xsl:attribute name="id"><xsl:value-of select="concat('mask_', generate-id(.))" /></xsl:attribute>\r
+      <xsl:apply-templates mode="svg" />\r
+    </mask><xsl:text>&#13;</xsl:text>\r
+  </defs><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+\r
+</xsl:stylesheet>\r
diff --git a/share/extensions/xaml2svg/shapes.xsl b/share/extensions/xaml2svg/shapes.xsl
new file mode 100644 (file)
index 0000000..4854861
--- /dev/null
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0" \r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:def="Definition"\r
+exclude-result-prefixes="def">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Path']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <path>\r
+    <xsl:if test="@Data">\r
+      <xsl:attribute name="d">\r
+        <xsl:choose>\r
+          <xsl:when test="starts-with(@Data, 'F1 ')"><xsl:value-of select="substring-after(@Data, 'F1 ')" /></xsl:when>\r
+          <xsl:otherwise><xsl:value-of select="@Data" /></xsl:otherwise>\r
+        </xsl:choose>\r
+      </xsl:attribute>\r
+    </xsl:if>\r
+    <xsl:choose>\r
+      <xsl:when test="@FillRule = 'nonzero' or starts-with(@Data, 'F1 ')"><xsl:attribute name="fill-rule"></xsl:attribute>nonzero</xsl:when>\r
+      <xsl:when test="@FillRule = 'evenodd' or starts-with(@Data, 'F0 ')"><xsl:attribute name="fill-rule"></xsl:attribute>evenodd</xsl:when>\r
+    </xsl:choose>\r
+    <xsl:call-template name="template_properties" />  \r
+    <xsl:call-template name="template_transform" />  \r
+    <xsl:apply-templates mode="forward" />\r
+  </path><xsl:text>&#13;</xsl:text>\r
+</xsl:template>    \r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Path.Data']">\r
+  <xsl:attribute name="d">\r
+    <xsl:apply-templates mode="forward" />\r
+  </xsl:attribute>\r
+  <xsl:if test="@FillRule">\r
+    <xsl:attribute name="fill-rule">\r
+      <xsl:choose>\r
+        <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>\r
+        <xsl:otherwise>evenodd</xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Line']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <line>\r
+    <xsl:if test="@X1"><xsl:attribute name="x1"><xsl:value-of select="@X1" /></xsl:attribute></xsl:if> \r
+    <xsl:if test="@Y1"><xsl:attribute name="y1"><xsl:value-of select="@Y1" /></xsl:attribute></xsl:if> \r
+    <xsl:if test="@X2"><xsl:attribute name="x2"><xsl:value-of select="@X2" /></xsl:attribute></xsl:if> \r
+    <xsl:if test="@Y2"><xsl:attribute name="y2"><xsl:value-of select="@Y2" /></xsl:attribute></xsl:if> \r
+    <xsl:call-template name="template_properties" />  \r
+    <xsl:call-template name="template_transform" />  \r
+    <xsl:apply-templates mode="forward" />\r
+  </line><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Ellipse']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <ellipse>\r
+    <xsl:if test="@Width">\r
+      <xsl:attribute name="rx"><xsl:value-of select="@Width div 2" /></xsl:attribute>\r
+      <xsl:if test="@Canvas.Left">\r
+        <xsl:attribute name="cx"><xsl:value-of select="@Canvas.Left + @Width div 2" /></xsl:attribute>\r
+      </xsl:if>\r
+    </xsl:if>\r
+    <xsl:if test="@Height">\r
+      <xsl:attribute name="ry"><xsl:value-of select="@Height div 2" /></xsl:attribute>\r
+      <xsl:if test="@Canvas.Top">\r
+        <xsl:attribute name="cy"><xsl:value-of select="@Canvas.Top + @Height div 2" /></xsl:attribute>\r
+      </xsl:if>\r
+    </xsl:if>\r
+    <xsl:call-template name="template_properties" />  \r
+    <xsl:call-template name="template_transform" />  \r
+    <xsl:apply-templates mode="forward" />\r
+  </ellipse><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Rectangle']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <rect>\r
+    <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@RadiusX"><xsl:attribute name="rx"><xsl:value-of select="@RadiusX" /></xsl:attribute></xsl:if>  \r
+    <xsl:if test="@RadiusY"><xsl:attribute name="ry"><xsl:value-of select="@RadiusY" /></xsl:attribute></xsl:if>  \r
+    <xsl:call-template name="template_properties" /> \r
+    <xsl:call-template name="template_transform" />\r
+    <xsl:call-template name="template_timeline_animations" />\r
+    <xsl:apply-templates mode="forward" />\r
+  </rect><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Polyline']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <polyline>\r
+    <xsl:if test="@Points"><xsl:attribute name="points"><xsl:value-of select="@Points" /></xsl:attribute></xsl:if>\r
+    <xsl:attribute name="fill-rule">\r
+      <xsl:choose>\r
+        <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>\r
+        <xsl:when test="@FillRule = 'evenodd'">evenodd</xsl:when>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:call-template name="template_properties" />  \r
+    <xsl:call-template name="template_transform" />  \r
+    <xsl:apply-templates mode="forward" />\r
+  </polyline><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Polygon']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <polygon>\r
+    <xsl:if test="@Points"><xsl:attribute name="points"><xsl:value-of select="@Points" /></xsl:attribute></xsl:if>\r
+    <xsl:attribute name="fill-rule">\r
+      <xsl:choose>\r
+        <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>\r
+        <xsl:when test="@FillRule = 'evenodd'">evenodd</xsl:when>\r
+      </xsl:choose>\r
+    </xsl:attribute>\r
+    <xsl:call-template name="template_properties" />  \r
+    <xsl:call-template name="template_transform" />  \r
+    <xsl:apply-templates mode="forward" />\r
+  </polygon><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+<xsl:template mode="forward" match="*[name(.) = 'Glyphs']">\r
+  <xsl:text>&#13;</xsl:text>\r
+  <defs>\r
+    <font-face>\r
+      <xsl:attribute name="font-family"><xsl:value-of select="concat('TrueType ', generate-id(.))" /></xsl:attribute>\r
+      <font-face-src><font-face-uri><xsl:attribute name="xlink:href"><xsl:value-of select="@FontUri" /></xsl:attribute></font-face-uri></font-face-src>\r
+    </font-face>\r
+  </defs>\r
+  <text>\r
+    <xsl:if test="@FontRenderingEmSize"><xsl:attribute name="font-size"><xsl:value-of select="@FontRenderingEmSize" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@OriginX"><xsl:attribute name="x"><xsl:value-of select="@OriginX" /></xsl:attribute></xsl:if>\r
+    <xsl:if test="@OriginY"><xsl:attribute name="y"><xsl:value-of select="@OriginY" /></xsl:attribute></xsl:if>\r
+    <xsl:attribute name="font-family"><xsl:value-of select="concat('TrueType ', generate-id(.))" /></xsl:attribute>\r
+    <xsl:call-template name="template_properties" />  \r
+    <xsl:call-template name="template_transform" />  \r
+    <xsl:if test="@UnicodeString"><xsl:value-of select="@UnicodeString" /></xsl:if>\r
+  </text><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+\r
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/share/extensions/xaml2svg/transform.xsl b/share/extensions/xaml2svg/transform.xsl
new file mode 100644 (file)
index 0000000..19f1222
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!--\r
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in\r
+all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
+THE SOFTWARE.\r
+-->\r
+\r
+<xsl:stylesheet version="1.0" \r
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+xmlns:xlink="http://www.w3.org/1999/xlink"\r
+xmlns:svg="http://www.w3.org/2000/svg"\r
+xmlns:def="Definition"\r
+exclude-result-prefixes="def">\r
+<xsl:strip-space elements="*" />\r
+<xsl:output method="xml" encoding="ISO-8859-1"/>\r
+\r
+<xsl:template name="template_transform">\r
+  <xsl:variable name="transform_value">\r
+    <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>\r
+    <xsl:apply-templates select="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]/*" />\r
+  </xsl:variable>  \r
+  <xsl:if test="string-length($transform_value) &gt; 0"><xsl:attribute name="transform"><xsl:value-of select="$transform_value" /></xsl:attribute></xsl:if>  \r
+</xsl:template>\r
+\r
+<xsl:template name="template_gradienttransform">\r
+  <xsl:variable name="transform_value">\r
+    <xsl:if test="@Canvas.Left and @Canvas.Top"><xsl:value-of select="concat('translate(', @Canvas.Left, ',', @Canvas.Top, ')')" /></xsl:if>\r
+    <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>\r
+    <xsl:apply-templates select="*[name(.) = 'Brush.Transform' or name(.) = concat(name(..), '.Transform')]" />\r
+    <xsl:apply-templates select="*[name(.) = 'Brush.RelativeTransform' or name(.) = concat(name(..), '.RelativeTransform')]" />\r
+  </xsl:variable>  \r
+  <xsl:if test="string-length($transform_value) &gt; 0"><xsl:attribute name="gradientTransform"><xsl:value-of select="$transform_value" /></xsl:attribute></xsl:if>  \r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]">\r
+  <!-- xsl:apply-templates /-->\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'Brush.Transform' or name(.) = concat(name(..), '.Transform')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'Brush.RelativeTransform' or name(.) = concat(name(..), '.RelativeTransform')]">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+<!--\r
+<xsl:template match="*[name(.) = 'TransformCollection' or name(.) = 'TransformGroup']">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+-->\r
+<xsl:template match="*[name(.) = 'TransformGroup']">\r
+  <xsl:apply-templates />\r
+</xsl:template>\r
+\r
+\r
+<!--\r
+<xsl:template mode="forward" match="*[name(.) = 'TransformDecorator']">\r
+  <g>\r
+    <xsl:attribute name="transform">\r
+      <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>\r
+      <xsl:apply-templates select="*[name(.) = 'TransformDecorator.Transform']/*" />\r
+    </xsl:attribute>\r
+  <xsl:apply-templates select="*[name(.) = 'TransformDecorator.Transform']/*/*" />  \r
+  <xsl:apply-templates mode="forward" select="*[name(.) != 'TransformDecorator.Transform']" />\r
+  </g><xsl:text>&#13;</xsl:text>\r
+</xsl:template>\r
+-->\r
+\r
+<xsl:template match="*[name(.) = 'TranslateTransform']">\r
+  <xsl:if test="@X">\r
+    <xsl:value-of select="concat('translate(', @X)" />\r
+    <xsl:if test="@Y"><xsl:value-of select="concat(', ', @Y)" /></xsl:if>\r
+    <xsl:value-of select="') '" />      \r
+  </xsl:if>  \r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'ScaleTransform']">\r
+  <xsl:if test="@ScaleX">\r
+    <xsl:value-of select="concat('scale(', @ScaleX)" />\r
+    <xsl:if test="@ScaleY"><xsl:value-of select="concat(', ', @ScaleY)" /></xsl:if>\r
+    <xsl:value-of select="') '" />      \r
+  </xsl:if>   \r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'RotateTransform']">\r
+  <xsl:if test="@Angle">\r
+    <xsl:value-of select="concat('rotate(', @Angle)" />\r
+    <xsl:if test="@Center"><xsl:value-of select="concat(',', @Center)" /></xsl:if>\r
+    <xsl:value-of select="') '" />      \r
+  </xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'SkewTransform']">\r
+  <xsl:if test="@AngleX"><xsl:value-of select="concat('skewX(', @AngleX,') ')" /></xsl:if>  \r
+  <xsl:if test="@AngleY"><xsl:value-of select="concat('skewY(', @AngleY,') ')" /></xsl:if>\r
+</xsl:template>\r
+\r
+<xsl:template match="*[name(.) = 'MatrixTransform']">\r
+  <xsl:if test="@Matrix"><xsl:value-of select="concat('matrix(', @Matrix,') ')" /></xsl:if>  \r
+</xsl:template>\r
+\r
+</xsl:stylesheet>\r