<
xsl:
with-
param name="convert_value" select="@height" />
<
SolidColor color="#ffffff" alpha="1"/>
<
xsl:
apply-
templates mode="forward" />
<
xsl:
template mode="forward" match="*[name(.) = 'svg']">
<
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:
if test="@width and not(contains(@width, '%')) and @height and not(contains(@height, '%'))">
<
xsl:
attribute name="maskType"><
xsl:
value-
of select="'clip'"/></
xsl:
attribute>
<
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" />
<
SolidColor color="#ffffff" alpha="1"/>
<
xsl:
apply-
templates mode="forward" />
FXG's Group doesn't support other elements attributes (such as font-size, etc.) <
xsl:
template mode="forward" match="*[name(.) = 'g']">
<
xsl:
variable name="object">
<
xsl:
if test="@style and contains(@style, 'display:none')">
<
xsl:
attribute name="Visibility">Collapsed</
xsl:
attribute>
<
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:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y" />
<
xsl:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="layer_blend" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="forward" select="*" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
All the matrix, translate, rotate... stuff. * Parse objects transform * Parse gradient transform * Multiple values rotation. // Parse object transform // <
xsl:
template name="parse_object_transform">
<
xsl:
param name="input" />
<!-- Matrix transform --> <
xsl:
when test="starts-with($input, 'matrix(')">
<
xsl:
variable name="matrix" select="normalize-space(translate(substring-before(substring-after($input, 'matrix('), ')'), ',', ' '))" />
<
xsl:
variable name="a" select="substring-before($matrix, ' ')"/>
<
xsl:
variable name="ra" select="substring-after($matrix, ' ')"/>
<
xsl:
variable name="b" select="substring-before($ra, ' ')"/>
<
xsl:
variable name="rb" select="substring-after($ra, ' ')"/>
<
xsl:
variable name="c" select="substring-before($rb, ' ')"/>
<
xsl:
variable name="rc" select="substring-after($rb, ' ')"/>
<
xsl:
variable name="d" select="substring-before($rc, ' ')"/>
<
xsl:
variable name="rd" select="substring-after($rc, ' ')"/>
<
xsl:
variable name="tx" select="substring-before($rd, ' ')"/>
<
xsl:
variable name="ty" select="substring-after($rd, ' ')"/>
<
xsl:
attribute name="a"><
xsl:
value-
of select="$a" /></
xsl:
attribute>
<
xsl:
attribute name="b"><
xsl:
value-
of select="$b" /></
xsl:
attribute>
<
xsl:
attribute name="c"><
xsl:
value-
of select="$c" /></
xsl:
attribute>
<
xsl:
attribute name="d"><
xsl:
value-
of select="$d" /></
xsl:
attribute>
<
xsl:
attribute name="tx"><
xsl:
value-
of select='format-number($tx, "#.##")' /></
xsl:
attribute>
<
xsl:
attribute name="ty"><
xsl:
value-
of select='format-number($ty, "#.##")' /></
xsl:
attribute>
<
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" />
<!-- Rotate transform --> <
xsl:
when test="starts-with($input, 'rotate(')">
<
xsl:
variable name="rotate" select="normalize-space(translate(substring-before(substring-after($input, 'rotate('), ')'), ',', ' '))" />
<
xsl:
attribute name="rotation">
<
xsl:
when test="contains($rotate, ' ')">
<
xsl:
value-
of select="substring-before($rotate, ' ')" />
<
xsl:
value-
of select="$rotate" />
<
xsl:
attribute name="CenterX">
<
xsl:
value-
of select="@rx" />
<
xsl:
attribute name="CenterY">
<
xsl:
value-
of select="@ry" />
<!-- 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" />
FXG needs a separate group for each transform type in the transform attribute (scale+translate != translate+scale) <
xsl:
template name="object_transform">
<
xsl:
param name="object" />
<
xsl:
param name="transform" />
<
xsl:
variable name="values" select="normalize-space(translate($transform, ',', ' '))" />
<
xsl:
when test="contains($values, ') ')">
<
xsl:
call-
template name="parse_object_transform">
<
xsl:
with-
param name="input" select="concat(substring-before($values, ') '), ')')" />
<
xsl:
variable name="values2" select="substring-after($values, ') ')" />
<
xsl:
when test="contains($values2, ') ')">
<
xsl:
call-
template name="parse_object_transform">
<
xsl:
with-
param name="input" select="concat(substring-before($values2, ') '), ')')" />
<
xsl:
variable name="values3" select="substring-after($values2, ') ')" />
<
xsl:
call-
template name="parse_object_transform">
<
xsl:
with-
param name="input" select="concat($values3, ')')" />
<
xsl:
copy-
of select="$object" />
<
xsl:
call-
template name="parse_object_transform">
<
xsl:
with-
param name="input" select="$values2" />
<
xsl:
copy-
of select="$object" />
<
xsl:
call-
template name="parse_object_transform">
<
xsl:
with-
param name="input" select="$values" />
<
xsl:
copy-
of select="$object" />
// Parse gradient transform // <
xsl:
template name="parse_gradient_transform">
<
xsl:
param name="input" />
<
xsl:
param name="type" />
<
xsl:
when test="starts-with($input, 'scale(')">
<
xsl:
variable name="scale" select="normalize-space(translate(substring-before(substring-after($input, 'scale('), ')'), ',', ' '))" />
<
xsl:
when test="$type='radial'">
<
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:
attribute name="scaleX">
<
xsl:
value-
of select="$scale" />
<!-- Rotate transform --> <
xsl:
when test="starts-with($input, 'rotate(')">
<
xsl:
variable name="rotate" select="normalize-space(translate(substring-before(substring-after($input, 'rotate('), ')'), ',', ' '))" />
<
xsl:
attribute name="rotation">
<
xsl:
when test="contains($rotate, ' ')">
<
xsl:
value-
of select="substring-before($rotate, ' ')" />
<
xsl:
value-
of select="$rotate" />
<!-- 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" />
Gradient positioning and tranformation are very different in FXG <
xsl:
template name="gradient_transform">
<
xsl:
param name="transform" />
<
xsl:
param name="type" />
<
xsl:
if test="contains($transform, 'translate')">
<
xsl:
call-
template name="parse_gradient_transform">
<
xsl:
with-
param name="input" select="concat('translate(', substring-before(substring-after($transform, 'translate('), ')'), ')')" />
<
xsl:
with-
param name="type" select="$type" />
* Generic filters template <
xsl:
template mode="resources" match="*">
<!-- should be in-depth --> <
xsl:
if test="ancestor::*[name(.) = 'defs']"><
xsl:
attribute name="id"><
xsl:
value-
of select="@id" /></
xsl:
attribute></
xsl:
if>
// Generic defs template // <
xsl:
template mode="forward" match="defs">
<!-- Ignoring defs, do nothing <xsl:apply-templates mode="forward" /> <
xsl:
template mode="forward" match="*[name(.) = 'linearGradient' or name(.) = 'radialGradient']">
Looks good with normal, multiply, and darken <
xsl:
template mode="layer_blend" match="*">
<
xsl:
if test="@inkscape:groupmode='layer' and @style and contains(@style, 'filter:url(#')">
<
xsl:
variable name="id" select="substring-before(substring-after(@style, 'filter:url(#'), ')')" />
<
xsl:
for-
each select="//*[@id=$id]">
<
xsl:
if test="name(child::node()) = 'feBlend'">
<
xsl:
attribute name="blendMode">
<
xsl:
value-
of select="child::node()/@mode"/>
// 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: Blur quality=2 recommended by the FXG specifications: <
xsl:
template mode="forward" match="*[name(.) = 'feGaussianBlur']">
<
xsl:
if test="name(.)='feGaussianBlur'">
<
xsl:
attribute name="quality">2</
xsl:
attribute>
<
xsl:
if test="@stdDeviation">
<
xsl:
variable name="blur" select="normalize-space(translate(@stdDeviation, ',', ' '))" />
<
xsl:
when test="not(contains($blur, ' '))">
<
xsl:
attribute name="blurX">
<
xsl:
value-
of select="floor($blur * 1.88 + 0.5)" />
<
xsl:
attribute name="blurY">
<
xsl:
value-
of select="floor($blur * 1.88 + 0.5)" />
<
xsl:
attribute name="blurX">
<
xsl:
value-
of select="floor(substring-before($blur, ' ') * 1.88 + 0.5)" />
<
xsl:
attribute name="blurY">
<
xsl:
value-
of select="floor(substring-after($blur, ' ') * 1.88 + 0.5)" />
// Linked filter effect // <
xsl:
template mode="filter_effect" match="*">
<
xsl:
when test="@filter and starts-with(@filter, 'url(#')">
<
xsl:
value-
of select="substring-before(substring-after(@filter, 'url(#'), ')')" />
<
xsl:
when test="@style and contains(@style, 'filter:url(#')">
<
xsl:
value-
of select="substring-before(substring-after(@style, 'filter:url(#'), ')')" />
<
xsl:
for-
each select="//*[@id=$id]">
<
xsl:
apply-
templates mode="forward" />
Full convertion to FXG would require some math. <
xsl:
template name="linearGradient">
<
xsl:
for-
each select="//*[@id=$id]">
<
xsl:
attribute name="id">
<
xsl:
value-
of select="@id" />
<
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="@color-interpolation">
<
xsl:
attribute name="interpolationMethod">
<
xsl:
when test="@color-interpolation = 'linearRGB'">linearRGB</
xsl:
when>
<
xsl:
otherwise>rgb</
xsl:
otherwise>
<
xsl:
if test="@x1 and @x2 and @y1 and @y2 and function-available('math:atan')">
<
xsl:
attribute name="rotation">
<
xsl:
value-
of select="57.3 * math:atan((@y2 - @y1) div (@x2 - @x1))" />
<
xsl:
if test="@gradientTransform">
<
xsl:
call-
template name="gradient_transform">
<
xsl:
with-
param name="transform" select="@gradientTransform" />
<
xsl:
with-
param name="type" select="linear" />
<
xsl:
when test="@xlink:href">
<
xsl:
variable name="reference_id" select="@xlink:href" />
<
xsl:
call-
template name="gradientStops" >
<
xsl:
with-
param name="id">
<
xsl:
value-
of select="substring-after($reference_id, '#')" />
<
xsl:
otherwise><
xsl:
apply-
templates mode="forward" /></
xsl:
otherwise>
Full convertion to FXG would require some math. <
xsl:
template name="radialGradient">
<
xsl:
for-
each select="//*[@id=$id]">
<
xsl:
attribute name="id">
<
xsl:
value-
of select="@id" />
<
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="@color-interpolation">
<
xsl:
attribute name="interpolationMethod">
<
xsl:
when test="@color-interpolation = 'linearRGB'">linearRGB</
xsl:
when>
<
xsl:
otherwise>rgb</
xsl:
otherwise>
<
xsl:
if test="@gradientTransform">
<
xsl:
call-
template name="gradient_transform">
<
xsl:
with-
param name="transform" select="@gradientTransform" />
<
xsl:
with-
param name="type" select="radial" />
<
xsl:
when test="@xlink:href">
<
xsl:
variable name="reference_id" select="@xlink:href" />
<
xsl:
call-
template name="gradientStops" >
<
xsl:
with-
param name="id">
<
xsl:
value-
of select="substring-after($reference_id, '#')" />
<
xsl:
otherwise><
xsl:
apply-
templates mode="forward" /></
xsl:
otherwise>
// Gradient stops list // TODO: Find a way to test the existence of the node-set <
xsl:
template name="gradientStops">
<
xsl:
variable name="stops">
<
xsl:
for-
each select="//*[@id=$id]">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
when test="not($stops)">
<
xsl:
attribute name="alpha">0</
xsl:
attribute>
<
xsl:
otherwise><
xsl:
copy-
of select="$stops" /></
xsl:
otherwise>
<
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" />
// Clipping and masking// <
xsl:
template mode="clip" match="*">
<
xsl:
param name="object" />
<
xsl:
param name="clip_type" />
<
xsl:
when test="$clip_type='clip' and @clip-path and contains(@clip-path, 'url')">
<
xsl:
attribute name="maskType"><
xsl:
value-
of select="'clip'"/></
xsl:
attribute>
<
xsl:
variable name="clip_id" select="substring-before(substring-after(@clip-path, 'url(#'), ')')"/>
<
xsl:
for-
each select="//*[@id=$clip_id]">
<
xsl:
if test="not(@clipPathUnits) or @clipPathUnits != 'objectBoundingBox'">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
copy-
of select="$object"/>
<
xsl:
when test="$clip_type='mask' and @mask and contains(@mask, 'url')">
<
xsl:
attribute name="maskType"><
xsl:
value-
of select="'alpha'"/></
xsl:
attribute>
<
xsl:
variable name="mask_id" select="substring-before(substring-after(@mask, 'url(#'), ')')"/>
<
xsl:
for-
each select="//*[@id=$mask_id]">
<
xsl:
if test="not(@maskUnits) or @maskUnits != 'objectBoundingBox'">
<
xsl:
apply-
templates mode="forward" />
<
xsl:
copy-
of select="$object"/>
<
xsl:
copy-
of select="$object" />
* Decimal to hexadecimal converter * Unit to pixel converter * Object description (not supported) * Title and description (not supported) * Symbols (not supported) * RDF and foreign objects (not supported) * Misc ignored stuff (markers, patterns, styles) Removes "-" from the original id (Not sure FXG really needs it) <
xsl:
template mode="id" match="*">
<
xsl:
attribute name="id"><
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="forward" match="*[name(.) = 'switch']">
<
xsl:
apply-
templates mode="forward" />
With generic and mode="forward" templates <
xsl:
comment><
xsl:
value-
of select="concat('Unknown tag: ', name(.))" /></
xsl:
comment>
<
xsl:
template mode="forward" match="*">
<
xsl:
comment><
xsl:
value-
of select="concat('Unknown tag: ', name(.))" /></
xsl:
comment>
<
xsl:
template mode="desc" match="*">
// 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(.) = 'symbol']">
Could be implemented via librairies (but since it is not supported by Inkscape, not implemented yet) <
xsl:
template mode="forward" match="*[name(.) = 'use']">
// 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']">
// Colors and patterns // * Generic stroke template * Stroke dasharray (not supported in FXG) * Stroke dashoffset (not supported in FXG) * Linejoin SVG to FxG converter * Linecap SVG to FXG converter // Generic color template // <
xsl:
template name="template_color">
<
xsl:
param name="colorspec" />
<
xsl:
when test="starts-with($colorspec, 'rgb(') and not(contains($colorspec , '%'))">
<
xsl:
value-
of select="'#'" />
<
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:
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:
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:
value-
of select="substring-after($named_color_hex, '#')" />
<
xsl:
value-
of select="$colorspec" />
<
xsl:
template mode="object_opacity" match="*">
<
xsl:
if test="@opacity or (@style and (contains(@style, ';opacity:') or starts-with(@style, 'opacity:')))">
<
xsl:
variable name="value">
<
xsl:
when test="@opacity">
<
xsl:
value-
of select="@opacity" />
<
xsl:
when test="@style and contains(@style, ';opacity:')">
<
xsl:
variable name="Opacity" select="substring-after(@style, ';opacity:')" />
<
xsl:
when test="contains($Opacity, ';')">
<
xsl:
value-
of select="substring-before($Opacity, ';')" />
<
xsl:
value-
of select="$Opacity" />
<
xsl:
when test="@style and starts-with(@style, 'opacity:')">
<
xsl:
variable name="Opacity" select="substring-after(@style, '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="object_opacity" select="parent::*" />
<
xsl:
otherwise>1</
xsl:
otherwise>
<
xsl:
attribute name="alpha">
<
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" match="*">
<
xsl:
variable name="value">
<
xsl:
value-
of select="@fill" />
<
xsl:
when test="@style and contains(@style, 'fill:')">
<
xsl:
variable name="Fill" select="normalize-space(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:
if test="@fill-rule = 'nonzero'">
<
xsl:
attribute name="winding">nonZero</
xsl:
attribute>
<
xsl:
if test="@fill-rule = 'evenodd'">
<
xsl:
attribute name="winding">evenOdd</
xsl:
attribute>
<
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'">
<
xsl:
attribute name="winding">nonZero</
xsl:
attribute>
<
xsl:
if test="substring-before($FillRule, ';') = 'evenodd'">
<
xsl:
attribute name="winding">evenOdd</
xsl:
attribute>
<
xsl:
when test="$FillRule = 'nonzero'">
<
xsl:
attribute name="winding">nonZero</
xsl:
attribute>
<
xsl:
when test=" $FillRule = 'evenodd'">
<
xsl:
attribute name="winding">evenOdd</
xsl:
attribute>
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="fill_rule" select="parent::*"/>
<
xsl:
attribute name="winding">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:
when test="$fill != '' and $fill != 'none' and not(starts-with($fill, 'url(#'))">
<
xsl:
attribute name="color">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$fill" />
<
xsl:
attribute name="alpha">
<
xsl:
value-
of select="$fill_opacity" />
<
xsl:
when test="starts-with($fill, 'url(#')">
<
xsl:
for-
each select="//*[@id=substring-before(substring-after($fill, 'url(#'), ')')]">
<
xsl:
if test="name(.) = 'linearGradient'">
<
xsl:
call-
template name="linearGradient" >
<
xsl:
with-
param name="id">
<
xsl:
value-
of select="substring-before(substring-after($fill, 'url(#'), ')')" />
<
xsl:
if test="name(.) = 'radialGradient'">
<
xsl:
call-
template name="radialGradient" >
<
xsl:
with-
param name="id">
<
xsl:
value-
of select="substring-before(substring-after($fill, 'url(#'), ')')" />
<
xsl:
when test="$fill = 'none'">
<
SolidColor color="#ffffff" alpha="1"/>
<
xsl:
template mode="stroke" match="*">
<
xsl:
when test="@stroke">
<
xsl:
value-
of select="@stroke" />
<
xsl:
when test="@style and contains(@style, 'stroke:')">
<
xsl:
variable name="Stroke" select="normalize-space(substring-after(@style, 'stroke:'))" />
<
xsl:
when test="contains($Stroke, ';')">
<
xsl:
value-
of select="substring-before($Stroke, ';')" />
<
xsl:
when test="$Stroke">
<
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>
<
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>
<
xsl:
variable name="stroke_opacity"><
xsl:
apply-
templates mode="stroke_opacity" select="." /></
xsl:
variable>
<
xsl:
variable name="stroke_width"><
xsl:
apply-
templates mode="stroke_width" select="." /></
xsl:
variable>
<
xsl:
variable name="stroke_miterlimit"><
xsl:
apply-
templates mode="stroke_miterlimit" select="." /></
xsl:
variable>
<
xsl:
variable name="stroke_linejoin"><
xsl:
apply-
templates mode="stroke_linejoin" select="." /></
xsl:
variable>
<
xsl:
variable name="stroke_linecap"><
xsl:
apply-
templates mode="stroke_linecap" select="." /></
xsl:
variable>
<
xsl:
if test="$stroke != '' and $stroke != 'none' and not(starts-with($stroke, 'url(#'))">
<
xsl:
attribute name="color">
<
xsl:
call-
template name="template_color">
<
xsl:
with-
param name="colorspec">
<
xsl:
value-
of select="$stroke" />
<
xsl:
attribute name="alpha">
<
xsl:
value-
of select="$stroke_opacity" />
<
xsl:
attribute name="weight">
<
xsl:
value-
of select="$stroke_width" />
<
xsl:
if test="$stroke_miterlimit != ''">
<
xsl:
attribute name="miterLimit">
<
xsl:
value-
of select="$stroke_miterlimit" />
<
xsl:
attribute name="joints">
<
xsl:
value-
of select="$stroke_linejoin" />
<
xsl:
attribute name="caps">
<
xsl:
value-
of select="$stroke_linecap" />
<
xsl:
if test="starts-with($stroke, 'url(#')">
<
xsl:
for-
each select="//*[@id=substring-before(substring-after($stroke, 'url(#'), ')')]">
<
xsl:
if test="name(.) = 'linearGradient'">
<
xsl:
attribute name="weight">
<
xsl:
value-
of select="$stroke_width" />
<
xsl:
if test="$stroke_miterlimit != ''">
<
xsl:
attribute name="miterLimit">
<
xsl:
value-
of select="$stroke_miterlimit" />
<
xsl:
attribute name="joints">
<
xsl:
value-
of select="$stroke_linejoin" />
<
xsl:
attribute name="caps">
<
xsl:
value-
of select="$stroke_linecap" />
<
xsl:
call-
template name="linearGradient" >
<
xsl:
with-
param name="id">
<
xsl:
value-
of select="substring-before(substring-after($stroke, 'url(#'), ')')" />
<
xsl:
if test="name(.) = 'radialGradient'">
<
xsl:
attribute name="weight">
<
xsl:
value-
of select="$stroke_width" />
<
xsl:
if test="$stroke_miterlimit != ''">
<
xsl:
attribute name="miterLimit">
<
xsl:
value-
of select="$stroke_miterlimit" />
<
xsl:
attribute name="joints">
<
xsl:
value-
of select="$stroke_linejoin" />
<
xsl:
attribute name="caps">
<
xsl:
value-
of select="$stroke_linecap" />
<
xsl:
call-
template name="radialGradient" >
<
xsl:
with-
param name="id">
<
xsl:
value-
of select="substring-before(substring-after($stroke, 'url(#'), ')')" />
<
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:
otherwise>1</
xsl:
otherwise>
Probably not calculated the same way in SVG and FXG (same value but different result) <
xsl:
template mode="stroke_miterlimit" match="*">
<
xsl:
when test="@stroke-miterlimit">
<
xsl:
value-
of select="@stroke-miterlimit" />
<
xsl:
when test="@style and contains(@style, 'stroke-miterlimit:')">
<
xsl:
variable name="miterLimit" select="substring-after(@style, 'stroke-miterlimit:')" />
<
xsl:
when test="contains($miterLimit, ';')">
<
xsl:
value-
of select="substring-before($miterLimit, ';')" />
<
xsl:
value-
of select="$miterLimit" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_miterlimit" select="parent::*"/>
<
xsl:
template mode="stroke_dasharray" match="*">
<
xsl:
comment>FXG does not support dasharrays</
xsl:
comment>
<
xsl:
template mode="stroke_dashoffset" match="*">
<
xsl:
comment>FXG does not support dashoffsets</
xsl:
comment>
// Linejoin SVG to FXG converter // <
xsl:
template name="linejoin_svg_to_fxg">
<
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-linejoin">
<
xsl:
call-
template name="linejoin_svg_to_fxg">
<
xsl:
with-
param name="linejoin">
<
xsl:
value-
of select="@stroke-linejoin" />
<
xsl:
when test="@style and contains(@style, 'stroke-linejoin:')">
<
xsl:
variable name="joints" select="substring-after(@style, 'stroke-linejoin:')" />
<
xsl:
when test="contains($joints, ';')">
<
xsl:
call-
template name="linejoin_svg_to_fxg">
<
xsl:
with-
param name="linejoin">
<
xsl:
value-
of select="substring-before($joints, ';')" />
<
xsl:
call-
template name="linejoin_svg_to_fxg">
<
xsl:
with-
param name="linejoin">
<
xsl:
value-
of select="$joints" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_linejoin" select="parent::*"/>
<
xsl:
otherwise>miter</
xsl:
otherwise>
// Linecap SVG to FXG converter // <
xsl:
template name="linecap_svg_to_fxg">
<
xsl:
param name="linecap" />
<
xsl:
when test="$linecap = 'round'">round</
xsl:
when>
<
xsl:
when test="$linecap = 'square'">square</
xsl:
when>
<
xsl:
when test="$linecap = 'butt'">round</
xsl:
when>
<
xsl:
otherwise>none</
xsl:
otherwise>
<
xsl:
template mode="stroke_linecap" match="*">
<
xsl:
when test="@stroke-linecap">
<
xsl:
call-
template name="linecap_svg_to_fxg">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="@stroke-linecap" />
<
xsl:
when test="@style and contains(@style, 'stroke-linecap:')">
<
xsl:
variable name="caps" select="substring-after(@style, 'stroke-linecap:')" />
<
xsl:
when test="contains($caps, ';')">
<
xsl:
call-
template name="linecap_svg_to_fxg">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="substring-before($caps, ';')" />
<
xsl:
call-
template name="linecap_svg_to_fxg">
<
xsl:
with-
param name="linecap">
<
xsl:
value-
of select="$caps" />
<
xsl:
when test="name(..) = 'g' or name(..) = 'svg'">
<
xsl:
apply-
templates mode="stroke_linecap" select="parent::*"/>
<
xsl:
otherwise>none</
xsl:
otherwise>
<
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:
otherwise><
xsl:
value-
of select="''" /></
xsl:
otherwise>
<
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="normalize-space(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:
value-
of select="$stopcolor" />
<
xsl:
if test="$Opacity != ''">
<
xsl:
attribute name="alpha">
<
xsl:
value-
of select="$Opacity" />
// 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="ratio">
<
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="ratio">
<
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, FXG: 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" />
SVG: font-weight, FXG: 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='normal' or $value='bold'">
<
xsl:
value-
of select="$value" />
<
xsl:
when test="$value < 500 or $value = 'lighter'">normal</
xsl:
when>
<
xsl:
when test="$value > 499 or $value = 'bolder'">bold</
xsl:
when>
<
xsl:
otherwise>normal</
xsl:
otherwise>
SVG: font-family, FXG: 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, FXG: 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, FXG: color, textAlpha <
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="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" />
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:
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" />
* Embedded fonts (in defs). * Character positionning (x and y). * Text rotation (0, 90, 180 and 270 degrees only) -> not implemented. * Font weight (normal and bold only) -> values under 500 are considered normal, the others bold. * Whitespace handling, issues with xml:whitespace='preserve'. <
xsl:
template mode="forward" match="*[name(.) = 'text']">
<
xsl:
variable name="object">
<!-- Force default baseline to "ascent" --> <
xsl:
attribute name="alignmentBaseline">ascent</
xsl:
attribute>
<
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="text_size" select="." />
<
xsl:
apply-
templates mode="text_position" select="." />
<
xsl:
apply-
templates mode="direction" select="." />
<
xsl:
apply-
templates mode="writing_mode" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
if test="not(*[name(.) = 'tspan']/text())">
<
xsl:
attribute name="whiteSpaceCollapse">preserve</
xsl:
attribute>
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" 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:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
SVG: flowRoot, FXG: RichText <
xsl:
template mode="forward" match="*[name(.) = 'flowRoot']">
<
xsl:
variable name="object">
<!-- Force default baseline to "ascent" --> <
xsl:
attribute name="alignmentBaseline">ascent</
xsl:
attribute>
<
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="direction" select="." />
<
xsl:
apply-
templates mode="writing_mode" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="flow_region" select="*[name(.) = 'flowRegion']/child::node()" />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
when test="*[name(.) = 'flowPara' or name(.) = 'flowDiv']/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:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
* Polygon (not supported) * Polyline (not supported) <
xsl:
template mode="forward" match="*[name(.) = 'line']">
<
xsl:
variable name="object">
<
xsl:
attribute name="xFrom">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@x1" />
<
xsl:
attribute name="yFrom">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y1" />
<
xsl:
attribute name="xTo">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@x2" />
<
xsl:
attribute name="yTo">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@y2" />
<
xsl:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
<
xsl:
template mode="forward" match="*[name(.) = 'rect']">
<
xsl:
variable name="object">
<
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 name="radiusY">
<
xsl:
value-
of select="@ry" />
<
xsl:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<!-- <xsl:apply-templates mode="resources" select="." /> --> <
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
* elliptical arc curve commands (workaround: convert to path first) * Implement an arc to curve convertor <
xsl:
template mode="forward" match="*[name(.) = 'path']">
<
xsl:
variable name="object">
<!-- Exclude arcs in order to prevent the mxml compiler from failing --> <
xsl:
if test="@d and not(contains(@d, 'a') or contains(@d, 'A'))">
<
xsl:
attribute name="data">
<
xsl:
value-
of select="normalize-space(translate(@d , ',', ' '))" />
<
xsl:
apply-
templates mode="fill_rule" select="." />
<
xsl:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
<
xsl:
if test="contains(@d, 'a') or contains(@d, 'A')">
<
xsl:
comment><
xsl:
value-
of select="'Elliptic arc command in path data not supported, please convert to path (arcs are thus converted to curves) before exporting.'" /></
xsl:
comment>
SVG: ellipse, FXG: Ellipse <
xsl:
template mode="forward" match="*[name(.) = 'ellipse']">
<
xsl:
variable name="object">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@cx" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@cy" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@rx" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@ry" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
when test="$rx != 0">
<
xsl:
value-
of select='format-number($cx - $rx, "#.#")' />
<
xsl:
attribute name="width">
<
xsl:
value-
of select='format-number(2 * $rx, "#.#")' />
<
xsl:
value-
of select='format-number($cx, "#.#")' />
<
xsl:
attribute name="width">0</
xsl:
attribute>
<
xsl:
when test="$ry != 0">
<
xsl:
value-
of select='format-number($cy - $ry, "#.#")' />
<
xsl:
attribute name="height">
<
xsl:
value-
of select='format-number(2 * $ry, "#.#")' />
<
xsl:
value-
of select='format-number($cy, "#.#")' />
<
xsl:
attribute name="height">0</
xsl:
attribute>
<
xsl:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
SVG: circle, FXG: Ellipse <
xsl:
template mode="forward" match="*[name(.) = 'circle']">
<
xsl:
variable name="object">
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@cx" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@cy" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
call-
template name="convert_unit">
<
xsl:
with-
param name="convert_value" select="@r" />
<
xsl:
otherwise>0</
xsl:
otherwise>
<
xsl:
when test="$r != 0">
<
xsl:
value-
of select='format-number($cx - $r, "#.#")' />
<
xsl:
value-
of select='format-number($cy - $r, "#.#")' />
<
xsl:
attribute name="width">
<
xsl:
value-
of select='format-number(2 * $r, "#.#")' />
<
xsl:
attribute name="height">
<
xsl:
value-
of select='format-number(2 * $r, "#.#")' />
<
xsl:
value-
of select='format-number($cx, "#.#")' />
<
xsl:
value-
of select='format-number($cy, "#.#")' />
<
xsl:
attribute name="width">0</
xsl:
attribute>
<
xsl:
attribute name="height">0</
xsl:
attribute>
<
xsl:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="template_fill" select="." />
<
xsl:
apply-
templates mode="template_stroke" select="." />
<
xsl:
apply-
templates mode="filter_effect" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
apply-
templates mode="forward" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
SVG: image, FXG: Rect+BitmapFill * Embedded images (base64). <
xsl:
template mode="forward" match="*[name(.) = 'image']">
<
xsl:
variable name="object">
<
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:
apply-
templates mode="object_opacity" select="." />
<
xsl:
apply-
templates mode="id" select="." />
<
xsl:
apply-
templates mode="desc" select="." />
<
xsl:
if test="@xlink:href">
<
xsl:
attribute name="source">@Embed('<
xsl:
value-
of select="@xlink:href"/>')</
xsl:
attribute>
<
xsl:
apply-
templates mode="forward" />
<
xsl:
variable name="clipped_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$object" />
<
xsl:
with-
param name="clip_type" select="'clip'" />
<
xsl:
variable name="masked_object">
<
xsl:
apply-
templates mode="clip" select="." >
<
xsl:
with-
param name="object" select="$clipped_object" />
<
xsl:
with-
param name="clip_type" select="'mask'" />
<
xsl:
when test="@transform">
<
xsl:
call-
template name="object_transform">
<
xsl:
with-
param name="object" select="$masked_object" />
<
xsl:
with-
param name="transform" select="@transform" />
<
xsl:
copy-
of select="$masked_object" />
<
xsl:
template mode="forward" match="*[name(.) = 'polygon']">
<
xsl:
comment>FXG does not support polygons</
xsl:
comment>
<
xsl:
template mode="forward" match="*[name(.) = 'polyline']">
<
xsl:
comment>FXG does not support polylines</
xsl:
comment>