svg2xaml.xsl revision b1c372edfc964321a8f7a9c3487e24bb9b170b98
<
xsl:
strip-
space elements="*" />
<
xsl:
output method="xml" encoding="UTF-8" indent="yes"/>
<
xsl:
param name="silverlight_compatible" select="1" />
<
xsl:
when test="$silverlight_compatible = 1">
<
xsl:
apply-
templates mode="forward" />
<
Viewbox Stretch="Uniform">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
template mode="forward" match="*[name(.) = 'svg' or name(.) = 'g']">
<
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']">
<
xsl:
apply-
templates mode="id" select="." />
<xsl:apply-templates mode="clip" select="." /> <
xsl:
if test="@style and contains(@style, 'display:none')">
<
xsl:
attribute name="Visibility">Collapsed</
xsl:
attribute>
<
xsl:
if test="@style and contains(@style, 'opacity:')">
<
xsl:
attribute name="Opacity">
<
xsl:
when test="contains(substring-after(@style, 'opacity:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'opacity:'), ';')" />
<
xsl:
value-
of select="substring-after(@style, 'opacity:')" />
<
xsl:
if test="@width and not(contains(@width, '%'))">
<
xsl:
attribute name="Width">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@width" />
<
xsl:
if test="@height and not(contains(@height, '%'))">
<
xsl:
attribute name="Height">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@height" />
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@x" />
</
xsl:
attribute></
xsl:
if>
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y" />
<
xsl:
variable name="viewBox">
<
xsl:
value-
of select="normalize-space(translate(@viewBox, ',', ' '))" />
<
xsl:
attribute name="Width">
<
xsl:
value-
of select="substring-before(substring-after(substring-after($viewBox, ' '), ' '), ' ')" />
<
xsl:
attribute name="Height">
<
xsl:
value-
of select="substring-after(substring-after(substring-after($viewBox, ' '), ' '), ' ')" />
<
xsl:
value-
of select="-number(substring-before($viewBox, ' '))" />
<
xsl:
value-
of select="-number(substring-before(substring-after($viewBox, ' '), ' '))" />
<
xsl:
if test="@transform">
<
xsl:
apply-
templates mode="transform" select="." />
<
xsl:
apply-
templates mode="forward" select="*" />
<
xsl:
if test="*[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath']">
<
xsl:
apply-
templates mode="forward" select="*[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath']" />
<
xsl:
if test="not(@transform)">
<
xsl:
apply-
templates mode="forward" select="*[name(.) != 'linearGradient' and name(.) != 'radialGradient' and name(.) != 'defs' and name(.) != 'clipPath']" />
<
xsl:
when test="not(@transform)">
<
xsl:
apply-
templates mode="forward" select="*" />
All the matrix, translate, rotate... stuff. Fixme: XAML transforms don't show the same result as SVG ones with the same values. <
xsl:
template name="parse_transform">
<
xsl:
param name="input" />
<!-- Matrix transform --> <
xsl:
when test="starts-with($input, 'matrix(')">
<
xsl:
attribute name="Matrix">
<
xsl:
value-
of select="normalize-space(translate(substring-before(substring-after($input, 'matrix('), ')'), ',', ' '))" />
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="substring-after($input, ') ')" />
<
xsl:
when test="starts-with($input, 'scale(')">
<
xsl:
variable name="scale" select="normalize-space(translate(substring-before(substring-after($input, 'scale('), ')'), ',', ' '))" />
<
xsl:
when test="contains($scale, ' ')">
<
xsl:
attribute name="ScaleX">
<
xsl:
value-
of select="substring-before($scale, ' ')" />
<
xsl:
attribute name="ScaleY">
<
xsl:
value-
of select="substring-after($scale, ' ')" />
<
xsl:
attribute name="ScaleX">
<
xsl:
value-
of select="$scale" />
<
xsl:
attribute name="ScaleY">
<
xsl:
value-
of select="$scale" />
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="substring-after($input, ') ')" />
<!-- Rotate transform --> <
xsl:
when test="starts-with($input, 'rotate(')">
<
xsl:
attribute name="Angle">
<
xsl:
value-
of select="normalize-space(translate(substring-before(substring-after($input, 'rotate('), ')'), ',', ' '))" />
<
xsl:
attribute name="CenterX">
<
xsl:
value-
of select="@rx" />
<
xsl:
attribute name="CenterY">
<
xsl:
value-
of select="@ry" />
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="substring-after($input, ') ')" />
<
xsl:
when test="starts-with($input, 'skewX(')">
<
xsl:
attribute name="AngleX">
<
xsl:
value-
of select="normalize-space(translate(substring-before(substring-after($input, 'skewX('), ')'), ',', ' '))" />
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="substring-after($input, ') ')" />
<
xsl:
when test="starts-with($input, 'skewY(')">
<
xsl:
attribute name="AngleY">
<
xsl:
value-
of select="normalize-space(translate(substring-before(substring-after($input, 'skewY('), ')'), ',', ' '))" />
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="substring-after($input, ') ')" />
<!-- Translate transform --> <
xsl:
when test="starts-with($input, 'translate(')">
<
xsl:
variable name="translate" select="normalize-space(translate(substring-before(substring-after($input, 'translate('), ')'), ',', ' '))" />
<
xsl:
when test="contains($translate, ' ')">
<
xsl:
value-
of select="substring-before($translate, ' ')" />
<
xsl:
value-
of select="substring-after($translate, ' ')" />
<
xsl:
value-
of select="$translate" />
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="substring-after($input, ') ')" />
<
xsl:
template mode="transform" match="*">
<
xsl:
param name="mapped_type" />
<
xsl:
if test="@transform or @gradientTransform">
<
xsl:
variable name="transform">
<
xsl:
when test="@transform">
<
xsl:
value-
of select="@transform" />
<
xsl:
value-
of select="@gradientTransform" />
<
xsl:
variable name="transform_nodes">
<
xsl:
call-
template name="parse_transform">
<
xsl:
with-
param name="input" select="$transform" />
<
xsl:
when test="$mapped_type and $mapped_type != ''">
<
xsl:
element name="{$mapped_type}.RenderTransform">
<
xsl:
when test="count(libxslt:node-set($transform_nodes)/*) = 1">
<
xsl:
copy-
of select="libxslt:node-set($transform_nodes)" />
<
xsl:
when test="count(libxslt:node-set($transform_nodes)/*) > 1">
<
xsl:
copy-
of select="libxslt:node-set($transform_nodes)" />
<
xsl:
when test="count(libxslt:node-set($transform_nodes)/*) = 1">
<
xsl:
copy-
of select="libxslt:node-set($transform_nodes)" />
<
xsl:
when test="count(libxslt:node-set($transform_nodes)/*) > 1">
<
xsl:
copy-
of select="libxslt:node-set($transform_nodes)" />
* Generic filters template <
xsl:
template mode="resources" match="*">
<!-- should be in-depth --> <
xsl:
if test="ancestor::*[name(.) = 'defs']"><
xsl:
attribute name="x:Key"><
xsl:
value-
of select="@id" /></
xsl:
attribute></
xsl:
if>
// Generic defs template // <
xsl:
template mode="forward" match="*[name(.) = 'defs']">
<
xsl:
apply-
templates mode="forward" />
// Generic filters template // Limited to one filter (can be improved) <
xsl:
template mode="forward" match="*[name(.) = 'filter']">
<
xsl:
if test="count(*) = 1">
<
xsl:
apply-
templates mode="forward" />
// GaussianBlur filter effects // Blur values approximated with d = floor(s * 3*sqrt(2*pi)/4 + 0.5) from: * Horizontal and vertical blur. <
xsl:
template mode="forward" match="*[name(.) = 'feGaussianBlur']">
<
xsl:
if test="../@id"><
xsl:
attribute name="x:Key"><
xsl:
value-
of select="../@id" /></
xsl:
attribute></
xsl:
if>
<
xsl:
if test="@stdDeviation">
<
xsl:
variable name="blur" select="normalize-space(translate(@stdDeviation, ',', ' '))" />
<
xsl:
when test="not(contains($blur, ' '))">
<
xsl:
attribute name="Radius">
<
xsl:
value-
of select="floor($blur * 1.88 + 0.5)" />
<
xsl:
attribute name="Radius">
<
xsl:
value-
of select="floor(substring-before($blur, ' ') * 1.88 + 0.5)" />
// Linked filter effect // <
xsl:
template mode="filter_effect" match="*">
<
xsl:
when test="@filter and starts-with(@filter, 'url(#')">
<
xsl:
attribute name="Effect">
<
xsl:
value-
of select="concat('{StaticResource ', substring-before(substring-after(@filter, 'url(#'), ')'), '}')" />
<
xsl:
when test="@style and contains(@style, 'filter:url(#')">
<
xsl:
attribute name="Effect">
<
xsl:
value-
of select="concat('{StaticResource ', substring-before(substring-after(@style, 'filter:url(#'), ')'), '}')" />
<
xsl:
template mode="forward" match="*[name(.) = 'linearGradient']">
<
xsl:
attribute name="x:Key">
<
xsl:
value-
of select="@id" />
<
xsl:
attribute name="MappingMode">
<
xsl:
when test="@gradientUnits = 'userSpaceOnUse' ">Absolute</
xsl:
when>
<
xsl:
otherwise>RelativeToBoundingBox</
xsl:
otherwise>
<
xsl:
if test="@spreadMethod">
<
xsl:
attribute name="SpreadMethod">
<
xsl:
when test="@spreadMethod = 'pad'">Pad</
xsl:
when>
<
xsl:
when test="@spreadMethod = 'reflect'">Reflect</
xsl:
when>
<
xsl:
when test="@spreadMethod = 'repeat'">Repeat</
xsl:
when>
<
xsl:
when test="@x1 and @y1 and @x2 and @y2">
<
xsl:
when test="contains(@x1, '%') and contains(@y1, '%')">
<
xsl:
attribute name="StartPoint">
<
xsl:
value-
of select="concat(substring-before(@x1, '%') div 100, ',', substring-before(@y1,'%') div 100)" />
<
xsl:
attribute name="StartPoint">
<
xsl:
value-
of select="concat(@x1, ',', @y1)" />
<
xsl:
when test="contains(@x2, '%') and contains(@y2, '%')">
<
xsl:
attribute name="EndPoint">
<
xsl:
value-
of select="concat(substring-before(@x2, '%') div 100, ',', substring-before(@y2,'%') div 100)" />
<
xsl:
attribute name="EndPoint">
<
xsl:
value-
of select="concat(@x2, ',', @y2)" />
<
xsl:
attribute name="StartPoint">
<
xsl:
value-
of select="'0,0'" />
<
xsl:
attribute name="EndPoint">
<
xsl:
value-
of select="'1,1'" />
<
xsl:
when test="@xlink:href">
<
xsl:
variable name="reference_id" select="@xlink:href" />
<
xsl:
apply-
templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />
<
xsl:
apply-
templates mode="forward" />
</
GradientStopCollection>
<
xsl:
if test="@gradientTransform">
<
xsl:
apply-
templates mode="transform" select="." />
<
xsl:
template mode="forward" match="*[name(.) = 'radialGradient']">
<
xsl:
attribute name="x:Key">
<
xsl:
value-
of select="@id" />
<
xsl:
attribute name="MappingMode">
<
xsl:
when test="@gradientUnits = 'userSpaceOnUse' ">Absolute</
xsl:
when>
<
xsl:
otherwise>RelativeToBoundingBox</
xsl:
otherwise>
<
xsl:
if test="@spreadMethod">
<
xsl:
attribute name="SpreadMethod">
<
xsl:
when test="@spreadMethod = 'pad'">Pad</
xsl:
when>
<
xsl:
when test="@spreadMethod = 'reflect'">Reflect</
xsl:
when>
<
xsl:
when test="@spreadMethod = 'repeat'">Repeat</
xsl:
when>
<
xsl:
if test="@cx and @cy">
<
xsl:
attribute name="Center">
<
xsl:
when test="contains(@cx, '%') and contains(@cy, '%')">
<
xsl:
value-
of select="concat(number(substring-before(@cx, '%')) div 100, ',', number(substring-before(@cy, '%')) div 100)" />
<
xsl:
value-
of select="concat(@cx, ',', @cy)" />
<
xsl:
if test="@fx and @fy">
<
xsl:
attribute name="GradientOrigin">
<
xsl:
when test="contains(@fx, '%') and contains(@fy, '%')">
<
xsl:
value-
of select="concat(number(substring-before(@fx, '%')) div 100, ',', number(substring-before(@fy, '%')) div 100)" />
<
xsl:
value-
of select="concat(@fx, ',', @fy)" />
<
xsl:
when test="contains(@r, '%')">
<
xsl:
attribute name="RadiusX">
<
xsl:
value-
of select="number(substring-before(@r, '%')) div 100" />
<
xsl:
attribute name="RadiusY">
<
xsl:
value-
of select="number(substring-before(@r, '%')) div 100" />
<
xsl:
attribute name="RadiusX">
<
xsl:
value-
of select="@r" />
<
xsl:
attribute name="RadiusY">
<
xsl:
value-
of select="@r" />
<
xsl:
when test="@xlink:href">
<
xsl:
variable name="reference_id" select="@xlink:href" />
<
xsl:
apply-
templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />
<
xsl:
apply-
templates mode="forward" />
</
GradientStopCollection>
<
xsl:
if test="@gradientTransform">
<
xsl:
apply-
templates mode="transform" select="." />
<
xsl:
template mode="forward" match="*[name(.) = 'stop']">
<!--xsl:apply-templates mode="stop_opacity" select="." /--> <
xsl:
apply-
templates mode="stop_color" select="." />
<
xsl:
apply-
templates mode="offset" select="." />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
template mode="clip" match="*">
<
xsl:
attribute name="Clip">
<
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:
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:
when test="clipPath">
<
xsl:
apply-
templates mode="forward" />
* Decimal to hexadecimal converter * Unit to pixel converter * RDF and foreign objects * Misc ignored stuff (markers, patterns, styles) Removes "-" from the original id <
xsl:
template mode="id" match="*">
<
xsl:
attribute name="Name"><
xsl:
value-
of select="translate(@id, '- ', '')" /></
xsl:
attribute>
<xsl:attribute name="x:Key"><xsl:value-of select="translate(@id, '- ', '')" /></xsl:attribute> // Decimal to hexadecimal converter // <
xsl:
template name="to_hex">
<
xsl:
param name="convert" />
<
xsl:
value-
of select="concat(substring('0123456789ABCDEF', 1 + floor(round($convert) div 16), 1), substring('0123456789ABCDEF', 1 + round($convert) mod 16, 1))" />
// Unit to pixel converter // Values with units (except %) are converted to pixels and rounded. em, ex and % not implemented <
xsl:
template name="convert_unit">
<
xsl:
param name="convert_value" />
<
xsl:
when test="contains($convert_value, 'px')">
<
xsl:
value-
of select="round(translate($convert_value, 'px', ''))" />
<
xsl:
when test="contains($convert_value, 'pt')">
<
xsl:
value-
of select="round(translate($convert_value, 'pt', '') * 1.25)" />
<
xsl:
when test="contains($convert_value, 'pc')">
<
xsl:
value-
of select="round(translate($convert_value, 'pc', '') * 15)" />
<
xsl:
when test="contains($convert_value, 'mm')">
<
xsl:
value-
of select="round(translate($convert_value, 'mm', '') * 3.543307)" />
<
xsl:
when test="contains($convert_value, 'cm')">
<
xsl:
value-
of select="round(translate($convert_value, 'cm', '') * 35.43307)" />
<
xsl:
when test="contains($convert_value, 'in')">
<
xsl:
value-
of select="round(translate($convert_value, 'in', '') * 90)" />
<
xsl:
when test="contains($convert_value, 'ft')">
<
xsl:
value-
of select="round(translate($convert_value, 'ft', '') * 1080)" />
<
xsl:
when test="not(string(number($convert_value))='NaN')">
<
xsl:
value-
of select="round($convert_value)" />
<
xsl:
value-
of select="$convert_value" />
<
xsl:
template mode="desc" match="*">
<
xsl:
if test="*[name(.) = 'desc']/text()">
<
xsl:
attribute name="Tag">
<
xsl:
value-
of select="*[name(.) = 'desc']/text()" />
// Title and description // Title is ignored and desc is converted to Tag in the mode="desc" template <
xsl:
template mode="forward" match="*[name(.) = 'title' or name(.) = 'desc']">
<
xsl:
template mode="forward" match="*[name(.) = 'switch']">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
template mode="forward" match="*[name(.) = 'symbol']">
<
xsl:
attribute name="x:Key">
<
xsl:
value-
of select="@id" />
<
xsl:
apply-
templates mode="forward" />
(since it is not supported by Inkscape, not implemented yet) <
xsl:
template mode="forward" match="*[name(.) = 'use']">
<
xsl:
if test="@xlink:href">
<
xsl:
attribute name="Style">
<
xsl:
value-
of select="@xlink:href" />
<!--xsl:apply-templates mode="transform" select="." /--> <
xsl:
apply-
templates mode="forward" />
// RDF and foreign objects // <
xsl:
template mode="forward" match="rdf:RDF | *[name(.) = 'foreignObject']">
// Misc ignored stuff (markers, patterns, styles) // <
xsl:
template mode="forward" match="*[name(.) = 'marker' or name(.) = 'pattern' or name(.) = 'style']">
With generic and mode="forward" templates <
xsl:
value-
of select="concat('Unknown tag: ', name(.))" />
<
xsl:
template mode="forward" match="*">
<
xsl:
value-
of select="concat('Unknown tag: ', name(.))" />
// Colors and patterns // * Generic stroke template * Linejoin SVG to XAML converter * Linecap SVG to XAML converter // Generic color template // <
xsl:
template name="template_color">
<
xsl:
param name="colorspec" />
<
xsl:
param name="opacityspec" />
<
xsl:
when test="starts-with($colorspec, 'rgb(') and not(contains($colorspec , '%'))">
<
xsl:
value-
of select="'#'" />
<
xsl:
if test="$opacityspec != '' and number($opacityspec) != 1">
<
xsl:
call-
template name="to_hex">
<
xsl:
with-
param name="convert">
<
xsl:
value-
of select="round(number($opacityspec) * 255)" />
<
xsl:
call-
template name="to_hex">
<
xsl:
with-
param name="convert">
<
xsl:
value-
of select="substring-before(substring-after($colorspec, 'rgb('), ',')" />
<
xsl:
call-
template name="to_hex">
<
xsl:
with-
param name="convert">
<
xsl:
value-
of select="substring-before(substring-after(substring-after($colorspec, 'rgb('), ','), ',')" />
<
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:
when test="starts-with($colorspec, 'rgb(') and contains($colorspec , '%')">
<
xsl:
value-
of select="'#'" />
<
xsl:
if test="$opacityspec != '' and number($opacityspec) != 1">
<
xsl:
call-
template name="to_hex">
<
xsl:
with-
param name="convert">
<
xsl:
value-
of select="round(number($opacityspec) * 255)" />
<
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:
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:
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:
when test="starts-with($colorspec, '#')">
<
xsl:
value-
of select="'#'" />
<
xsl:
if test="$opacityspec != ''">
<
xsl:
call-
template name="to_hex">
<
xsl:
with-
param name="convert">
<
xsl:
value-
of select="round(number($opacityspec) * 255)" />
<
xsl:
when test="string-length(substring-after($colorspec, '#')) = 3">
<
xsl:
variable name="colorspec3">
<
xsl:
value-
of select="translate(substring-after($colorspec, '#'), 'abcdefgh', 'ABCDEFGH')" />
<
xsl:
value-
of select="concat(substring($colorspec3, 1, 1), substring($colorspec3, 1, 1))" />
<
xsl:
value-
of select="concat(substring($colorspec3, 2, 1), substring($colorspec3, 2, 1))" />
<
xsl:
value-
of select="concat(substring($colorspec3, 3, 1), substring($colorspec3, 3, 1))" />
<
xsl:
value-
of select="translate(substring-after($colorspec, '#'), 'abcdefgh', 'ABCDEFGH')" />
<
xsl:
variable name="named_color_hex" select="document('colors.xml')/colors/color[@name = translate($colorspec, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]/@hex" />
<
xsl:
when test="$named_color_hex and $named_color_hex != ''">
<
xsl:
value-
of select="'#'" />
<
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:
value-
of select="substring-after($named_color_hex, '#')" />
<
xsl:
value-
of select="$colorspec" />
<
xsl:
template mode="fill" match="*">
<
xsl:
variable name="value">
<
xsl:
when test="@fill and starts-with(@fill, 'url(#')">
<
xsl:
value-
of select="concat('{StaticResource ', substring-before(substring-after(@fill, 'url(#'), ')'), '}')" />
<
xsl:
value-
of select="@fill" />
<
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 test="@style and contains(@style, 'fill:')">
<
xsl:
variable name="Fill" select="substring-after(@style, 'fill:')" />
<
xsl:
when test="contains($Fill, ';')">
<
xsl:
value-
of select="substring-before($Fill, ';')" />
<
xsl:
value-
of select="$Fill" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="fill" select="parent::*"/>
<!-- Removes unwanted characters in the color link (TODO: export to a specific template)--> <
xsl:
value-
of select="normalize-space(translate($value, '"', ''))" />
<
xsl:
template mode="fill_opacity" match="*">
<
xsl:
variable name="value">
<
xsl:
when test="@fill-opacity">
<
xsl:
value-
of select="@fill-opacity" />
<
xsl:
when test="@style and contains(@style, 'fill-opacity:')">
<
xsl:
variable name="Opacity" select="substring-after(@style, 'fill-opacity:')" />
<
xsl:
when test="contains($Opacity, ';')">
<
xsl:
value-
of select="substring-before($Opacity, ';')" />
<
xsl:
value-
of select="$Opacity" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="fill_opacity" select="parent::*" />
<
xsl:
otherwise>1</
xsl:
otherwise>
<
xsl:
when test="$value < 0">0</
xsl:
when>
<
xsl:
when test="$value > 1">1</
xsl:
when>
<
xsl:
value-
of select="$value" />
<
xsl:
template mode="fill_rule" match="*">
<
xsl:
when test="@fill-rule and (@fill-rule = 'nonzero' or @fill-rule = 'evenodd')">
<
xsl:
attribute name="FillRule">
<
xsl:
value-
of select="@fill-rule" />
<
xsl:
when test="@style and contains(@style, 'fill-rule:')">
<
xsl:
variable name="FillRule" select="normalize-space(substring-after(@style, 'fill-rule:'))" />
<
xsl:
when test="contains($FillRule, ';')">
<
xsl:
if test="substring-before($FillRule, ';') = 'nonzero' or substring-before($FillRule, ';') = 'evenodd'">
<
xsl:
attribute name="FillRule">
<
xsl:
value-
of select="substring-before($FillRule, ';')" />
<
xsl:
when test="$FillRule = 'nonzero' or $FillRule = 'evenodd'">
<
xsl:
attribute name="FillRule">
<
xsl:
value-
of select="$FillRule" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="fill_rule" select="parent::*"/>
<
xsl:
attribute name="FillRule">NonZero</
xsl:
attribute>
// Generic fill template // <
xsl:
template mode="template_fill" match="*">
<
xsl:
variable name="fill"><
xsl:
apply-
templates mode="fill" select="." /></
xsl:
variable>
<
xsl:
variable name="fill_opacity"><
xsl:
apply-
templates mode="fill_opacity" select="." /></
xsl:
variable>
<
xsl:
if test="not($fill = 'none')">
<
xsl:
attribute name="Fill">
<
xsl:
when test="$fill != ''">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
if test="$fill != 'none'">
<
xsl:
value-
of select="$fill" />
<
xsl:
with-
param name="opacityspec">
<
xsl:
value-
of select="$fill_opacity" />
<
xsl:
otherwise>#000000</
xsl:
otherwise>
<
xsl:
template mode="stroke" match="*">
<
xsl:
when test="@stroke and starts-with(@stroke, 'url(#')">
<
xsl:
value-
of select="concat('{StaticResource ', substring-before(substring-after(@stroke, 'url(#'), ')'), '}')" />
<
xsl:
when test="@stroke and @stroke != 'none'">
<
xsl:
value-
of select="@stroke" />
<
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 test="@style and contains(@style, 'stroke:')">
<
xsl:
variable name="Stroke" select="substring-after(@style, 'stroke:')" />
<
xsl:
when test="contains($Stroke, ';')">
<
xsl:
if test="substring-before($Stroke, ';') != 'none'">
<
xsl:
value-
of select="substring-before($Stroke, ';')" />
<
xsl:
when test="$Stroke != 'none'">
<
xsl:
value-
of select="$Stroke" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke" select="parent::*"/>
<
xsl:
template mode="stroke_opacity" match="*">
<
xsl:
variable name="value">
<
xsl:
when test="@stroke-opacity">
<
xsl:
value-
of select="@stroke-opacity" />
<
xsl:
when test="@style and contains(@style, 'stroke-opacity:')">
<
xsl:
variable name="Opacity" select="substring-after(@style, 'stroke-opacity:')" />
<
xsl:
when test="contains($Opacity, ';')">
<
xsl:
value-
of select="substring-before($Opacity, ';')" />
<
xsl:
value-
of select="$Opacity" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_opacity" select="parent::*" />
<
xsl:
otherwise>1</
xsl:
otherwise>
<
xsl:
when test="$value < 0">0</
xsl:
when>
<
xsl:
when test="$value > 1">1</
xsl:
when>
<
xsl:
value-
of select="$value" />
// Generic stroke template // <
xsl:
template mode="template_stroke" match="*">
<
xsl:
variable name="stroke">
<
xsl:
apply-
templates mode="stroke" select="." />
<
xsl:
variable name="stroke_opacity">
<
xsl:
apply-
templates mode="stroke_opacity" select="." />
<
xsl:
variable name="stroke_width">
<
xsl:
apply-
templates mode="stroke_width" select="." />
<
xsl:
if test="$stroke_width != ''">
<
xsl:
attribute name="StrokeThickness">
<
xsl:
value-
of select="$stroke_width" />
<
xsl:
if test="$stroke != ''">
<
xsl:
attribute name="Stroke">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$stroke" />
<
xsl:
with-
param name="opacityspec">
<
xsl:
value-
of select="$stroke_opacity" />
<
xsl:
template mode="stroke_width" match="*">
<
xsl:
when test="@stroke-width">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value">
<
xsl:
value-
of select="@stroke-width" />
<
xsl:
when test="@style and contains(@style, 'stroke-width:')">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value">
<
xsl:
when test="contains(substring-after(@style, 'stroke-width:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'stroke-width:'), ';')" />
<
xsl:
value-
of select="substring-after(@style, 'stroke-width:')" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_width" select="parent::*"/>
<
xsl:
template mode="stroke_miterlimit" match="*">
<
xsl:
when test="@stroke-miterlimit">
<
xsl:
attribute name="StrokeMiterLimit">
<
xsl:
value-
of select="@stroke-miterlimit" />
<
xsl:
when test="@style and contains(@style, 'stroke-miterlimit:')">
<
xsl:
variable name="StrokeMiterLimit" select="substring-after(@style, 'stroke-miterlimit:')" />
<
xsl:
attribute name="StrokeMiterLimit">
<
xsl:
when test="contains($StrokeMiterLimit, ';')">
<
xsl:
value-
of select="substring-before($StrokeMiterLimit, ';')" />
<
xsl:
value-
of select="$StrokeMiterLimit" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_miterlimit" select="parent::*"/>
<
xsl:
template mode="stroke_dasharray" match="*">
<!-- stroke-dasharray="10,30,20,30" becomes StrokeDashArray="1 3 2 3" ?? --> <
xsl:
when test="@stroke-dasharray and @stroke-dasharray != 'none'">
<
xsl:
attribute name="StrokeDashArray">
<
xsl:
value-
of select="@stroke-dasharray" />
<
xsl:
when test="@style and contains(@style, 'stroke-dasharray:')">
<
xsl:
variable name="StrokeDashArray" select="substring-after(@style, 'stroke-dasharray:')" />
<
xsl:
when test="contains($StrokeDashArray, ';')">
<
xsl:
if test="substring-before($StrokeDashArray, ';') != 'none'">
<
xsl:
attribute name="StrokeDashArray">
<
xsl:
value-
of select="substring-before($StrokeDashArray, ';')" />
<
xsl:
when test="$StrokeDashArray != 'none'">
<
xsl:
attribute name="StrokeDashArray">
<
xsl:
value-
of select="$StrokeDashArray" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_dasharray" select="parent::*"/>
<
xsl:
template mode="stroke_dashoffset" match="*">
<
xsl:
when test="@stroke-dashoffset">
<
xsl:
attribute name="StrokeDashOffset">
<
xsl:
value-
of select="@stroke-dashoffset" />
<
xsl:
when test="@style and contains(@style, 'stroke-dashoffset:')">
<
xsl:
variable name="StrokeDashOffset" select="substring-after(@style, 'stroke-dashoffset:')" />
<
xsl:
attribute name="StrokeDashOffset">
<
xsl:
when test="contains($StrokeDashOffset, ';')">
<
xsl:
value-
of select="substring-before($StrokeDashOffset, ';')" />
<
xsl:
value-
of select="$StrokeDashOffset" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_dashoffset" select="parent::*"/>
// Linejoin SVG to XAML converter // <
xsl:
template name="linejoin_svg_to_xaml">
<
xsl:
param name="linejoin" />
<
xsl:
when test="$linejoin = 'bevel'">Bevel</
xsl:
when>
<
xsl:
when test="$linejoin = 'round'">Round</
xsl:
when>
<
xsl:
otherwise>Miter</
xsl:
otherwise>
<
xsl:
template mode="stroke_linejoin" match="*">
<
xsl:
when test="@stroke-miterlimit">
<
xsl:
attribute name="StrokeLineJoin">
<
xsl:
call-
template name="linejoin_svg_to_xaml">
<
xsl:
with-
param name="linejoin">
<
xsl:
value-
of select="@stroke-linejoin" />
<
xsl:
when test="@style and contains(@style, 'stroke-linejoin:')">
<
xsl:
variable name="StrokeLineJoin" select="substring-after(@style, 'stroke-linejoin:')" />
<
xsl:
attribute name="StrokeLineJoin">
<
xsl:
when test="contains($StrokeLineJoin, ';')">
<
xsl:
call-
template name="linejoin_svg_to_xaml">
<
xsl:
with-
param name="linejoin">
<
xsl:
value-
of select="substring-before($StrokeLineJoin, ';')" />
<
xsl:
call-
template name="linejoin_svg_to_xaml">
<
xsl:
with-
param name="linejoin">
<
xsl:
value-
of select="$StrokeLineJoin" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_linejoin" select="parent::*"/>
// Linecap SVG to XAML converter // <
xsl:
template name="linecap_svg_to_xaml">
<
xsl:
param name="linecap" />
<
xsl:
when test="$linecap = 'round'">Round</
xsl:
when>
<
xsl:
when test="$linecap = 'square'">Square</
xsl:
when>
<
xsl:
otherwise>Flat</
xsl:
otherwise>
<
xsl:
template mode="stroke_linecap" match="*">
<
xsl:
when test="@stroke-linecap">
<
xsl:
attribute name="StrokeStartLineCap">
<
xsl:
call-
template name="linecap_svg_to_xaml">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="@stroke-linecap" />
<
xsl:
attribute name="StrokeEndLineCap">
<
xsl:
call-
template name="linecap_svg_to_xaml">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="@stroke-linecap" />
<
xsl:
when test="@style and contains(@style, 'stroke-linecap:')">
<
xsl:
variable name="StrokeStartLineCap" select="substring-after(@style, 'stroke-linecap:')" />
<
xsl:
variable name="StrokeEndLineCap" select="substring-after(@style, 'stroke-linecap:')" />
<
xsl:
attribute name="StrokeStartLineCap">
<
xsl:
when test="contains($StrokeStartLineCap, ';')">
<
xsl:
call-
template name="linecap_svg_to_xaml">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="substring-before($StrokeStartLineCap, ';')" />
<
xsl:
call-
template name="linecap_svg_to_xaml">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="$StrokeStartLineCap" />
<
xsl:
attribute name="StrokeEndLineCap">
<
xsl:
when test="contains($StrokeEndLineCap, ';')">
<
xsl:
call-
template name="linecap_svg_to_xaml">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="substring-before($StrokeEndLineCap, ';')" />
<
xsl:
call-
template name="linecap_svg_to_xaml">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="$StrokeEndLineCap" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_linecap" select="parent::*"/>
<
xsl:
template mode="stop_color" match="*">
<
xsl:
variable name="Opacity">
<
xsl:
when test="@stop-opacity">
<
xsl:
value-
of select="@stop-opacity" />
<
xsl:
when test="@style and contains(@style, 'stop-opacity:')">
<
xsl:
variable name="temp_opacity" select="substring-after(@style, 'stop-opacity:')" />
<
xsl:
when test="contains($temp_opacity, ';')">
<
xsl:
value-
of select="substring-before($temp_opacity, ';')" />
<
xsl:
value-
of select="$temp_opacity" />
<
xsl:
value-
of select="''" />
<
xsl:
variable name="hex_opacity">
<
xsl:
when test="$Opacity != ''">
<
xsl:
call-
template name="to_hex">
<
xsl:
with-
param name="convert">
<
xsl:
value-
of select="number($Opacity) * 255" />
<
xsl:
value-
of select="$Opacity" />
<
xsl:
variable name="stopcolor">
<
xsl:
when test="@stop-color">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="@stop-color" />
<
xsl:
when test="@style and contains(@style, 'stop-color:')">
<
xsl:
variable name="Color" select="substring-after(@style, 'stop-color:')" />
<
xsl:
when test="contains($Color, ';')">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="substring-before($Color, ';')" />
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$Color" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stop_color" select="parent::*"/>
<
xsl:
otherwise>#000</
xsl:
otherwise>
<
xsl:
attribute name="Color">
<
xsl:
when test="$hex_opacity != '' and starts-with($stopcolor, '#')">
<
xsl:
value-
of select="concat('#', $hex_opacity, substring-after($stopcolor, '#'))" />
<
xsl:
value-
of select="$stopcolor" />
// Gradient stop opacity // <
xsl:
template mode="stop_opacity" match="*">
<
xsl:
when test="@stop-opacity">
<
xsl:
attribute name="Opacity">
<
xsl:
value-
of select="@stop-opacity" />
<
xsl:
when test="@style and contains(@style, 'stop-opacity:')">
<
xsl:
variable name="Opacity" select="substring-after(@style, 'stop-opacity:')" />
<
xsl:
attribute name="Opacity">
<
xsl:
when test="contains($Opacity, ';')">
<
xsl:
value-
of select="substring-before($Opacity, ';')" />
<
xsl:
value-
of select="$Opacity" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stop_opacity" select="parent::*"/>
// Gradient stop offset // <
xsl:
template mode="offset" match="*">
<
xsl:
when test="@offset">
<
xsl:
attribute name="Offset">
<
xsl:
when test="contains(@offset, '%')">
<
xsl:
value-
of select="number(substring-before(@offset, '%')) div 100" />
<
xsl:
value-
of select="@offset" />
<
xsl:
when test="@style and contains(@style, 'offset:')">
<
xsl:
variable name="Offset" select="substring-after(@style, 'offset:')" />
<
xsl:
attribute name="Offset">
<
xsl:
when test="contains($Offset, '%')">
<
xsl:
value-
of select="number(substring-before($Offset, '%')) div 100" />
<
xsl:
when test="contains($Offset, ';')">
<
xsl:
value-
of select="substring-before($Offset, ';')" />
<
xsl:
value-
of select="$Offset" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stop_offset" select="parent::*"/>
// Text specific templates // * Text flowRegion (text frame) SVG: tspan, flowSpan, FXG: span <
xsl:
template mode="forward" match="*[name(.) = 'tspan' or name(.) = 'flowSpan']">
<
xsl:
if test="../@xml:space='preserve'">
<
xsl:
attribute name="whiteSpaceCollapse">preserve</
xsl:
attribute>
<
xsl:
variable name="fill">
<
xsl:
apply-
templates mode="fill" select="." />
<
xsl:
variable name="fill_opacity">
<
xsl:
apply-
templates mode="fill_opacity" select="." />
<
xsl:
if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
<
xsl:
attribute name="color">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$fill" />
<
xsl:
attribute name="textAlpha">
<
xsl:
value-
of select="$fill_opacity" />
<
xsl:
apply-
templates mode="font_size" select="." />
<
xsl:
apply-
templates mode="font_weight" select="." />
<
xsl:
apply-
templates mode="font_family" select="." />
<
xsl:
apply-
templates mode="font_style" select="." />
<
xsl:
apply-
templates mode="text_fill" select="." />
<
xsl:
apply-
templates mode="text_decoration" select="." />
<
xsl:
apply-
templates mode="line_height" select="." />
<
xsl:
apply-
templates mode="baseline_shift" select="." />
<
xsl:
value-
of select="text()" />
SVG: flowPara, flowDiv FXG: p <
xsl:
template mode="forward" match="*[name(.) = 'flowPara' or name(.) = 'flowDiv']">
<
xsl:
if test="../@xml:space='preserve'">
<
xsl:
attribute name="whiteSpaceCollapse">preserve</
xsl:
attribute>
<
xsl:
variable name="fill">
<
xsl:
apply-
templates mode="fill" select="." />
<
xsl:
variable name="fill_opacity">
<
xsl:
apply-
templates mode="fill_opacity" select="." />
<
xsl:
if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
<
xsl:
attribute name="color">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$fill" />
<
xsl:
attribute name="textAlpha">
<
xsl:
value-
of select="$fill_opacity" />
<
xsl:
apply-
templates mode="font_size" select="." />
<
xsl:
apply-
templates mode="font_weight" select="." />
<
xsl:
apply-
templates mode="font_family" select="." />
<
xsl:
apply-
templates mode="font_style" select="." />
<
xsl:
apply-
templates mode="text_fill" select="." />
<
xsl:
apply-
templates mode="text_decoration" select="." />
<
xsl:
apply-
templates mode="line_height" select="." />
<
xsl:
apply-
templates mode="baseline_shift" select="." />
<
xsl:
when test="*[name(.) = 'flowSpan']/text()">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
when test="@xml:space='preserve'">
<
xsl:
copy-
of select="translate(text(), '	

