summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2c297ab)
raw | patch | inline | side by side (parent: 2c297ab)
author | JazzyNico <nicoduf@yahoo.fr> | |
Thu, 6 May 2010 17:03:39 +0000 (19:03 +0200) | ||
committer | JazzyNico <nicoduf@yahoo.fr> | |
Thu, 6 May 2010 17:03:39 +0000 (19:03 +0200) |
share/extensions/svg2xaml.xsl | patch | blob | history |
index 403ff756af0d41ec1b5ccacf4815563f6e247e1a..ef01e2023233e2b0b8fad01c81142c2246dfe1b6 100755 (executable)
<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 mode="desc" match="*">\r
+ <xsl:if test="*[name(.) = 'desc']/text()"><xsl:attribute name="Tag"><xsl:value-of select="*[name(.) = 'desc']/text()" /></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:choose>\r
</xsl:template>\r
\r
-<xsl:template mode="transform" match="*[@transform or @gradientTransform]">\r
+<xsl:template mode="transform" match="*">\r
<xsl:param name="mapped_type" />\r
+ <xsl:if test="@transform or @gradientTransform">\r
<xsl:variable name="transform">\r
<xsl:choose>\r
<xsl:when test="@transform"><xsl:value-of select="@transform" /></xsl:when>\r
</xsl:choose>\r
</xsl:otherwise>\r
</xsl:choose>\r
+ </xsl:if> \r
</xsl:template>\r
\r
<xsl:template mode="clip" match="*">\r
<!--\r
<xsl:apply-templates mode="clip" select="." />\r
-->\r
+ <xsl:if test="@style and contains(@style, 'display:none')"><xsl:attribute name="Visibility">Collapsed</xsl:attribute></xsl:if>\r
+ <xsl:if test="@style and contains(@style, 'opacity:')">\r
+ <xsl:attribute name="Opacity">\r
+ <xsl:choose>\r
+ <xsl:when test="contains(substring-after(@style, 'opacity:'), ';')"><xsl:value-of select="substring-before(substring-after(@style, 'opacity:'), ';')" /></xsl:when>\r
+ <xsl:otherwise><xsl:value-of select="substring-after(@style, 'opacity:')" /></xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:attribute>\r
+ </xsl:if>\r
<xsl:if test="@width and not(contains(@width, '%'))">\r
<xsl:attribute name="Width">\r
<xsl:call-template name="convert_unit">\r
<xsl:template mode="forward" match="*[name(.) = 'image']">\r
<Image>\r
<xsl:apply-templates mode="id" select="." />\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="desc" select="." />\r
+\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">\r
<xsl:with-param name="convert_value" select="@height" />\r
</xsl:call-template>\r
</xsl:attribute></xsl:if>\r
+ <xsl:apply-templates mode="transform" select=".">\r
+ <xsl:with-param name="mapped_type" select="'Image'" />\r
+ </xsl:apply-templates>\r
<!--xsl:apply-templates mode="transform" /-->\r
<xsl:apply-templates mode="forward" />\r
</Image>\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
+\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="clip" select="." />\r
<!--xsl:apply-templates mode="transform" select="." /-->\r
<!--xsl:apply-templates mode="forward" /-->\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
+\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="transform" select=".">\r
<xsl:with-param name="mapped_type" select="'Line'" />\r
</xsl:apply-templates> \r
<xsl:if test="@ry"><xsl:attribute name="RadiusY"><xsl:value-of select="@ry" /></xsl:attribute></xsl:if>\r
<xsl:if test="@rx and not(@ry)"><xsl:attribute name="RadiusX"><xsl:value-of select="@rx" /></xsl:attribute><xsl:attribute name="RadiusY"><xsl:value-of select="@rx" /></xsl:attribute></xsl:if>\r
<xsl:if test="@ry and not(@rx)"><xsl:attribute name="RadiusX"><xsl:value-of select="@ry" /></xsl:attribute><xsl:attribute name="RadiusY"><xsl:value-of select="@ry" /></xsl:attribute></xsl:if>\r
+\r
<xsl:apply-templates mode="id" select="." />\r
<xsl:apply-templates mode="template_fill" select="." />\r
<xsl:apply-templates mode="template_stroke" select="." />\r
\r
<xsl:apply-templates mode="resources" select="." />\r
\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="clip" select="." />\r
\r
<xsl:apply-templates mode="transform" select=".">\r
<xsl:apply-templates mode="stroke_linejoin" select="." />\r
<xsl:apply-templates mode="stroke_linecap" select="." />\r
\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="transform" select=".">\r
<xsl:with-param name="mapped_type" select="'Polygon'" />\r
</xsl:apply-templates>\r
<xsl:apply-templates mode="stroke_linejoin" select="." />\r
<xsl:apply-templates mode="stroke_linecap" select="." />\r
\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="transform" select=".">\r
<xsl:with-param name="mapped_type" select="'Polyline'" />\r
</xsl:apply-templates>\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="desc" select="." />\r
+\r
<xsl:if test="@d">\r
<xsl:choose>\r
<xsl:when test="$silverlight_compatible = 1">\r
<xsl:apply-templates mode="stroke_linejoin" select="." />\r
<xsl:apply-templates mode="stroke_linecap" select="." />\r
\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="clip" select="." />\r
\r
<xsl:apply-templates mode="transform" select=".">\r
<xsl:apply-templates mode="stroke_linejoin" select="." />\r
<xsl:apply-templates mode="stroke_linecap" select="." />\r
\r
+ <xsl:apply-templates mode="desc" select="." />\r
+\r
<xsl:apply-templates mode="clip" select="." />\r
\r
<xsl:apply-templates mode="transform" select=".">\r