svg2xaml.xsl revision 358b46a388b1e316e51bc6fc5c4c7b10525db5ca
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoCopyright (c) 2005-2007 authors:
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoOriginal version: Toine de Greef (a.degreef@chello.nl)
717017db28f8518249146bbe42267a9992258a4fJazzyNicoModified (2010-2014) by Nicolas Dufour (nicoduf@yahoo.fr) (blur support, units
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoconvertion, comments, and some other fixes)
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoPermission is hereby granted, free of charge, to any person obtaining a copy
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoof this software and associated documentation files (the "Software"), to deal
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoin the Software without restriction, including without limitation the rights
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoto use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicocopies of the Software, and to permit persons to whom the Software is
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicofurnished to do so, subject to the following conditions:
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoThe above copyright notice and this permission notice shall be included in
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoall copies or substantial portions of the Software.
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoTHE SOFTWARE.
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoxmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNicoexclude-result-prefixes="rdf xlink xs exsl libxslt">
935223f1795ae0522a4e4c26b89ee9b7a1d2d5a8JazzyNico<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
717017db28f8518249146bbe42267a9992258a4fJazzyNico<xsl:param name="silverlight_compatible" select="$silverlight" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Containers //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Root templace
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Root template //
717017db28f8518249146bbe42267a9992258a4fJazzyNico <xsl:when test="$silverlight_compatible = 'true'">
717017db28f8518249146bbe42267a9992258a4fJazzyNico <xsl:value-of select="'This file is compatible with Silverlight'" />
717017db28f8518249146bbe42267a9992258a4fJazzyNico <xsl:value-of select="'This file is NOT compatible with Silverlight'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // SVG and groups //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico (including layers)
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'svg' or name(.) = 'g']">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:when test="name(.) = 'svg' or @transform or @viewBox or @id or @clip-path or @filter 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']">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="clip" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'display:none')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:attribute name="Visibility">Collapsed</xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@style and contains(@style, 'opacity:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="contains(substring-after(@style, 'opacity:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'opacity:'), ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'opacity:')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@width and not(contains(@width, '%'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@width" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@height and not(contains(@height, '%'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@height" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@x" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@y" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:apply-templates mode="resources" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="normalize-space(translate(@viewBox, ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(substring-after($viewBox, ' '), ' '), ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(substring-after(substring-after($viewBox, ' '), ' '), ' ')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <TranslateTransform>
d258b7ab81a56d38fd4e36832db8ae00006766a3JazzyNico <xsl:value-of select="format-number(-number(substring-before($viewBox, ' ')), '#.#')" />
d258b7ab81a56d38fd4e36832db8ae00006766a3JazzyNico <xsl:value-of select="format-number(-number(substring-before(substring-after($viewBox, ' '), ' ')), '#.#')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </TranslateTransform>
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:with-param name="mapped_type" select="'Canvas'" />
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:if test="*[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath' or name(.) = 'filter']">
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:apply-templates mode="forward" select="*[name(.) = 'linearGradient' or name(.) = 'radialGradient' or name(.) = 'defs' or name(.) = 'clipPath' or name(.) = 'filter']" />
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:apply-templates mode="forward" select="*[name(.) != 'linearGradient' and name(.) != 'radialGradient' and name(.) != 'defs' and name(.) != 'clipPath' and name(.) != 'filter']" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Transforms //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico All the matrix, translate, rotate... stuff.
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Fixme: XAML transforms don't show the same result as SVG ones with the same values.
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Parse transform
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Apply transform
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Parse transform //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Matrix transform -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <MatrixTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="normalize-space(translate(substring-before(substring-after($input, 'matrix('), ')'), ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </MatrixTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="input" select="substring-after($input, ') ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Scale transform -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <ScaleTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="scale" select="normalize-space(translate(substring-before(substring-after($input, 'scale('), ')'), ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($scale, ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after($scale, ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </ScaleTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="input" select="substring-after($input, ') ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Rotate transform -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <RotateTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="normalize-space(translate(substring-before(substring-after($input, 'rotate('), ')'), ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </RotateTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="input" select="substring-after($input, ') ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Skew transform -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <SkewTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="normalize-space(translate(substring-before(substring-after($input, 'skewX('), ')'), ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="input" select="substring-after($input, ') ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </SkewTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <SkewTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="normalize-space(translate(substring-before(substring-after($input, 'skewY('), ')'), ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="input" select="substring-after($input, ') ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </SkewTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Translate transform -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="starts-with($input, 'translate(')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <TranslateTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="translate" select="normalize-space(translate(substring-before(substring-after($input, 'translate('), ')'), ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($translate, ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after($translate, ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </TranslateTransform>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="input" select="substring-after($input, ') ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Apply transform //
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:variable name="values" select="normalize-space(translate($transform, ',', ' '))" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="concat(substring-before($values, ') '), ')')" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:if test="substring-after($values, $value1) != ''">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:when test="contains(substring-after($values, $value1), ') ')">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="normalize-space(concat(substring-before(substring-after($values, $value1), ') '), ')'))" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="normalize-space(substring-after($values, $value1))" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:if test="$value2 != '' and substring-after($values, $value2) != ''">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:when test="contains(substring-after($values, $value2), ') ')">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="normalize-space(concat(substring-before(substring-after($values, $value2), ') '), ')'))" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="normalize-space(substring-after($values, $value2))" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="$mapped_type and $mapped_type != '' and not(contains($mapped_type, 'Geometry'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:element name="{$mapped_type}.RenderTransform">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="count(libxslt:node-set($transform_nodes)/*) = 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:copy-of select="libxslt:node-set($transform_nodes)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="count(libxslt:node-set($transform_nodes)/*) > 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <TransformGroup>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:copy-of select="libxslt:node-set($transform_nodes)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </TransformGroup>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="$mapped_type and $mapped_type != '' and contains($mapped_type, 'Geometry')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="count(libxslt:node-set($transform_nodes)/*) = 1">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:copy-of select="libxslt:node-set($transform_nodes)" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="count(libxslt:node-set($transform_nodes)/*) > 1">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <TransformGroup>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:copy-of select="libxslt:node-set($transform_nodes)" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </TransformGroup>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- For instance LinearGradient.Transform -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="count(libxslt:node-set($transform_nodes)/*) = 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:copy-of select="libxslt:node-set($transform_nodes)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="count(libxslt:node-set($transform_nodes)/*) > 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <TransformGroup>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:copy-of select="libxslt:node-set($transform_nodes)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </TransformGroup>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Resources (defs) //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Resources ids
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Generic defs template
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Generic filters template
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Filter effects
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Linked filter effects
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico * Absolute gradients
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Linear gradients
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Radial gradients
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Generic gradient stops
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Resources ids //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <!-- should be in-depth -->
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:if test="parent::*[name(.) = 'defs']"><xsl:attribute name="x:Key"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Generic defs template //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico<xsl:template mode="forward" match="*[name(.) = 'defs']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Generic filters template //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Limited to one filter (can be improved)
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'filter']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // GaussianBlur filter effects //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Blur values approximated with d = floor(s * 3*sqrt(2*pi)/4 + 0.5) from:
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Not supported by XAML:
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Horizontal and vertical blur.
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'feGaussianBlur']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <BlurEffect>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="../@id"><xsl:attribute name="x:Key"><xsl:value-of select="../@id" /></xsl:attribute></xsl:if>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="blur" select="normalize-space(translate(@stdDeviation, ',', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="floor($blur * 1.88 + 0.5)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="floor(substring-before($blur, ' ') * 1.88 + 0.5)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico </BlurEffect>
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico // Fake GaussianBlur filter effect //
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico Replaces all the other SVG effects with a zero radius blur effect.
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico<xsl:template mode="forward" match="*[name(.) = 'feBlend' or name(.) = 'feColorMatrix' or name(.) = 'feComponentTransfer' or name(.) = 'feComposite' or name(.) = 'feConvolveMatrix' or name(.) = 'feDiffuseLighting' or name(.) = 'feDisplacementMap' or name(.) = 'feFlood' or name(.) = 'feImage' or name(.) = 'feMerge' or name(.) = 'feMorphology' or name(.) = 'feOffset' or name(.) = 'feSpecularLighting' or name(.) = 'feTile' or name(.) = 'feTurbulence']">
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico <xsl:value-of select="concat('Tag ', name(.), ' not supported, replaced with empty blur')" />
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico <BlurEffect>
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico <xsl:if test="../@id"><xsl:attribute name="x:Key"><xsl:value-of select="../@id" /></xsl:attribute></xsl:if>
de437a45e30aea01a2fcf7961c202a5117fb1789JazzyNico </BlurEffect>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Linked filter effect //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Only supports blurs
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@filter and starts-with(@filter, 'url(#')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@filter, 'url(#'), ')'), '}')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@style and contains(normalize-space(substring-after(translate(@style, '"', ''), 'filter:')), 'url(#')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(normalize-space(substring-after(substring-after(translate(@style, '"', ''), 'filter:'), 'url(#')), ')'), '}')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico // Absolute gradients //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico Get the calling object position in order to substract it from the absolute gradient position.
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico (XAML absolute gradients values are absolute in the gradient's space).
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="id" select="concat('#', @id)"/>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:for-each select="//*[contains(@style,$id) or contains(@fill,$id) or contains(@stroke,$id)]">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@y" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@x" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Linear gradient //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'linearGradient']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <LinearGradientBrush>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">Absolute</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:otherwise>RelativeToBoundingBox</xsl:otherwise>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@spreadMethod = 'pad'">Pad</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@spreadMethod = 'reflect'">Reflect</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@spreadMethod = 'repeat'">Repeat</xsl:when>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:apply-templates mode="absolute_gradient" select=".">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:apply-templates mode="absolute_gradient" select=".">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="contains(@x1, '%') and contains(@y1, '%')">
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:value-of select="concat(round(number(substring-before(@x1, '%')) div 100), ',', round(number(substring-before(@y1,'%')) div 100))" />
fa6a04d2b08164ce6da6b36d4a6764bc274c183cJazzyNico <xsl:value-of select="concat(round((@x1 - $left)), ',', round((@y1 - $top)))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="contains(@x2, '%') and contains(@y2, '%')">
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:value-of select="concat(round(number(substring-before(@x2, '%')) div 100), ',', round(number(substring-before(@y2,'%')) div 100))" />
fa6a04d2b08164ce6da6b36d4a6764bc274c183cJazzyNico <xsl:value-of select="concat(round((@x2 - $left)), ',', round((@y2 - $top)))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <GradientStopCollection>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="reference_id" select="@xlink:href" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </GradientStopCollection>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="transform" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </LinearGradientBrush>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Radial gradient //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'radialGradient']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <RadialGradientBrush>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">Absolute</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:otherwise>RelativeToBoundingBox</xsl:otherwise>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@spreadMethod = 'pad'">Pad</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@spreadMethod = 'reflect'">Reflect</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@spreadMethod = 'repeat'">Repeat</xsl:when>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:apply-templates mode="absolute_gradient" select=".">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@gradientUnits = 'userSpaceOnUse' ">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:apply-templates mode="absolute_gradient" select=".">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="contains(@cx, '%') and contains(@cy, '%')">
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:value-of select="concat(round(number(substring-before(@cx, '%')) div 100), ',', round(number(substring-before(@cy, '%')) div 100))" />
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:value-of select="concat(round(@cx - $left), ',', round(@cy - $top))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="contains(@fx, '%') and contains(@fy, '%')">
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:value-of select="concat(round(number(substring-before(@fx, '%')) div 100), ',', round(number(substring-before(@fy, '%')) div 100))" />
97ee7e18184071adf0dc14fd993299aef66eececJazzyNico <xsl:value-of select="concat(round(@fx - $left), ',', round(@fy - $top))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before(@r, '%')) div 100" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before(@r, '%')) div 100" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <GradientStopCollection>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="reference_id" select="@xlink:href" />
4ea9bea02dc86bee697a25c1f8bd6e565aa5f14aJazzyNico <xsl:apply-templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </GradientStopCollection>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="transform" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </RadialGradientBrush>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Gradient stop //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'stop']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <GradientStop>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <!--xsl:apply-templates mode="stop_opacity" select="." /-->
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stop_color" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </GradientStop>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Clipping //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@clip-path and defs/clipPath/path/@d">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@clip-path and starts-with(@clip-path, 'url(#')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@clip-path, 'url(#'), ')'), '}')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@style and contains(@style, 'clip-path:url(#')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(@style, 'url(#'), ')'), '}')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico// Misc templates //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Id converter
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Decimal to hexadecimal converter
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Unit to pixel converter
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Object description
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Title and description
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * RDF and foreign objects
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Misc ignored stuff (markers, patterns, styles)
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Unknows tags
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Id converter //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Removes "-" from the original id
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Name"><xsl:value-of select="translate(@id, '- ', '')" /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="x:Key"><xsl:value-of select="translate(@id, '- ', '')" /></xsl:attribute>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Decimal to hexadecimal converter //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:value-of select="concat(substring('0123456789ABCDEF', 1 + floor(round($convert) div 16), 1), substring('0123456789ABCDEF', 1 + round($convert) mod 16, 1))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Unit to pixel converter //
aa90988e7aefa64e2138be94798727cec4825700JazzyNico Values with units (except %) are converted to pixels.
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Unknown units are kept.
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico em, ex and % not implemented
aa90988e7aefa64e2138be94798727cec4825700JazzyNico <xsl:value-of select="translate($convert_value, 'px', '')" />
358b46a388b1e316e51bc6fc5c4c7b10525db5caapenner <xsl:value-of select="translate($convert_value, 'pt', '') * 1.333333" />
358b46a388b1e316e51bc6fc5c4c7b10525db5caapenner <xsl:value-of select="translate($convert_value, 'pc', '') * 16" />
358b46a388b1e316e51bc6fc5c4c7b10525db5caapenner <xsl:value-of select="translate($convert_value, 'mm', '') * 3.779527" />
358b46a388b1e316e51bc6fc5c4c7b10525db5caapenner <xsl:value-of select="translate($convert_value, 'cm', '') * 37.79527" />
358b46a388b1e316e51bc6fc5c4c7b10525db5caapenner <xsl:value-of select="translate($convert_value, 'in', '') * 96" />
358b46a388b1e316e51bc6fc5c4c7b10525db5caapenner <xsl:value-of select="translate($convert_value, 'ft', '') * 1152" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Object description //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="*[name(.) = 'desc']/text()" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Title and description //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Title is ignored and desc is converted to Tag in the mode="desc" template
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'title' or name(.) = 'desc']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Switch //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico<xsl:template mode="forward" match="*[name(.) = 'switch']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Symbols //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'symbol']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico (since it is not supported by Inkscape, not implemented yet)
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'use']">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico<!-- Errors when more than one use element share the same reference
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:if test="@width and not(contains(@width, '%'))">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:attribute name="Width">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:call-template name="convert_unit">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@width" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:call-template>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:attribute>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:if test="@height and not(contains(@height, '%'))">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:attribute name="Height">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:call-template name="convert_unit">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@height" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:call-template>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:attribute>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:if test="@x">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:attribute name="Canvas.Left">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:call-template name="convert_unit">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@x" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:call-template>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:attribute></xsl:if>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:if test="@y">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:attribute name="Canvas.Top">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:call-template name="convert_unit">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@y" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:call-template>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </xsl:attribute>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <StaticResource>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:if test="@xlink:href">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:attribute name="ResourceKey">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:value-of select="substring-after(@xlink:href, '#')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico </xsl:attribute>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="forward" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico </StaticResource>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // RDF and foreign objects //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="rdf:RDF | *[name(.) = 'foreignObject']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Misc ignored stuff (markers, patterns, styles) //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico<xsl:template mode="forward" match="*[name(.) = 'marker' or name(.) = 'pattern' or name(.) = 'style']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Unknown tags //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico With generic and mode="forward" templates
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="concat('Unknown tag: ', name(.))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="concat('Unknown tag: ', name(.))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico// Colors and patterns //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Generic color template
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico* Object opacity
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Fill opacity
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Generic fill template
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke opacity
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Generic stroke template
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke width
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke mitterlimit
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke dasharray
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke dashoffset
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Linejoin SVG to XAML converter
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke linejoin
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Linecap SVG to XAML converter
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Stroke linecap
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Gradient stop
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Gradient stop opacity
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Gradient stop offset
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico* Image stretch
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Generic color template //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="starts-with($colorspec, 'rgb(') and not(contains($colorspec , '%'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="$opacityspec != '' and number($opacityspec) != 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="round(number($opacityspec) * 255)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after($colorspec, 'rgb('), ',')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(substring-after($colorspec, 'rgb('), ','), ',')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(substring-after(substring-after($colorspec, 'rgb('), ','), ','), ')')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="starts-with($colorspec, 'rgb(') and contains($colorspec , '%')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="$opacityspec != '' and number($opacityspec) != 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="round(number($opacityspec) * 255)" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before(substring-after($colorspec, 'rgb('), '%,')) * 255 div 100" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before(substring-after(substring-after($colorspec, 'rgb('), ','), '%,')) * 255 div 100" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before(substring-after(substring-after(substring-after($colorspec, 'rgb('), ','), ','), '%)')) * 255 div 100" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="round(number($opacityspec) * 255)" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="string-length(substring-after($colorspec, '#')) = 3">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="translate(substring-after($colorspec, '#'), 'abcdefgh', 'ABCDEFGH')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:value-of select="concat(substring($colorspec3, 1, 1), substring($colorspec3, 1, 1))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:value-of select="concat(substring($colorspec3, 2, 1), substring($colorspec3, 2, 1))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:value-of select="concat(substring($colorspec3, 3, 1), substring($colorspec3, 3, 1))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="translate(substring-after($colorspec, '#'), 'abcdefgh', 'ABCDEFGH')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="named_color_hex" select="document('colors.xml')/colors/color[@name = translate($colorspec, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]/@hex" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="$named_color_hex and $named_color_hex != ''">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="$opacityspec != '' and number($opacityspec) != 1">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number($opacityspec) * 255" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:value-of select="substring-after($named_color_hex, '#')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico // Object opacity //
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:if test="@opacity or (@style and (contains(@style, ';opacity:') or starts-with(@style, 'opacity:')))">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="@style and contains(@style, ';opacity:')">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:variable name="Opacity" select="substring-after(@style, ';opacity:')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:value-of select="substring-before($Opacity, ';')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="@style and starts-with(@style, 'opacity:')">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:variable name="Opacity" select="substring-after(@style, 'opacity:')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:value-of select="substring-before($Opacity, ';')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="parent::*" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@fill and starts-with(normalize-space(translate(@fill, '"', '')), 'url(#')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <!-- Removes unwanted characters in the color link (TODO: export to a specific template)-->
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(normalize-space(translate(@fill, '"', '')), 'url(#'), ')'), '}')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@style and contains(@style, 'fill:') and starts-with(normalize-space(substring-after(translate(@style, '"', ''), 'fill:')), 'url(#')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(normalize-space(substring-after(substring-after(translate(@style, '"', ''), 'fill:'), 'url(#')), ')'), '}')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@style and contains(@style, 'fill:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="Fill" select="normalize-space(substring-after(@style, 'fill:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Fill, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="fill" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Fill opacity //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="normalize-space(@fill-opacity)" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'fill-opacity:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="Opacity" select="normalize-space(substring-after(@style, 'fill-opacity:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Opacity, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="fill_opacity" select="parent::*" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Fill rule //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@fill-rule and (@fill-rule = 'nonzero' or @fill-rule = 'evenodd')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="normalize-space(@fill-rule)" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'fill-rule:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="FillRule" select="normalize-space(substring-after(@style, 'fill-rule:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="substring-before($FillRule, ';') = 'nonzero' or substring-before($FillRule, ';') = 'evenodd'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($FillRule, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$FillRule = 'nonzero' or $FillRule = 'evenodd'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="fill_rule" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:attribute name="FillRule">NonZero</xsl:attribute>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Generic fill template //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="fill"><xsl:apply-templates mode="fill" select="." /></xsl:variable>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="fill_opacity"><xsl:apply-templates mode="fill_opacity" select="." /></xsl:variable>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@stroke and starts-with(@stroke, 'url(#')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <!-- Removes unwanted characters in the color link (TODO: export to a specific template)-->
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(substring-after(normalize-space(translate(@stroke, '"', '')), 'url(#'), ')'), '}')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@stroke and normalize-space(@stroke) != 'none'">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@style and contains(@style, 'stroke:') and starts-with(normalize-space(substring-after(translate(@style, '"', ''), 'stroke:')), 'url(#')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="concat('{StaticResource ', substring-before(normalize-space(substring-after(substring-after(translate(@style, '"', ''), 'stroke:'), 'url(#')), ')'), '}')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="Stroke" select="normalize-space(substring-after(@style, 'stroke:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="substring-before($Stroke, ';') != 'none'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Stroke, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke opacity //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke-opacity:')">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="Opacity" select="substring-after(@style, 'stroke-opacity:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Opacity, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_opacity" select="parent::*" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Generic stroke template //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_opacity" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_width" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke width //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke-width:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="contains(substring-after(@style, 'stroke-width:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'stroke-width:'), ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'stroke-width:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_width" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke miterlimit //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="normalize-space(@stroke-miterlimit)" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke-miterlimit:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="StrokeMiterLimit" select="normalize-space(substring-after(@style, 'stroke-miterlimit:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="contains($StrokeMiterLimit, ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($StrokeMiterLimit, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke dasharray //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <!-- stroke-dasharray="10,30,20,30" becomes StrokeDashArray="1 3 2 3" ?? -->
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@stroke-dasharray and normalize-space(@stroke-dasharray) != 'none'">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke-dasharray:')">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="StrokeDashArray" select="substring-after(@style, 'stroke-dasharray:')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:if test="normalize-space(substring-before($StrokeDashArray, ';')) != 'none'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($StrokeDashArray, ';')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="normalize-space($StrokeDashArray) != 'none'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke dashoffset //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@stroke-dashoffset or (@style and contains(@style, 'stroke-dashoffset:'))">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="normalize-space(@stroke-dashoffset)" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="@style and contains(@style, 'stroke-dashoffset:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="StrokeDashOffset" select="normalize-space(substring-after(@style, 'stroke-dashoffset:'))" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:when test="contains($StrokeDashOffset, ';')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="substring-before($StrokeDashOffset, ';')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="$StrokeDashOffset" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Linejoin SVG to XAML converter //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="$linejoin = 'bevel'">Bevel</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="$linejoin = 'round'">Round</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke linejoin //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke-linejoin:')">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="StrokeLineJoin" select="substring-after(@style, 'stroke-linejoin:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($StrokeLineJoin, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Linecap SVG to XAML converter //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="$linecap = 'round'">Round</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="$linecap = 'square'">Square</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Stroke linecap //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stroke-linecap:')">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="StrokeStartLineCap" select="substring-after(@style, 'stroke-linecap:')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="StrokeEndLineCap" select="substring-after(@style, 'stroke-linecap:')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="contains($StrokeStartLineCap, ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($StrokeStartLineCap, ';')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="contains($StrokeEndLineCap, ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($StrokeEndLineCap, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stroke_linecap" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Gradient stops //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="normalize-space(@stop-opacity)" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stop-opacity:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="temp_opacity" select="normalize-space(substring-after(@style, 'stop-opacity:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($temp_opacity, ';')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="normalize-space(@stop-color)" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stop-color:')">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:variable name="Color" select="normalize-space(substring-after(@style, 'stop-color:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Color, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stop_color" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$hex_opacity != '' and starts-with($stopcolor, '#')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="concat('#', $hex_opacity, substring-after($stopcolor, '#'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Gradient stop opacity //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'stop-opacity:')">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="Opacity" select="substring-after(@style, 'stop-opacity:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Opacity, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stop_opacity" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Gradient stop offset //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before(@offset, '%')) div 100" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@style and contains(@style, 'offset:')">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:variable name="Offset" select="substring-after(@style, 'offset:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="number(substring-before($Offset, '%')) div 100" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($Offset, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="stop_offset" select="parent::*"/>
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico // Image stretch //
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico SVG: preserveAspectRatio, XAML: Stretch
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:when test="@style and contains(@style, 'preserveAspectRatio:')">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:variable name="ratio" select="normalize-space(substring-after(@style, 'preserveAspectRatio:'))" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="substring-before($ratio, ';')" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:attribute name="Stretch">Fill</xsl:attribute>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text specific templates //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text tspan
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text flowPara
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text flowRegion (text frame)
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Get font size
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Font weight
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Font family
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Font style
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Baseline shift
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Line height
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Writing mode
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text decoration
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text direction
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text position
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * Text object
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * FlowRoot object
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text span //
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico SVG: tspan, flowSpan, XAML: Span
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico Not supported in XAML:
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico * span position
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico<xsl:template mode="forward" match="*[name(.) = 'tspan' or name(.) = 'flowSpan']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:attribute name="whiteSpaceCollapse">preserve</xsl:attribute>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_size" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_weight" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_family" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_style" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_fill" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_decoration" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="line_height" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="baseline_shift" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text flowPara //
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico SVG: flowPara, flowDiv XAML: ?
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico<xsl:template mode="forward" match="*[name(.) = 'flowPara' or name(.) = 'flowDiv']">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:copy-of select="translate(text(), '	

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

', ' '))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text flowRegion //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_size" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_position" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Get text font size //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="@style and contains(@style, 'font-size:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="font_size" select="normalize-space(substring-after(@style, 'font-size:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($font_size, ';')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="name(..) = 'g' or name(..) = 'svg' or name(..) = 'text' or name(..) = 'flowPara' or name(..) = 'flowRoot'">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="get_font_size" select="parent::*"/>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text font size //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: font-size, XAML: FontSize
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="get_font_size" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="$value" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="$value" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text font weight //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: font-weight, XAML: FontWeight
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@style and contains(@style, 'font-weight:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="font_weight" select="normalize-space(substring-after(@style, 'font-weight:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($font_weight, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value <= 100 or $value = 'lighter'">Thin</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 100 and $value <= 200">ExtraLight</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 200 and $value <= 300">Light</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="($value > 300 and $value <= 400) or $value ='normal'">Normal</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 400 and $value <= 500">Medium</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 500 and $value <= 600">SemiBold</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="($value > 600 and $value <= 700) or $value ='bold'">Bold</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 700 and $value <= 800">ExtraBold</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 800 and $value <= 900">Black</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:when test="$value > 900 or $value = 'bolder'">ExtraBlack</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text font family //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: font-family, XAML: FontFamily
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="translate(@font-family, "'", '')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@style and contains(@style, 'font-family:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="font_family" select="normalize-space(substring-after(@style, 'font-family:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="translate(substring-before($font_family, ';'), "'", '')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="translate($font_family, "'", '')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text font style //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: font-style, XAML: FontStyle
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@style and contains(@style, 'font-style:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="font_style" select="normalize-space(substring-after(@style, 'font-style:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($font_style, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text baseline shift //
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico SVG: baseline-shift, XAML: BaselineAlignment
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'baseline-shift:') and not(contains(substring-after(@style, 'baseline-shift:'), ';'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'baseline-shift:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'baseline-shift:') and contains(substring-after(@style, 'baseline-shift:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'baseline-shift:'), ';')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:if test="$value = 'baseline' or $value='super' or $value='sub'">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='baseline'">Normal</xsl:when>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='super'">Superscript</xsl:when>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='sub'">Subscript</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text line height //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: line-height, FXG: lineHeight
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'line-height:')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:variable name="line_height" select="normalize-space(substring-after(@style, 'line-height:'))" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before($line_height, ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="$value" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text writing mode //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: writing-mode, FXG: blockProgression
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico Values inverted in FXG...
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'writing-mode:') and not(contains(substring-after(@style, 'writing-mode:'), ';'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'writing-mode:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'writing-mode:') and contains(substring-after(@style, 'writing-mode:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'writing-mode:'), ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:attribute name="textRotation">rotate270</xsl:attribute>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text decoration //
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico SVG: text-decoration, XAML: TextDecorations
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'text-decoration:') and not(contains(substring-after(@style, 'text-decoration:'), ';'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'text-decoration:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'text-decoration:') and contains(substring-after(@style, 'text-decoration:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'text-decoration:'), ';')" />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='underline'">Underline</xsl:when>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='line-through'">Strikethrough</xsl:when>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='overline'">Overline</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text fill //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: fill, fill-opacity, XAML: Foreground
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="fill_opacity" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text direction //
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico SVG: direction, unicode-bidi, XAML: FlowDirection
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'direction:') and not(contains(substring-after(@style, 'direction:'), ';'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'direction:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'direction:') and contains(substring-after(@style, 'direction:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'direction:'), ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'unicode-bidi:') and not(contains(substring-after(@style, 'unicode-bidi:'), ';'))">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-after(@style, 'unicode-bidi:')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="@style and contains(@style, 'unicode-bidi:') and contains(substring-after(@style, 'unicode-bidi:'), ';')">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:value-of select="substring-before(substring-after(@style, 'unicode-bidi:'), ';')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="$value != '' and ($bidi='embed' or $bidi='bidi-override')">
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='ltr'">LeftToRight</xsl:when>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="$value='rtl'">RightToLeft</xsl:when>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text size //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@width" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@height" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text position //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Keep the first x value only -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="substring-before(@x, ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@x" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <!-- Keep the first y value only -->
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="substring-before(@y, ' ')" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@y" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="get_font_size" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="$value" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:if test="$top_val != '' and $size_val != ''">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Objects //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Text objects //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: text, XAML: TextBlock
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico<xsl:template mode="forward" match="*[name(.) = 'text' or name(.) = 'flowRoot']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_size" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_weight" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_family" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="font_style" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_fill" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_size" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="text_decoration" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="direction" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:apply-templates mode="text_position" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@text-anchor = 'start'">Left</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@text-anchor = 'middle'">Center</xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@text-anchor = 'end'">Right</xsl:when>
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="flow_region" select="*[name(.) = 'flowRegion']/child::node()" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <!--xsl:apply-templates mode="transform" select="." /-->
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <!--xsl:apply-templates mode="forward" /-->
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:when test="*[name(.) = 'tspan' or name(.) = 'flowPara' or name(.) = 'flowDiv']/text()">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:copy-of select="translate(text(), '	

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

', ' '))" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </TextBlock>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Line object //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: line, XAML: Line
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'line']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Line'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Rectangle object //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: rect, XAML: Rectangle
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'rect']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@x" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@y" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@width" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@height" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <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>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="resources" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Rectangle'" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </Rectangle>
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Polygon object //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: polygon, XAML: Polygon
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'polygon']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@points"><xsl:attribute name="Points"><xsl:value-of select="@points" /></xsl:attribute></xsl:if>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="fill_rule" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Polygon'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Polyline object //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: polyline, XAML: Polyline
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'polyline']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:if test="@points"><xsl:attribute name="Points"><xsl:value-of select="@points" /></xsl:attribute></xsl:if>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="fill_rule" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Polyline'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: path, XAML: Path
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'path']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
717017db28f8518249146bbe42267a9992258a4fJazzyNico <xsl:when test="$silverlight_compatible = 'true'">
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:value-of select="translate(@d , ',', ' ')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <PathGeometry>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:value-of select="translate(@d , ',', ' ')" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="fill_rule" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </PathGeometry>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Path'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Ellipse object //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: ellipse, XAML: Ellipse
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'ellipse']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@cx"><xsl:value-of select="@cx" /></xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@cy"><xsl:value-of select="@cy" /></xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Canvas.Left"><xsl:value-of select='format-number($cx - @rx, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Width"><xsl:value-of select='format-number(2 * @rx, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Canvas.Top"><xsl:value-of select='format-number($cy - @ry, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Height"><xsl:value-of select='format-number(2 * @ry, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Ellipse'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Circle object //
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: circle, XAML: Ellipse
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'circle']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@cx"><xsl:value-of select="@cx" /></xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:when test="@cy"><xsl:value-of select="@cy" /></xsl:when>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Canvas.Left"><xsl:value-of select='format-number($cx - @r, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Canvas.Top"><xsl:value-of select='format-number($cy - @r, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Width"><xsl:value-of select='format-number(2 * @r, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:attribute name="Height"><xsl:value-of select='format-number(2 * @r, "#.#")' /></xsl:attribute>
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_fill" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="template_stroke" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_miterlimit" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dasharray" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_dashoffset" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linejoin" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="stroke_linecap" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:apply-templates mode="filter_effect" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <xsl:with-param name="mapped_type" select="'Ellipse'" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico // Image object//
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico SVG: image, FXG: Image
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico<xsl:template mode="forward" match="*[name(.) = 'image']">
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@x" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@y" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@width" />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="convert_value" select="@height" />
c980cfbcfff398f6c5eeba39f65d8df29f8c6256JazzyNico <xsl:apply-templates mode="image_stretch" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="object_opacity" select="." />
3188572e17610177ff8f0f999ac7853d026bc88dJazzyNico <xsl:apply-templates mode="resources" select="." />
b1c372edfc964321a8f7a9c3487e24bb9b170b98JazzyNico <xsl:with-param name="mapped_type" select="'Image'" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico// Geometry //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Generic clip path template
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico* Geometry for path
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Geometry for circle
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico* Geometry for rectangle
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico // Generic clip path template //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="forward" match="*[name(.) = 'clipPath']">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico // Clip Geometry for path //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico TODO: PathGeometry is positionned in the object's space, and thus needs to be translated.
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico<xsl:template mode="geometry" match="*[name(.) = 'path']">
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <PathGeometry>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:value-of select="translate(@d , ',', ' ')" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:apply-templates mode="fill_rule" select="." />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="mapped_type" select="'PathGeometry'" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico </PathGeometry>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico // Clip Geometry for circle //
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico<xsl:template mode="geometry" match="*[name(.) = 'circle' or name(.) = 'ellipse']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <EllipseGeometry>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="mapped_type" select="'EllipseGeometry'" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </EllipseGeometry>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico // Clip Geometry for rectangle //
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico<xsl:template mode="geometry" match="*[name(.) = 'rect']">
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico <RectangleGeometry>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@x" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@y" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@width" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="convert_value" select="@height" />
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:attribute name="Rect"><xsl:value-of select="concat($x, ', ', $y, ', ', $width, ', ', $height)" /></xsl:attribute>
ea55869971330306b308c104a7c1780119bb4b0eJazzyNico <xsl:with-param name="mapped_type" select="'RectangleGeometry'" />
55409b97452fc42cc6fbb542da79ab133ed705b3JazzyNico </RectangleGeometry>