', ' ')" />
<
xsl:
copy-
of select="normalize-space(translate(text(), '	

', ' '))" />
<
xsl:
template mode="flow_region" match="*">
<
xsl:
apply-
templates mode="text_size" select="." />
<
xsl:
apply-
templates mode="text_position" select="." />
<
xsl:
template mode="get_font_size" match="*">
<
xsl:
when test="@font-size">
<
xsl:
value-
of select="@font-size" />
<
xsl:
when test="@style and contains(@style, 'font-size:')">
<
xsl:
variable name="font_size" select="normalize-space(substring-after(@style, 'font-size:'))" />
<
xsl:
when test="contains($font_size, ';')">
<
xsl:
value-
of select="substring-before($font_size, ';')" />
<
xsl:
value-
of select="$font_size" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="get_font_size" select="parent::*"/>
SVG: font-size, XAML: FontSize <
xsl:
template mode="font_size" match="*">
<
xsl:
variable name="value">
<
xsl:
apply-
templates mode="get_font_size" select="." />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="FontSize">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="$value" />
<
xsl:
attribute name="FontSize">
<
xsl:
when test="$value != ''">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="$value" />
<
xsl:
otherwise>12</
xsl:
otherwise>
SVG: font-weight, XAML: FontWeight <
xsl:
template mode="font_weight" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@font-weight">
<
xsl:
value-
of select="@font-weight" />
<
xsl:
if test="@style and contains(@style, 'font-weight:')">
<
xsl:
variable name="font_weight" select="normalize-space(substring-after(@style, 'font-weight:'))" />
<
xsl:
when test="contains($font_weight, ';')">
<
xsl:
value-
of select="substring-before($font_weight, ';')" />
<
xsl:
value-
of select="$font_weight" />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="FontWeight">
<
xsl:
when test="$value <= 100 or $value = 'lighter'">Thin</
xsl:
when>
<
xsl:
when test="$value > 100 and $value <= 200">ExtraLight</
xsl:
when>
<
xsl:
when test="$value > 200 and $value <= 300">Light</
xsl:
when>
<
xsl:
when test="($value > 300 and $value <= 400) or $value ='normal'">Normal</
xsl:
when>
<
xsl:
when test="$value > 400 and $value <= 500">Medium</
xsl:
when>
<
xsl:
when test="$value > 500 and $value <= 600">SemiBold</
xsl:
when>
<
xsl:
when test="($value > 600 and $value <= 700) or $value ='bold'">Bold</
xsl:
when>
<
xsl:
when test="$value > 700 and $value <= 800">ExtraBold</
xsl:
when>
<
xsl:
when test="$value > 800 and $value <= 900">Black</
xsl:
when>
<
xsl:
when test="$value > 900 or $value = 'bolder'">ExtraBlack</
xsl:
when>
<
xsl:
otherwise>normal</
xsl:
otherwise>
SVG: font-family, XAML: FontFamily <
xsl:
template mode="font_family" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@font-family">
<
xsl:
value-
of select="translate(@font-family, "'", '')" />
<
xsl:
if test="@style and contains(@style, 'font-family:')">
<
xsl:
variable name="font_family" select="normalize-space(substring-after(@style, 'font-family:'))" />
<
xsl:
when test="contains($font_family, ';')">
<
xsl:
value-
of select="translate(substring-before($font_family, ';'), "'", '')" />
<
xsl:
value-
of select="translate($font_family, "'", '')" />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="FontFamily">
<
xsl:
when test="$value='Sans'">Arial</
xsl:
when>
<
xsl:
value-
of select="$value" />
SVG: font-style, XAML: FontStyle <
xsl:
template mode="font_style" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@font-style">
<
xsl:
value-
of select="@font-style" />
<
xsl:
if test="@style and contains(@style, 'font-style:')">
<
xsl:
variable name="font_style" select="normalize-space(substring-after(@style, 'font-style:'))" />
<
xsl:
when test="contains($font_style, ';')">
<
xsl:
value-
of select="substring-before($font_style, ';')" />
<
xsl:
value-
of select="$font_style" />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="FontStyle">
<
xsl:
value-
of select="$value" />
// Text baseline shift // SVG: baseline-shift, FXG: baselineShift <
xsl:
template mode="baseline_shift" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@baseline-shift">
<
xsl:
value-
of select="@baseline-shift" />
<
xsl:
if test="@style and contains(@style, 'baseline-shift:') and not(contains(substring-after(@style, 'baseline-shift:'), ';'))">
<
xsl:
value-
of select="substring-after(@style, 'baseline-shift:')" />
<
xsl:
if test="@style and contains(@style, 'baseline-shift:') and contains(substring-after(@style, 'baseline-shift:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'baseline-shift:'), ';')" />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="baselineShift">
<
xsl:
when test="$value='baseline'">0</
xsl:
when>
<
xsl:
when test="$value='super'">superscript</
xsl:
when>
<
xsl:
when test="$value='sub'">subscript</
xsl:
when>
<
xsl:
when test="translate($value, '%', '') < -1000">-1000</
xsl:
when>
<
xsl:
when test="translate($value, '%', '') > 1000">1000</
xsl:
when>
<
xsl:
value-
of select="translate($value, '%', '')" />
<
xsl:
if test="contains($value, '%')">%</
xsl:
if>
SVG: line-height, FXG: lineHeight <
xsl:
template mode="line_height" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@line-height">
<
xsl:
value-
of select="@line-height" />
<
xsl:
if test="@style and contains(@style, 'line-height:')">
<
xsl:
variable name="line_height" select="normalize-space(substring-after(@style, 'line-height:'))" />
<
xsl:
when test="contains($line_height, ';')">
<
xsl:
value-
of select="substring-before($line_height, ';')" />
<
xsl:
value-
of select="$line_height" />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="lineHeight">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="$value" />
SVG: writing-mode, FXG: blockProgression Values inverted in FXG... <
xsl:
template mode="writing_mode" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@writing-mode">
<
xsl:
value-
of select="@writing-mode" />
<
xsl:
if test="@style and contains(@style, 'writing-mode:') and not(contains(substring-after(@style, 'writing-mode:'), ';'))">
<
xsl:
value-
of select="substring-after(@style, 'writing-mode:')" />
<
xsl:
if test="@style and contains(@style, 'writing-mode:') and contains(substring-after(@style, 'writing-mode:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'writing-mode:'), ';')" />
<
xsl:
if test="$value != ''">
<
xsl:
attribute name="blockProgression">
<
xsl:
when test="$value='tb'">rl</
xsl:
when>
<
xsl:
otherwise>tb</
xsl:
otherwise>
<
xsl:
if test="$value='tb'">
<
xsl:
attribute name="textRotation">rotate270</
xsl:
attribute>
SVG: text-decoration, FXG: textDecoration, lineThrough <
xsl:
template mode="text_decoration" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@text-decoration">
<
xsl:
value-
of select="@text-decoration" />
<
xsl:
if test="@style and contains(@style, 'text-decoration:') and not(contains(substring-after(@style, 'text-decoration:'), ';'))">
<
xsl:
value-
of select="substring-after(@style, 'text-decoration:')" />
<
xsl:
if test="@style and contains(@style, 'text-decoration:') and contains(substring-after(@style, 'text-decoration:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'text-decoration:'), ';')" />
<
xsl:
if test="$value != ''">
<
xsl:
when test="$value='underline'">
<
xsl:
attribute name="textDecoration">underline</
xsl:
attribute>
<
xsl:
when test="$value='line-through'">
<
xsl:
attribute name="lineThrough">true</
xsl:
attribute>
SVG: fill, fill-opacity, XAML: Foreground <
xsl:
template mode="text_fill" match="*">
<
xsl:
variable name="fill">
<
xsl:
apply-
templates mode="fill" select="." />
<
xsl:
variable name="fill_opacity">
<
xsl:
apply-
templates mode="fill_opacity" select="." />
<
xsl:
if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
<
xsl:
attribute name="Foreground">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$fill" />
<
xsl:
with-
param name="opacityspec">
<
xsl:
when test="$fill_opacity">
<
xsl:
value-
of select="$fill_opacity" />
<
xsl:
otherwise>1</
xsl:
otherwise>
SVG: direction, unicode-bidi, FXG: direction <
xsl:
template mode="direction" match="*">
<
xsl:
variable name="value">
<
xsl:
if test="@direction">
<
xsl:
value-
of select="@direction" />
<
xsl:
if test="@style and contains(@style, 'direction:') and not(contains(substring-after(@style, 'direction:'), ';'))">
<
xsl:
value-
of select="substring-after(@style, 'direction:')" />
<
xsl:
if test="@style and contains(@style, 'direction:') and contains(substring-after(@style, 'direction:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'direction:'), ';')" />
<
xsl:
variable name="bidi">
<
xsl:
if test="@unicode-bidi">
<
xsl:
value-
of select="@unicode-bidi" />
<
xsl:
if test="@style and contains(@style, 'unicode-bidi:') and not(contains(substring-after(@style, 'unicode-bidi:'), ';'))">
<
xsl:
value-
of select="substring-after(@style, 'unicode-bidi:')" />
<
xsl:
if test="@style and contains(@style, 'unicode-bidi:') and contains(substring-after(@style, 'unicode-bidi:'), ';')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'unicode-bidi:'), ';')" />
<
xsl:
if test="$value != '' and ($bidi='embed' or $bidi='bidi-override')">
<
xsl:
attribute name="direction">
<
xsl:
when test="$value='ltr'">ltr</
xsl:
when>
<
xsl:
when test="$value='rtl'">rtl</
xsl:
when>
<
xsl:
template mode="text_size" match="*">
<
xsl:
attribute name="Width">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@width" />
<
xsl:
attribute name="Height">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@height" />
<
xsl:
template mode="text_position" match="*">
<!-- Keep the first x value only --> <
xsl:
when test="contains(@x, ' ')">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="substring-before(@x, ' ')" />
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@x" />
<!-- Keep the first y value only --> <
xsl:
variable name="top_val">
<
xsl:
when test="contains(@y, ' ')">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="substring-before(@y, ' ')" />
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y" />
<
xsl:
variable name="size_val">
<
xsl:
variable name="value">
<
xsl:
apply-
templates mode="get_font_size" select="." />
<
xsl:
when test="$value != ''">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="$value" />
<
xsl:
otherwise>12</
xsl:
otherwise>
<
xsl:
if test="$top_val != '' and $size_val != ''">
<
xsl:
value-
of select="$top_val - $size_val" />
SVG: text, XAML: TextBlock <
xsl:
template mode="forward" match="*[name(.) = 'text']">
<
xsl:
apply-
templates mode="font_size" select="." />
<
xsl:
apply-
templates mode="font_weight" select="." />
<
xsl:
apply-
templates mode="font_family" select="." />
<
xsl:
apply-
templates mode="font_style" select="." />
<
xsl:
apply-
templates mode="text_fill" select="." />
<
xsl:
apply-
templates mode="text_size" select="." />
<
xsl:
apply-
templates mode="text_position" select="." />
<
xsl:
if test="@text-anchor">
<
xsl:
attribute name="HorizontalAlignment">
<
xsl:
when test="@text-anchor = 'start'">Left</
xsl:
when>
<
xsl:
when test="@text-anchor = 'middle'">Center</
xsl:
when>
<
xsl:
when test="@text-anchor = 'end'">Right</
xsl:
when>
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="clip" select="." />
<!--xsl:apply-templates mode="transform" select="." /--> <!--xsl:apply-templates mode="forward" /--> <
xsl:
when test="*[name(.) = 'tspan']/text()">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
when test="@xml:space='preserve'">
<
xsl:
copy-
of select="translate(text(), '	

