summaryrefslogtreecommitdiffstats
path: root/share/extensions/xaml2svg
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /share/extensions/xaml2svg
parentInitial commit. (diff)
downloadinkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.tar.xz
inkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--share/extensions/xaml2svg.inx14
-rw-r--r--share/extensions/xaml2svg.xsl107
-rw-r--r--share/extensions/xaml2svg/animation.xsl141
-rw-r--r--share/extensions/xaml2svg/brushes.xsl244
-rw-r--r--share/extensions/xaml2svg/canvas.xsl80
-rw-r--r--share/extensions/xaml2svg/geometry.xsl272
-rw-r--r--share/extensions/xaml2svg/properties.xsl286
-rw-r--r--share/extensions/xaml2svg/shapes.xsl171
-rw-r--r--share/extensions/xaml2svg/transform.xsl120
9 files changed, 1435 insertions, 0 deletions
diff --git a/share/extensions/xaml2svg.inx b/share/extensions/xaml2svg.inx
new file mode 100644
index 0000000..f0855b9
--- /dev/null
+++ b/share/extensions/xaml2svg.inx
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/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 location="inx">xaml2svg.xsl</file>
+ </xslt>
+</inkscape-extension>
diff --git a/share/extensions/xaml2svg.xsl b/share/extensions/xaml2svg.xsl
new file mode 100644
index 0000000..8c0e4a5
--- /dev/null
+++ b/share/extensions/xaml2svg.xsl
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+Version history:
+
+20070907 Initial release
+20070912 Removed NaN as viewBox values
+
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+xmlns:msxsl="urn:schemas-microsoft-com:xslt">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="UTF-8"/>
+<xsl:include href="xaml2svg/animation.xsl" />
+<xsl:include href="xaml2svg/brushes.xsl" />
+<xsl:include href="xaml2svg/canvas.xsl" />
+<xsl:include href="xaml2svg/geometry.xsl" />
+<xsl:include href="xaml2svg/properties.xsl" />
+<xsl:include href="xaml2svg/shapes.xsl" />
+<xsl:include href="xaml2svg/transform.xsl" />
+
+<xsl:template match="/">
+ <svg>
+ <xsl:attribute name="overflow">visible</xsl:attribute>
+ <xsl:variable name="viewBox"><xsl:apply-templates mode="boundingbox" /></xsl:variable>
+ <xsl:if test="system-property('xsl:vendor') = 'Microsoft' and (msxsl:node-set($viewBox)/boundingbox/@x1 != '') and (msxsl:node-set($viewBox)/boundingbox/@x2 != '') and (msxsl:node-set($viewBox)/boundingbox/@y1 != '') and (msxsl:node-set($viewBox)/boundingbox/@y2 != '')">
+ <xsl:attribute name="viewBox">
+ <xsl:value-of select="concat(msxsl:node-set($viewBox)/boundingbox/@x1, ' ')" />
+ <xsl:value-of select="concat(msxsl:node-set($viewBox)/boundingbox/@y1, ' ')" />
+ <xsl:value-of select="concat(msxsl:node-set($viewBox)/boundingbox/@x2 - msxsl:node-set($viewBox)/boundingbox/@x1, ' ')" />
+ <xsl:value-of select="msxsl:node-set($viewBox)/boundingbox/@y2 - msxsl:node-set($viewBox)/boundingbox/@y1" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="svg" />
+ </svg>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Image']">
+ <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>
+ <image>
+ <xsl:if test="@Source"><xsl:attribute name="xlink:href"><xsl:value-of select="@Source" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+ </image>
+ <xsl:if test="@Canvas.Left or @Canvas.Top"><xsl:value-of disable-output-escaping="yes" select="'&lt;/svg&gt;&#13;'" /></xsl:if>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'TextBlock']">
+ <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>
+ <text>
+ <xsl:if test="@FontSize"><xsl:attribute name="font-size"><xsl:value-of select="@FontSize" /></xsl:attribute></xsl:if>
+ <xsl:if test="@FontWeight"><xsl:attribute name="font-weight"><xsl:value-of select="@FontWeight" /></xsl:attribute></xsl:if>
+ <xsl:if test="@FontFamily"><xsl:attribute name="font-family"><xsl:value-of select="@FontFamily" /></xsl:attribute></xsl:if>
+ <xsl:if test="@FontStyle"><xsl:attribute name="font-style"><xsl:value-of select="@FontStyle" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Foreground"><xsl:attribute name="fill"><xsl:value-of select="@Foreground" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>
+ <xsl:if test="@HorizontalAlignment">
+ <xsl:attribute name="text-anchor">
+ <xsl:choose>
+ <xsl:when test="@HorizontalAlignment = 'Left'">start</xsl:when>
+ <xsl:when test="@HorizontalAlignment = 'Center'">middle</xsl:when>
+ <xsl:when test="@HorizontalAlignment = 'Right'">end</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="dominant-baseline">hanging</xsl:attribute>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates />
+ </text>
+ <xsl:if test="@Canvas.Left or @Canvas.Top"><xsl:value-of disable-output-escaping="yes" select="'&lt;/svg&gt;&#13;'" /></xsl:if>
+</xsl:template>
+
+<xsl:template match="*">
+<xsl:comment><xsl:value-of select="concat('Unknown tag: ', name(.))" /></xsl:comment>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/animation.xsl b/share/extensions/xaml2svg/animation.xsl
new file mode 100644
index 0000000..e51a430
--- /dev/null
+++ b/share/extensions/xaml2svg/animation.xsl
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:def="Definition"
+exclude-result-prefixes="def">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template name="template_animation">
+ <xsl:if test="@From"><xsl:attribute name="from"><xsl:value-of select="@From" /></xsl:attribute></xsl:if>
+ <xsl:if test="@To"><xsl:attribute name="to"><xsl:value-of select="@To" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Duration"><xsl:attribute name="dur"><xsl:value-of select="@Duration" /></xsl:attribute></xsl:if>
+ <xsl:if test="@RepeatDuration"><xsl:attribute name="repeatDur"><xsl:value-of select="translate(@RepeatDuration, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" /></xsl:attribute></xsl:if>
+ <xsl:if test="@RepeatCount"><xsl:attribute name="repeatCount"><xsl:value-of select="@RepeatCount" /></xsl:attribute></xsl:if>
+ <xsl:if test="@AutoReverse">
+ <xsl:attribute name="fill">
+ <xsl:choose>
+ <xsl:when test="@AutoReverse = 'True'">remove</xsl:when>
+ <xsl:otherwise>freeze</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="template_timeline_animations">
+ <xsl:variable name="id" select="@ID" />
+ <xsl:variable name="name" select="@Name" />
+ <xsl:apply-templates select="//*[name(.) = 'SetterTimeline' and ($id = @TargetID or $name = @TargetName)]" />
+</xsl:template>
+
+<xsl:template name="template_animation_path">
+ <xsl:param name="target" />
+ <xsl:choose>
+ <xsl:when test="$target = '(Line.X2)'">x2</xsl:when>
+ <xsl:when test="$target = '(Rectangle.Opacity)'">opacity</xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[name(.) = concat(name(..), '.Storyboards')]">
+ <!--xsl:apply-templates /-->
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'ParallelTimeLine']">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'SetterTimeline']">
+ <xsl:apply-templates />
+</xsl:template>
+
+<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']">
+ <xsl:apply-templates />
+</xsl:template>
+
+<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']">
+ <xsl:choose>
+ <xsl:when test="../@Path">
+ <animate>
+ <xsl:attribute name="attributeName"><xsl:call-template name="template_animation_path"><xsl:with-param name="target" select="../@Path" /></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="template_animation" />
+ </animate>
+ </xsl:when>
+ <xsl:when test="name(..) = concat(name(.), 'Collection')">
+ <animate>
+ <xsl:attribute name="attributeName"><xsl:value-of select="translate(substring-after(name(../..), concat(name(../../..), '.')), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" /></xsl:attribute>
+ <xsl:call-template name="template_animation" />
+ </animate>
+ </xsl:when>
+ <xsl:when test="name(..) = concat(name(../..), '.AngleAnimations')">
+ <animateTransform attributeName="transform" type="rotate">
+ <xsl:call-template name="template_animation" />
+ </animateTransform>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[name(.) = concat(name(..), '.ColorAnimations')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="*[name(.) = concat(name(..), '.AngleAnimations')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'ColorAnimation']">
+ <animateColor>
+ <xsl:if test="../@Path">
+ <xsl:attribute name="attributeName"><xsl:call-template name="template_animation_path"><xsl:with-param name="target" select="../@Path" /></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="name(..) = concat(name(../..), '.ColorAnimations')">
+ <xsl:choose>
+ <xsl:when test="name(../..) = 'SolidColorBrush'">
+ <xsl:attribute name="attributeName">
+ <xsl:value-of select="translate(substring-after(name(../../..), concat(name(../../../..), '.')), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" />
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:call-template name="template_animation" />
+ </animateColor>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'PointAnimation']">
+ <animateMotion>
+ <xsl:if test="../@Path">
+ <xsl:attribute name="attributeName"><xsl:call-template name="template_animation_path"><xsl:with-param name="target" select="../@Path" /></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="template_animation" />
+ </animateMotion>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'RectAnimation']">
+<!-- -->
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/brushes.xsl b/share/extensions/xaml2svg/brushes.xsl
new file mode 100644
index 0000000..884d6db
--- /dev/null
+++ b/share/extensions/xaml2svg/brushes.xsl
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+exclude-result-prefixes="x">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template mode="forward" match="*[name(.) = 'LinearGradientBrush']">
+ <linearGradient>
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="@x:Key"><xsl:value-of select="@x:Key" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="gradientUnits">
+ <xsl:choose>
+ <xsl:when test="@MappingMode = 'RelativeToBoundingBox' or not(@StartPoint and @EndPoint)"><xsl:value-of select="'boundingBox'" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="'userSpaceOnUse'" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="@SpreadMethod">
+ <xsl:attribute name="spreadMethod">
+ <xsl:value-of select="translate(@SpreadMethod, 'PR', 'pr')" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@MappingMode = 'Absolute' and @StartPoint and @EndPoint">
+ <xsl:attribute name="x1"><xsl:value-of select="substring-before(@StartPoint,',')" /></xsl:attribute>
+ <xsl:attribute name="x1"><xsl:value-of select="substring-before(@StartPoint,',')" /></xsl:attribute>
+ <xsl:attribute name="y1"><xsl:value-of select="substring-after(@StartPoint,',')" /></xsl:attribute>
+ <xsl:attribute name="x2"><xsl:value-of select="substring-before(@EndPoint,',')" /></xsl:attribute>
+ <xsl:attribute name="y2"><xsl:value-of select="substring-after(@EndPoint,',')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@StartPoint and @EndPoint">
+ <xsl:attribute name="x1"><xsl:value-of select="concat(100 * number(substring-before(@StartPoint,',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="y1"><xsl:value-of select="concat(100 * number(substring-after(@StartPoint,',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="x2"><xsl:value-of select="concat(100 * number(substring-before(@EndPoint,',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="y2"><xsl:value-of select="concat(100 * number(substring-after(@EndPoint,',')), '%')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="x1"><xsl:value-of select="0" /></xsl:attribute>
+ <xsl:attribute name="y1"><xsl:value-of select="0" /></xsl:attribute>
+ <xsl:attribute name="x2"><xsl:value-of select="'100%'" /></xsl:attribute>
+ <xsl:attribute name="y2"><xsl:value-of select="'100%'" /></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="template_gradienttransform" />
+ <xsl:apply-templates select="*[name(.) != 'Brush.Transform' and name(.) != concat(name(..), '.Transform') and name(.) != 'Brush.RelativeTransform' and name(.) != concat(name(..), '.RelativeTransform')]" />
+ </linearGradient>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'RadialGradientBrush']">
+ <radialGradient>
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="@x:Key"><xsl:value-of select="@x:Key" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="gradientUnits">
+ <xsl:choose>
+ <xsl:when test="@MappingMode = 'RelativeToBoundingBox' or not(@StartPoint and @EndPoint)"><xsl:value-of select="'boundingBox'" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="'userSpaceOnUse'" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="@SpreadMethod">
+ <xsl:attribute name="spreadMethod">
+ <xsl:value-of select="translate(@SpreadMethod, 'PR', 'pr')" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@Center">
+ <xsl:attribute name="cx"><xsl:value-of select="substring-before(@Center, ',')" /></xsl:attribute>
+ <xsl:attribute name="cy"><xsl:value-of select="substring-after(@Center, ',')" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@GradientOrigin">
+ <xsl:attribute name="fx"><xsl:value-of select="substring-before(@GradientOrigin, ',')" /></xsl:attribute>
+ <xsl:attribute name="fy"><xsl:value-of select="substring-after(@GradientOrigin, ',')" /></xsl:attribute>
+ </xsl:if>
+ <!-- Xamlon uses Focus -->
+ <xsl:if test="@Focus">
+ <xsl:attribute name="fx"><xsl:value-of select="substring-before(@Focus, ',')" /></xsl:attribute>
+ <xsl:attribute name="fy"><xsl:value-of select="substring-after(@Focus, ',')" /></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="r"><xsl:value-of select="@RadiusX" /></xsl:attribute>
+ <xsl:call-template name="template_gradienttransform" />
+ <xsl:apply-templates select="*[name(.) != 'Brush.Transform' and name(.) != concat(name(..), '.Transform') and name(.) != 'Brush.RelativeTransform' and name(.) != concat(name(..), '.RelativeTransform')]" />
+ </radialGradient>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'GradientStopCollection' or name(.) = 'GradientBrush.GradientStops' or name(.) = concat(name(..), '.GradientStops')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'GradientStop']">
+ <stop>
+ <xsl:if test="@Offset"><xsl:attribute name="offset"><xsl:value-of select="@Offset" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Color">
+ <xsl:attribute name="stop-color"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:attribute>
+ <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:variable>
+ <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="stop-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>
+ </xsl:if>
+ </stop>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'SolidColorBrush']">
+ <xsl:call-template name="template_properties" />
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'ImageBrush']">
+ <defs>
+ <pattern>
+ <xsl:choose>
+ <xsl:when test="@TileMode != 'none' and @Viewport and @ViewportUnits = 'Absolute'">
+ <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>
+ <xsl:attribute name="x"><xsl:value-of select="substring-before(@Viewport, ',')" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="substring-before(substring-after(@Viewport, ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@TileMode != 'none' and @Viewport">
+ <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>
+ <xsl:attribute name="x"><xsl:value-of select="concat(100 * number(substring-before(@Viewport, ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="concat(100 * number(substring-before(substring-after(@Viewport, ','), ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="concat(100 * number(substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="concat(100 * number(substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@Viewport and ../../@Width and ../../@Height">
+ <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>
+ <xsl:attribute name="x">0</xsl:attribute>
+ <xsl:attribute name="y">0</xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="../../@Width" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="../../@Height" /></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="patternUnits">boundingBox </xsl:attribute>
+ <xsl:attribute name="x">0</xsl:attribute>
+ <xsl:attribute name="y">0</xsl:attribute>
+ <xsl:attribute name="width">100%</xsl:attribute>
+ <xsl:attribute name="height">100%</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="id"><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:attribute>
+ <image>
+ <xsl:attribute name="xlink:href"><xsl:value-of select="@ImageSource" /></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@Viewport and @ViewportUnits = 'Absolute'">
+ <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>
+ <xsl:attribute name="x"><xsl:value-of select="0" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="0" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@Viewport">
+ <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>
+ <xsl:attribute name="x"><xsl:value-of select="0" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="0" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="concat(100 * number(substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="concat(100 * number(substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>
+ <xsl:attribute name="x">0</xsl:attribute>
+ <xsl:attribute name="y">0</xsl:attribute>
+ <xsl:attribute name="width">100%</xsl:attribute>
+ <xsl:attribute name="height">100%</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style">opacity:1</xsl:attribute>
+ <xsl:attribute name="image-rendering">optimizeSpeed</xsl:attribute>
+ </image>
+ </pattern>
+ </defs>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'DrawingBrush']">
+ <pattern>
+ <xsl:choose>
+ <xsl:when test="@TileMode != 'none' and @Viewport and @ViewportUnits = 'Absolute'">
+ <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>
+ <xsl:attribute name="x"><xsl:value-of select="substring-before(@Viewport, ',')" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="substring-before(substring-after(@Viewport, ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@TileMode != 'none' and @Viewport">
+ <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>
+ <xsl:attribute name="x"><xsl:value-of select="concat(100 * number(substring-before(@Viewport, ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="concat(100 * number(substring-before(substring-after(@Viewport, ','), ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="concat(100 * number(substring-before(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="concat(100 * number(substring-after(substring-after(substring-after(@Viewport, ','), ','), ',')), '%')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@Viewport and ../../@Width and ../../@Height">
+ <xsl:attribute name="patternUnits">userSpaceOnUse</xsl:attribute>
+ <xsl:attribute name="x">0</xsl:attribute>
+ <xsl:attribute name="y">0</xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="../../@Width" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="../../@Height" /></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="patternUnits">boundingBox</xsl:attribute>
+ <xsl:attribute name="x">0</xsl:attribute>
+ <xsl:attribute name="y">0</xsl:attribute>
+ <xsl:attribute name="width">100%</xsl:attribute>
+ <xsl:attribute name="height">100%</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="id"><xsl:value-of select="concat('id_', generate-id(..))" /></xsl:attribute>
+ <xsl:apply-templates mode="forward" />
+ </pattern>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'DrawingBrush.Drawing']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/canvas.xsl b/share/extensions/xaml2svg/canvas.xsl
new file mode 100644
index 0000000..e67f0e2
--- /dev/null
+++ b/share/extensions/xaml2svg/canvas.xsl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template mode="forward" match="*[name(.) = 'Canvas' or name(.) = 'Window' or name(.) = 'StackPanel']">
+ <svg>
+ <xsl:choose>
+ <!--
+ <xsl:when test="@ID"><xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute></xsl:when>
+ -->
+ <xsl:when test="@x:Key"><xsl:attribute name="id"><xsl:value-of select="@x:Key" /></xsl:attribute></xsl:when>
+ <xsl:when test="@Name"><xsl:attribute name="id"><xsl:value-of select="@Name" /></xsl:attribute></xsl:when>
+ </xsl:choose>
+ <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>
+ <xsl:call-template name="template_properties" />
+ <xsl:choose>
+ <xsl:when test="@Transform or *[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]">
+ <g>
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates select="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]" />
+ <xsl:apply-templates mode="svg" />
+ </g>
+ </xsl:when>
+ <xsl:otherwise><xsl:apply-templates mode="svg" /></xsl:otherwise>
+ </xsl:choose>
+ </svg>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Border']">
+ <rect>
+ <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>
+ <xsl:if test="@BorderThickness"><xsl:attribute name="stroke-width"><xsl:value-of select="@BorderThickness" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Background">
+ <xsl:attribute name="fill"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Background" /></xsl:call-template></xsl:attribute>
+ <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Background" /></xsl:call-template></xsl:variable>
+ <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="fill-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>
+ </xsl:if>
+ <xsl:if test="@BorderBrush">
+ <xsl:attribute name="stroke"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@BorderBrush" /></xsl:call-template></xsl:attribute>
+ <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@BorderBrush" /></xsl:call-template></xsl:variable>
+ <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="stroke-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>
+ </xsl:if>
+ <xsl:call-template name="template_properties" />
+ </rect>
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/geometry.xsl b/share/extensions/xaml2svg/geometry.xsl
new file mode 100644
index 0000000..c28e6a6
--- /dev/null
+++ b/share/extensions/xaml2svg/geometry.xsl
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:def="Definition"
+exclude-result-prefixes="def">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template mode="forward" match="*[name(.) = 'ClipGeometry']">
+<!-- -->
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'GlyphRunDrawing']">
+<!-- -->
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'ImageDrawing']">
+ <image>
+ <xsl:if test="@ImageSource"><xsl:attribute name="xlink:href"><xsl:value-of select="@ImageSource" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Rect">
+ <xsl:attribute name="x"><xsl:value-of select="substring-before(@Rect, ',')" /></xsl:attribute>
+ <xsl:attribute name="y"><xsl:value-of select="substring-before(substring-after(@Rect, ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of select="substring-before(substring-after(substring-after(@Rect, ','), ','), ',')" /></xsl:attribute>
+ <xsl:attribute name="height"><xsl:value-of select="substring-after(substring-after(substring-after(@Rect, ','), ','), ',')" /></xsl:attribute>
+ </xsl:if>
+ </image>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'DrawingGroup']">
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'EllipseGeometry']">
+ <xsl:variable name="cx" select="substring-before(@Center, ',')" />
+ <xsl:variable name="cy" select="substring-after(@Center, ',')" />
+ <xsl:value-of select="concat('M ', $cx + @RadiusX, ',', $cy, ' ')" />
+ <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx, ',', $cy + @RadiusY, ' ')" />
+ <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx - @RadiusX, ',', $cy, ' ')" />
+ <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx, ',', $cy - @RadiusY, ' ')" />
+ <xsl:value-of select="concat('A ', @RadiusX, ',', @RadiusY, ' 0 0 1 ', $cx + @RadiusX, ',', $cy, ' ')" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'LineGeometry']">
+ <xsl:value-of select="concat('M ', @StartPoint, ' ')" />
+ <xsl:value-of select="concat('L ', @EndPoint, ' ')" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PathGeometry']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PathGeometry.Figures']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PathFigureCollection']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PathFigure']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PathFigure.Segments']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PathSegmentCollection']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'StartSegment']">
+ <xsl:value-of select="concat('M ', @Point, ' ')" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'CloseSegment']">
+ <xsl:value-of select="'z '" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'LineSegment']">
+ <xsl:value-of select="concat('L ', @Point, ' ')" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'ArcSegment']">
+ <xsl:value-of select="concat('A ', substring-before(@Size, ','), ',', substring-after(@Size, ','), ' ', @XRotation, ' ', number(@LargeArc = 'True'), ' ', number(@Sweepflag = 'True'), ' ', @Point, ' ')" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'BezierSegment']">
+ <xsl:value-of select="concat('C ', @Point1, ' ', @Point2, ' ', @Point3, ' ')" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'QuadraticBezierSegment']">
+ <xsl:value-of select="concat('Q ', @Point1, ' ', @Point2, ' ', @Point3, ' ')" />
+</xsl:template>
+
+<xsl:template name="PrintPolyBezierPoints">
+ <xsl:param name="segments" />
+ <xsl:param name="segmentsize" />
+ <xsl:param name="cursor" />
+ <xsl:text>C </xsl:text>
+ <xsl:value-of select="concat(substring-before($segments, ','), ',')" />
+ <xsl:variable name="segments1"><xsl:value-of select="substring-after($segments, ',')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments1, ' '), ' ')" />
+ <xsl:variable name="segments2"><xsl:value-of select="substring-after($segments1, ' ')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments2, ','), ',')" />
+ <xsl:variable name="segments3"><xsl:value-of select="substring-after($segments2, ',')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments3, ' '), ' ')" />
+ <xsl:variable name="segments4"><xsl:value-of select="substring-after($segments3, ' ')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments4, ','), ',')" />
+ <xsl:variable name="segments5"><xsl:value-of select="substring-after($segments4, ',')" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($segments5, ' ')">
+ <xsl:value-of select="concat(substring-before($segments5, ' '), ' ')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$segments5" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="segments6"><xsl:value-of select="substring-after($segments5, ' ')" /></xsl:variable>
+ <xsl:if test="contains($segments6, ' ')">
+ <xsl:call-template name="PrintPolyBezierPoints">
+ <xsl:with-param name="segments" select="$segments6" />
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="PrintPolyLinePoints">
+ <xsl:param name="segments" />
+ <xsl:text>L </xsl:text>
+ <xsl:value-of select="concat(substring-before($segments, ','), ',')" />
+ <xsl:variable name="segments1"><xsl:value-of select="substring-after($segments, ',')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments1, ' '), ' ')" />
+ <xsl:variable name="segments2"><xsl:value-of select="substring-after($segments1, ' ')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments2, ','), ',')" />
+ <xsl:variable name="segments3"><xsl:value-of select="substring-after($segments2, ',')" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($segments3, ' ')">
+ <xsl:value-of select="concat(substring-before($segments3, ' '), ' ')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$segments3" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="segments4"><xsl:value-of select="substring-after($segments3, ' ')" /></xsl:variable>
+ <xsl:if test="contains($segments4, ' ')">
+ <xsl:call-template name="PrintPolyLinePoints">
+ <xsl:with-param name="segments" select="$segments4" />
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="PrintQuadraticBezierPoints">
+ <xsl:param name="segments" />
+ <xsl:text>Q </xsl:text>
+ <xsl:value-of select="concat(substring-before($segments, ','), ',')" />
+ <xsl:variable name="segments1"><xsl:value-of select="substring-after($segments, ',')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments1, ' '), ' ')" />
+ <xsl:variable name="segments2"><xsl:value-of select="substring-after($segments1, ' ')" /></xsl:variable>
+ <xsl:value-of select="concat(substring-before($segments2, ','), ',')" />
+ <xsl:variable name="segments3"><xsl:value-of select="substring-after($segments2, ',')" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($segments3, ' ')">
+ <xsl:value-of select="concat(substring-before($segments3, ' '), ' ')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$segments3" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="segments4"><xsl:value-of select="substring-after($segments3, ' ')" /></xsl:variable>
+ <xsl:if test="contains($segments4, ' ')">
+ <xsl:call-template name="PrintQuadraticBezierPoints">
+ <xsl:with-param name="segments" select="$segments4" />
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PolyBezierSegment']">
+ <xsl:call-template name="PrintPolyBezierPoints">
+ <xsl:with-param name="segments" select="@Points" />
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PolyLineSegment']">
+ <xsl:call-template name="PrintPolyLinePoints">
+ <xsl:with-param name="segments" select="@Points" />
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'PolyQuadraticBezierSegment']">
+ <xsl:call-template name="PrintQuadraticBezierPoints">
+ <xsl:with-param name="segments" select="@Points" />
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'RectangleGeometry']">
+ <xsl:variable name="rect" select="RectangleGeometry.Rect/Rect" />
+ <xsl:choose>
+ <xsl:when test="$rect">
+ <xsl:value-of select="concat('M ', $rect/@X, ',', $rect/@Y, ' ')" />
+ <xsl:value-of select="concat('H ', $rect/@X + $rect/@Width, ' V ', $rect/@Y + $rect/@Height, ' H ', $rect/@X,' V ', $rect/@Y, ' ')" />
+ </xsl:when>
+ <xsl:when test="@Rect">
+ <xsl:variable name="x" select="substring-before(substring-before(@Rect, ' '), ',')" />
+ <xsl:variable name="y" select="substring-after(substring-before(@Rect, ' '), ',')" />
+ <xsl:variable name="width" select="substring-before(substring-after(@Rect, ' '), ',')" />
+ <xsl:variable name="height" select="substring-after(substring-after(@Rect, ' '), ',')" />
+ <xsl:value-of select="concat('M ', $x, ',', $y, ' ')" />
+ <xsl:value-of select="concat('H ', $x + $width, ' V ', $y + $height, ' H ', $x,' V ', $y, ' ')" />
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<!--
+<xsl:template mode="forward" match="*[name(.) = 'GeometryCollection']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+-->
+
+<xsl:template mode="forward" match="*[name(.) = 'GeometryGroup']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'GeometryDrawing']">
+ <path>
+ <xsl:attribute name="d"><xsl:apply-templates select="*[name(.) = 'GeometryDrawing.Geometry']" mode="forward" /></xsl:attribute>
+ <xsl:attribute name="fill"><xsl:value-of select="@Brush" /></xsl:attribute>
+ <xsl:apply-templates mode="forward" select="*[name(.) = 'GeometryDrawing.Pen']" />
+ </path>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'GeometryDrawing.Geometry']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'GeometryDrawing.Pen']">
+ <xsl:variable name="pen" select="*[name(.) = 'Pen']" />
+ <xsl:if test="$pen/@Brush"><xsl:attribute name="stroke"><xsl:value-of select="$pen/@Brush" /></xsl:attribute></xsl:if>
+ <xsl:if test="$pen/@Thickness"><xsl:attribute name="stroke-width"><xsl:value-of select="$pen/@Thickness" /></xsl:attribute></xsl:if>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'CombinedGeometry' or name(.) = 'CombinedGeometry.Geometry1' or name(.) = 'CombinedGeometry.Geometry2']">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/properties.xsl b/share/extensions/xaml2svg/properties.xsl
new file mode 100644
index 0000000..1cfb8ff
--- /dev/null
+++ b/share/extensions/xaml2svg/properties.xsl
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+Version history:
+
+20070907 Initial release
+20070912 TemplateBinding in template_color
+
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+xmlns:msxsl="urn:schemas-microsoft-com:xslt">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template mode="boundingbox" match="*">
+<xsl:if test="system-property('xsl:vendor') = 'Microsoft'">
+ <xsl:choose>
+ <xsl:when test="@Canvas.Left and @Canvas.Top and @Width and @Height">
+ <boundingbox>
+ <xsl:attribute name="x1">
+ <xsl:value-of select="@Canvas.Left" />
+ </xsl:attribute>
+ <xsl:attribute name="x2">
+ <xsl:value-of select="@Canvas.Left + @Width" />
+ </xsl:attribute>
+ <xsl:attribute name="y1">
+ <xsl:value-of select="@Canvas.Top" />
+ </xsl:attribute>
+ <xsl:attribute name="y2">
+ <xsl:value-of select="@Canvas.Top + @Height" />
+ </xsl:attribute>
+ </boundingbox>
+ </xsl:when>
+ <xsl:when test="count(*) &gt; 0">
+ <xsl:variable name="boundingboxes"><xsl:apply-templates mode="boundingbox" select="*" />
+ </xsl:variable>
+ <boundingbox>
+ <xsl:attribute name="x1">
+ <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">
+ <xsl:sort data-type="number" select="@x1" order="ascending"/>
+ <xsl:if test="position() = 1"><xsl:value-of select="@x1" /></xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ <xsl:attribute name="x2">
+ <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">
+ <xsl:sort data-type="number" select="@x2" order="descending"/>
+ <xsl:if test="position() = 1"><xsl:value-of select="@x2" /></xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ <xsl:attribute name="y1">
+ <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">
+ <xsl:sort data-type="number" select="@y1" order="ascending"/>
+ <xsl:if test="position() = 1"><xsl:value-of select="@y1" /></xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ <xsl:attribute name="y2">
+ <xsl:for-each select="msxsl:node-set($boundingboxes)/boundingbox">
+ <xsl:sort data-type="number" select="@y2" order="descending"/>
+ <xsl:if test="position() = 1"><xsl:value-of select="@y2" /></xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ </boundingbox>
+ </xsl:when>
+ </xsl:choose>
+</xsl:if>
+</xsl:template>
+
+<xsl:template mode="svg" match="*">
+ <xsl:choose>
+ <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)">
+ <svg>
+ <xsl:if test="@Canvas.Left and @Canvas.Top and @Width and @Height">
+ <xsl:attribute name="viewBox">
+ <xsl:value-of select="concat(@Canvas.Left, ' ')" />
+ <xsl:value-of select="concat(@Canvas.Top, ' ')" />
+ <xsl:value-of select="concat(@Width - @Canvas.Left, ' ')" />
+ <xsl:value-of select="@Height - @Canvas.Top" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>
+ <xsl:apply-templates mode="g" select="." />
+ </svg>
+ </xsl:when>
+ <xsl:otherwise><xsl:apply-templates mode="g" select="." /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template mode="g" match="*">
+ <xsl:choose>
+ <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')]">
+ <g>
+ <xsl:apply-templates mode="defs" select="." />
+ <xsl:apply-templates mode="forward" select="." />
+ </g>
+ </xsl:when>
+ <xsl:otherwise><xsl:apply-templates mode="forward" select="." /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="template_color">
+ <xsl:param name="colorspec" />
+ <xsl:choose>
+ <xsl:when test="contains($colorspec, '#') and (string-length($colorspec) = 7 or string-length($colorspec) = 9)">
+ <xsl:value-of select="concat('#', substring($colorspec, string-length($colorspec) - 5, 6))" />
+ </xsl:when>
+ <xsl:when test="contains($colorspec, '#') and (string-length($colorspec) = 4 or string-length($colorspec) = 5)">
+ <xsl:value-of select="concat('#', substring($colorspec, string-length($colorspec) - 5, 3))" />
+ </xsl:when>
+ <xsl:when test="contains($colorspec, '{StaticResource ')"><xsl:value-of select="concat('url(#', substring-before(substring-after($colorspec, '{StaticResource '), '}'), ')')" /></xsl:when>
+ <xsl:when test="contains($colorspec, '{TemplateBinding ')"><xsl:value-of select="concat('url(#', substring-before(substring-after($colorspec, '{TemplateBinding '), '}'), ')')" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$colorspec" /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="template_opacity">
+ <xsl:param name="colorspec" />
+ <xsl:if test="contains($colorspec, '#') and (string-length($colorspec) = 4 or string-length($colorspec) = 9)">
+ <xsl:variable name="opacityspec"><xsl:value-of select="translate(substring($colorspec, 2, 2), 'abcdefgh', 'ABCDEFGH')" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$opacityspec != 'FF'">
+ <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')" />
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="template_properties">
+ <xsl:choose>
+ <!--
+ <xsl:when test="@ID"><xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute></xsl:when>
+ -->
+ <xsl:when test="@x:Key"><xsl:attribute name="id"><xsl:value-of select="@x:Key" /></xsl:attribute></xsl:when>
+ <xsl:when test="@Name"><xsl:attribute name="id"><xsl:value-of select="@Name" /></xsl:attribute></xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@Fill">
+ <xsl:attribute name="fill"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Fill" /></xsl:call-template></xsl:attribute>
+ <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Fill" /></xsl:call-template></xsl:variable>
+ <xsl:if test="string-length($test_opacity) &gt; 0">
+ <xsl:attribute name="fill-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <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>
+ </xsl:choose>
+ <xsl:if test="@Stroke">
+ <xsl:attribute name="stroke"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Stroke" /></xsl:call-template></xsl:attribute>
+ <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Stroke" /></xsl:call-template></xsl:variable>
+ <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="stroke-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>
+ </xsl:if>
+ <xsl:if test="@StrokeThickness"><xsl:attribute name="stroke-width"><xsl:value-of select="@StrokeThickness" /></xsl:attribute></xsl:if>
+ <xsl:if test="@StrokeMiterLimit"><xsl:attribute name="stroke-miterlimit"><xsl:value-of select="@StrokeMiterLimit" /></xsl:attribute></xsl:if>
+ <xsl:if test="@StrokeDashArray"><xsl:attribute name="stroke-dasharray"><xsl:value-of select="@StrokeDashArray" /></xsl:attribute></xsl:if>
+ <xsl:if test="@StrokeDashOffset"><xsl:attribute name="stroke-dashoffset"><xsl:value-of select="@StrokeDashOffset" /></xsl:attribute></xsl:if>
+ <xsl:if test="@StrokeLineJoin"><xsl:attribute name="stroke-linejoin"><xsl:value-of select="@StrokeLineJoin" /></xsl:attribute></xsl:if>
+ <xsl:if test="@StrokeEndLineCap"><xsl:attribute name="stroke-linecap"><xsl:value-of select="@StrokeEndLineCap" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Opacity"><xsl:attribute name="fill-opacity"><xsl:value-of select="@Opacity" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Color">
+ <xsl:attribute name="fill"><xsl:call-template name="template_color"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:attribute>
+ <xsl:variable name="test_opacity"><xsl:call-template name="template_opacity"><xsl:with-param name="colorspec" select="@Color" /></xsl:call-template></xsl:variable>
+ <xsl:if test="string-length($test_opacity) &gt; 0"><xsl:attribute name="fill-opacity"><xsl:value-of select="$test_opacity" /></xsl:attribute></xsl:if>
+ </xsl:if>
+ <xsl:if test="@Clip">
+ <xsl:choose>
+ <xsl:when test="contains(@Clip, '{')"><xsl:attribute name="fill"><xsl:value-of select="concat('url(#', substring-before(substring-after(@Clip, '{'), '}'), ')')" /></xsl:attribute></xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="clip-path"><xsl:value-of select="concat('url(#clippath_', generate-id(.),')')" /></xsl:attribute>
+ <defs>
+ <clipPath>
+ <xsl:attribute name="id"><xsl:value-of select="concat('clippath_', generate-id(.))" /></xsl:attribute>
+ <path>
+ <xsl:attribute name="d">
+ <xsl:choose>
+ <xsl:when test="contains(@Clip, 'F1')"><xsl:value-of select="substring-after(@Clip, 'F1')" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@Clip" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute></path>
+ </clipPath>
+ </defs>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = concat(name(..), '.Resources')]">
+ <defs><xsl:apply-templates mode="forward" /></defs>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = concat(name(..), '.Children')]">
+ <xsl:apply-templates mode="forward" />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Shape.Fill' or name(.) = concat(name(..), '.Fill')]">
+ <xsl:choose>
+ <xsl:when test="not(*[name(.) = 'SolidColorBrush'])">
+ <xsl:attribute name="fill"><xsl:value-of select="concat('url(#id_', generate-id(.), ')')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise><xsl:apply-templates select="*[name(.) = 'SolidColorBrush']" /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template mode="defs" match="*[(name(.) = 'Shape.Fill' or name(.) = concat(name(..), '.Fill')) and not(*[name(.) = 'SolidColorBrush'])]">
+ <defs><xsl:apply-templates mode="forward" /></defs>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Shape.Opacity' or name(.) = concat(name(..), '.Opacity')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = concat(name(..), '.Height') or name(.) = concat(name(..), '.Width')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Shape.Stroke' or name(.) = concat(name(..), '.Stroke')]">
+ <xsl:choose>
+ <xsl:when test="not(*[name(.) = 'SolidColorBrush'])">
+ <xsl:attribute name="stroke"><xsl:value-of select="concat('url(#id_', generate-id(.), ')')" /></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise><xsl:apply-templates select="*[name(.) = 'SolidColorBrush']" /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template mode="defs" match="*[(name(.) = 'Shape.Stroke' or name(.) = concat(name(..), '.Stroke')) and not(*[name(.) = 'SolidColorBrush'])]">
+ <defs><xsl:apply-templates mode="forward" /></defs>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'UIElement.Clip' or name(.) = concat(name(..), '.Clip')]">
+ <xsl:attribute name="clip-path"><xsl:value-of select="concat('url(#clippath_', generate-id(.),')')" /></xsl:attribute>
+</xsl:template>
+
+<xsl:template mode="defs" match="*[name(.) = 'UIElement.Clip' or name(.) = concat(name(..), '.Clip')]">
+ <defs>
+ <clipPath>
+ <xsl:attribute name="id"><xsl:value-of select="concat('clippath_', generate-id(.))" /></xsl:attribute>
+ <path>
+ <xsl:attribute name="d">
+ <xsl:apply-templates mode="forward" />
+ </xsl:attribute>
+ </path>
+ </clipPath>
+ </defs>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'UIElement.OpacityMask' or name(.) = concat(name(..), '.OpacityMask')]">
+ <xsl:attribute name="mask"><xsl:value-of select="concat('url(#mask_', generate-id(.),')')" /></xsl:attribute>
+</xsl:template>
+
+<xsl:template mode="defs" match="*[name(.) = 'UIElement.OpacityMask' or name(.) = concat(name(..), '.OpacityMask')]">
+ <defs>
+ <mask>
+ <xsl:attribute name="id"><xsl:value-of select="concat('mask_', generate-id(.))" /></xsl:attribute>
+ <xsl:apply-templates mode="svg" />
+ </mask>
+ </defs>
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/shapes.xsl b/share/extensions/xaml2svg/shapes.xsl
new file mode 100644
index 0000000..c28b027
--- /dev/null
+++ b/share/extensions/xaml2svg/shapes.xsl
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+Version history:
+
+20070907 Initial release
+20070912 starts-with(@Data, 'F0 ') to strip of F0 from path data
+20070912 nonzero and evenodd were outside xsl:attribute (reported by bulia byak and Ted Gould)
+
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:def="Definition"
+exclude-result-prefixes="def">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template mode="forward" match="*[name(.) = 'Path']">
+ <path>
+ <xsl:if test="@Data">
+ <xsl:attribute name="d">
+ <xsl:choose>
+ <xsl:when test="starts-with(@Data, 'F0 ')"><xsl:value-of select="substring-after(@Data, 'F0 ')" /></xsl:when>
+ <xsl:when test="starts-with(@Data, 'F1 ')"><xsl:value-of select="substring-after(@Data, 'F1 ')" /></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@Data" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@FillRule = 'nonzero' or starts-with(@Data, 'F1 ')"><xsl:attribute name="fill-rule">nonzero</xsl:attribute></xsl:when>
+ <xsl:when test="@FillRule = 'evenodd' or starts-with(@Data, 'F0 ')"><xsl:attribute name="fill-rule">evenodd</xsl:attribute></xsl:when>
+ </xsl:choose>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+ </path>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Path.Data']">
+ <xsl:attribute name="d">
+ <xsl:apply-templates mode="forward" />
+ </xsl:attribute>
+ <xsl:if test="@FillRule">
+ <xsl:attribute name="fill-rule">
+ <xsl:choose>
+ <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>
+ <xsl:otherwise>evenodd</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Line']">
+ <line>
+ <xsl:if test="@X1"><xsl:attribute name="x1"><xsl:value-of select="@X1" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Y1"><xsl:attribute name="y1"><xsl:value-of select="@Y1" /></xsl:attribute></xsl:if>
+ <xsl:if test="@X2"><xsl:attribute name="x2"><xsl:value-of select="@X2" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Y2"><xsl:attribute name="y2"><xsl:value-of select="@Y2" /></xsl:attribute></xsl:if>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+ </line>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Ellipse']">
+ <ellipse>
+ <xsl:if test="@Width">
+ <xsl:attribute name="rx"><xsl:value-of select="@Width div 2" /></xsl:attribute>
+ <xsl:if test="@Canvas.Left">
+ <xsl:attribute name="cx"><xsl:value-of select="@Canvas.Left + @Width div 2" /></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="@Height">
+ <xsl:attribute name="ry"><xsl:value-of select="@Height div 2" /></xsl:attribute>
+ <xsl:if test="@Canvas.Top">
+ <xsl:attribute name="cy"><xsl:value-of select="@Canvas.Top + @Height div 2" /></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+ </ellipse>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Rectangle']">
+ <rect>
+ <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>
+ <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>
+ <xsl:if test="@RadiusX"><xsl:attribute name="rx"><xsl:value-of select="@RadiusX" /></xsl:attribute></xsl:if>
+ <xsl:if test="@RadiusY"><xsl:attribute name="ry"><xsl:value-of select="@RadiusY" /></xsl:attribute></xsl:if>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:call-template name="template_timeline_animations" />
+ <xsl:apply-templates mode="forward" />
+ </rect>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Polyline']">
+ <polyline>
+ <xsl:if test="@Points"><xsl:attribute name="points"><xsl:value-of select="@Points" /></xsl:attribute></xsl:if>
+ <xsl:attribute name="fill-rule">
+ <xsl:choose>
+ <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>
+ <xsl:when test="@FillRule = 'evenodd'">evenodd</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+ </polyline>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Polygon']">
+ <polygon>
+ <xsl:if test="@Points"><xsl:attribute name="points"><xsl:value-of select="@Points" /></xsl:attribute></xsl:if>
+ <xsl:attribute name="fill-rule">
+ <xsl:choose>
+ <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>
+ <xsl:when test="@FillRule = 'evenodd'">evenodd</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:apply-templates mode="forward" />
+ </polygon>
+</xsl:template>
+
+<xsl:template mode="forward" match="*[name(.) = 'Glyphs']">
+ <defs>
+ <font-face>
+ <xsl:attribute name="font-family"><xsl:value-of select="concat('TrueType ', generate-id(.))" /></xsl:attribute>
+ <font-face-src><font-face-uri><xsl:attribute name="xlink:href"><xsl:value-of select="@FontUri" /></xsl:attribute></font-face-uri></font-face-src>
+ </font-face>
+ </defs>
+ <text>
+ <xsl:if test="@FontRenderingEmSize"><xsl:attribute name="font-size"><xsl:value-of select="@FontRenderingEmSize" /></xsl:attribute></xsl:if>
+ <xsl:if test="@OriginX"><xsl:attribute name="x"><xsl:value-of select="@OriginX" /></xsl:attribute></xsl:if>
+ <xsl:if test="@OriginY"><xsl:attribute name="y"><xsl:value-of select="@OriginY" /></xsl:attribute></xsl:if>
+ <xsl:attribute name="font-family"><xsl:value-of select="concat('TrueType ', generate-id(.))" /></xsl:attribute>
+ <xsl:call-template name="template_properties" />
+ <xsl:call-template name="template_transform" />
+ <xsl:if test="@UnicodeString"><xsl:value-of select="@UnicodeString" /></xsl:if>
+ </text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/share/extensions/xaml2svg/transform.xsl b/share/extensions/xaml2svg/transform.xsl
new file mode 100644
index 0000000..3d41cf4
--- /dev/null
+++ b/share/extensions/xaml2svg/transform.xsl
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:svg="http://www.w3.org/2000/svg"
+xmlns:def="Definition"
+exclude-result-prefixes="def">
+<xsl:strip-space elements="*" />
+<xsl:output method="xml" encoding="ISO-8859-1"/>
+
+<xsl:template name="template_transform">
+ <xsl:variable name="transform_value">
+ <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>
+ <xsl:apply-templates select="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]/*" />
+ </xsl:variable>
+ <xsl:if test="string-length($transform_value) &gt; 0"><xsl:attribute name="transform"><xsl:value-of select="$transform_value" /></xsl:attribute></xsl:if>
+</xsl:template>
+
+<xsl:template name="template_gradienttransform">
+ <xsl:variable name="transform_value">
+ <xsl:if test="@Canvas.Left and @Canvas.Top"><xsl:value-of select="concat('translate(', @Canvas.Left, ',', @Canvas.Top, ')')" /></xsl:if>
+ <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>
+ <xsl:apply-templates select="*[name(.) = 'Brush.Transform' or name(.) = concat(name(..), '.Transform')]" />
+ <xsl:apply-templates select="*[name(.) = 'Brush.RelativeTransform' or name(.) = concat(name(..), '.RelativeTransform')]" />
+ </xsl:variable>
+ <xsl:if test="string-length($transform_value) &gt; 0"><xsl:attribute name="gradientTransform"><xsl:value-of select="$transform_value" /></xsl:attribute></xsl:if>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]">
+ <!-- xsl:apply-templates /-->
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'Brush.Transform' or name(.) = concat(name(..), '.Transform')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'Brush.RelativeTransform' or name(.) = concat(name(..), '.RelativeTransform')]">
+ <xsl:apply-templates />
+</xsl:template>
+
+<!--
+<xsl:template match="*[name(.) = 'TransformCollection' or name(.) = 'TransformGroup']">
+ <xsl:apply-templates />
+</xsl:template>
+-->
+<xsl:template match="*[name(.) = 'TransformGroup']">
+ <xsl:apply-templates />
+</xsl:template>
+
+
+<!--
+<xsl:template mode="forward" match="*[name(.) = 'TransformDecorator']">
+ <g>
+ <xsl:attribute name="transform">
+ <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>
+ <xsl:apply-templates select="*[name(.) = 'TransformDecorator.Transform']/*" />
+ </xsl:attribute>
+ <xsl:apply-templates select="*[name(.) = 'TransformDecorator.Transform']/*/*" />
+ <xsl:apply-templates mode="forward" select="*[name(.) != 'TransformDecorator.Transform']" />
+ </g>
+</xsl:template>
+-->
+
+<xsl:template match="*[name(.) = 'TranslateTransform']">
+ <xsl:if test="@X">
+ <xsl:value-of select="concat('translate(', @X)" />
+ <xsl:if test="@Y"><xsl:value-of select="concat(', ', @Y)" /></xsl:if>
+ <xsl:value-of select="') '" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'ScaleTransform']">
+ <xsl:if test="@ScaleX">
+ <xsl:value-of select="concat('scale(', @ScaleX)" />
+ <xsl:if test="@ScaleY"><xsl:value-of select="concat(', ', @ScaleY)" /></xsl:if>
+ <xsl:value-of select="') '" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'RotateTransform']">
+ <xsl:if test="@Angle">
+ <xsl:value-of select="concat('rotate(', @Angle)" />
+ <xsl:if test="@Center"><xsl:value-of select="concat(',', @Center)" /></xsl:if>
+ <xsl:value-of select="') '" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'SkewTransform']">
+ <xsl:if test="@AngleX"><xsl:value-of select="concat('skewX(', @AngleX,') ')" /></xsl:if>
+ <xsl:if test="@AngleY"><xsl:value-of select="concat('skewY(', @AngleY,') ')" /></xsl:if>
+</xsl:template>
+
+<xsl:template match="*[name(.) = 'MatrixTransform']">
+ <xsl:if test="@Matrix"><xsl:value-of select="concat('matrix(', @Matrix,') ')" /></xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>