', ' ')" />
<
xsl:
copy-
of select="normalize-space(translate(text(), '	

', ' '))" />
<
xsl:
template mode="forward" match="*[name(.) = 'line']">
<
xsl:
attribute name="X1">
<
xsl:
value-
of select="@x1" />
<
xsl:
attribute name="Y1">
<
xsl:
value-
of select="@y1" />
<
xsl:
attribute name="X2">
<
xsl:
value-
of select="@x2" />
<
xsl:
attribute name="Y2">
<
xsl:
value-
of select="@y2" />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Line'" />
<
xsl:
apply-
templates mode="forward" />
SVG: rect, XAML: Rectangle <
xsl:
template mode="forward" match="*[name(.) = 'rect']">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@x" />
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y" />
<
xsl:
attribute name="Width">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@width" />
<
xsl:
attribute name="Height">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@height" />
<
xsl:
attribute name="RadiusX">
<
xsl:
value-
of select="@rx" />
<
xsl:
attribute name="RadiusY">
<
xsl:
value-
of select="@ry" />
<
xsl:
if test="@rx and not(@ry)">
<
xsl:
attribute name="RadiusX">
<
xsl:
value-
of select="@rx" />
<
xsl:
attribute name="RadiusY">
<
xsl:
value-
of select="@rx" />
<
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>
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="resources" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="clip" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Rectangle'" />
<
xsl:
apply-
templates mode="forward" />
SVG: polygon, XAML: Polygon <
xsl:
template mode="forward" match="*[name(.) = 'polygon']">
<
xsl:
if test="@points"><
xsl:
attribute name="Points"><
xsl:
value-
of select="@points" /></
xsl:
attribute></
xsl:
if>
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="fill_rule" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Polygon'" />
<
xsl:
apply-
templates mode="forward" />
SVG: polyline, XAML: Polyline <
xsl:
template mode="forward" match="*[name(.) = 'polyline']">
<
xsl:
if test="@points"><
xsl:
attribute name="Points"><
xsl:
value-
of select="@points" /></
xsl:
attribute></
xsl:
if>
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="fill_rule" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Polyline'" />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
template mode="forward" match="*[name(.) = 'path']">
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
when test="$silverlight_compatible = 1">
<
xsl:
attribute name="Data">
<
xsl:
value-
of select="translate(@d , ',', ' ')" />
<
xsl:
attribute name="Figures">
<
xsl:
value-
of select="translate(@d , ',', ' ')" />
<
xsl:
apply-
templates mode="fill_rule" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Path'" />
<
xsl:
apply-
templates mode="forward" />
SVG: ellipse, XAML: Ellipse <
xsl:
template mode="forward" match="*[name(.) = 'ellipse']">
<
xsl:
when test="@cx"><
xsl:
value-
of select="@cx" /></
xsl:
when>
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
when test="@cy"><
xsl:
value-
of select="@cy" /></
xsl:
when>
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
attribute name="Canvas.Left"><
xsl:
value-
of select='format-number($cx - @rx, "#.#")' /></
xsl:
attribute>
<
xsl:
attribute name="Width"><
xsl:
value-
of select='format-number(2 * @rx, "#.#")' /></
xsl:
attribute>
<
xsl:
attribute name="Canvas.Top"><
xsl:
value-
of select='format-number($cy - @ry, "#.#")' /></
xsl:
attribute>
<
xsl:
attribute name="Height"><
xsl:
value-
of select='format-number(2 * @ry, "#.#")' /></
xsl:
attribute>
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="clip" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Ellipse'" />
<
xsl:
apply-
templates mode="forward" />
SVG: circle, XAML: Ellipse <
xsl:
template mode="forward" match="*[name(.) = 'circle']">
<
xsl:
when test="@cx"><
xsl:
value-
of select="@cx" /></
xsl:
when>
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
when test="@cy"><
xsl:
value-
of select="@cy" /></
xsl:
when>
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
attribute name="Canvas.Left"><
xsl:
value-
of select='format-number($cx - @r, "#.#")' /></
xsl:
attribute>
<
xsl:
attribute name="Canvas.Top"><
xsl:
value-
of select='format-number($cy - @r, "#.#")' /></
xsl:
attribute>
<
xsl:
attribute name="Width"><
xsl:
value-
of select='format-number(2 * @r, "#.#")' /></
xsl:
attribute>
<
xsl:
attribute name="Height"><
xsl:
value-
of select='format-number(2 * @r, "#.#")' /></
xsl:
attribute>
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="stroke_miterlimit" select="." />
<
xsl:
apply-
templates mode="stroke_dasharray" select="." />
<
xsl:
apply-
templates mode="stroke_dashoffset" select="." />
<
xsl:
apply-
templates mode="stroke_linejoin" select="." />
<
xsl:
apply-
templates mode="stroke_linecap" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="clip" select="." />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Ellipse'" />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
template mode="forward" match="*[name(.) = 'image']">
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@x" />
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y" />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="clip" select="." />
<
xsl:
if test="@xlink:href">
<
xsl:
attribute name="Source">
<
xsl:
value-
of select="@xlink:href" />
<
xsl:
attribute name="Width">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@width" />
<
xsl:
attribute name="Height">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@height" />
<
xsl:
apply-
templates mode="transform" select=".">
<
xsl:
with-
param name="mapped_type" select="'Image'" />
<
xsl:
apply-
templates mode="forward" />
* Generic clip path template <!-- Generic clip path template --> <
xsl:
template mode="forward" match="*[name(.) = 'clipPath']">
<
xsl:
apply-
templates mode="geometry" />
<!-- Geometry for circle --> <
xsl:
template mode="geometry" match="*[name(.) = 'circle']">
<
xsl:
if test="../@id"><
xsl:
attribute name="x:Key"><
xsl:
value-
of select="../@id" /></
xsl:
attribute></
xsl:
if>
<
xsl:
if test="@cx and @cy"><
xsl:
attribute name="Center"><
xsl:
value-
of select="concat(@cx, ',', @cy)" /></
xsl:
attribute></
xsl:
if>
<
xsl:
attribute name="RadiusX"><
xsl:
value-
of select="@r" /></
xsl:
attribute>
<
xsl:
attribute name="RadiusY"><
xsl:
value-
of select="@r" /></
xsl:
attribute>
<!-- Geometry for rectangle --> <
xsl:
template mode="geometry" match="*[name(.) = 'rect']">
<
xsl:
if test="../@id"><
xsl:
attribute name="x:Key"><
xsl:
value-
of select="../@id" /></
xsl:
attribute></
xsl:
if>
<xsl:if test="@x"><xsl:attribute name="Canvas.Left"><xsl:value-of select="@x" /></xsl:attribute></xsl:if> <xsl:if test="@y"><xsl:attribute name="Canvas.Top"><xsl:value-of select="@y" /></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="@rx"><xsl:attribute name="RadiusX"><xsl:value-of select="@rx" /></xsl:attribute></xsl:if> <xsl:if test="@ry"><xsl:attribute name="RadiusY"><xsl:value-of select="@ry" /></xsl:attribute></xsl:if> <
xsl:
attribute name="Rect"><
xsl:
value-
of select="concat('0, 0, ', @width, ', ', @height)" /></
xsl:
attribute>