~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to share/extensions/xaml2svg/transform.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
 
 
3
<!--
 
4
Copyright (c) 2005-2007 Toine de Greef (a.degreef@chello.nl)
 
5
 
 
6
Permission is hereby granted, free of charge, to any person obtaining a copy
 
7
of this software and associated documentation files (the "Software"), to deal
 
8
in the Software without restriction, including without limitation the rights
 
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
10
copies of the Software, and to permit persons to whom the Software is
 
11
furnished to do so, subject to the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
22
THE SOFTWARE.
 
23
-->
 
24
 
 
25
<xsl:stylesheet version="1.0" 
 
26
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
27
xmlns:xlink="http://www.w3.org/1999/xlink"
 
28
xmlns:svg="http://www.w3.org/2000/svg"
 
29
xmlns:def="Definition"
 
30
exclude-result-prefixes="def">
 
31
<xsl:strip-space elements="*" />
 
32
<xsl:output method="xml" encoding="ISO-8859-1"/>
 
33
 
 
34
<xsl:template name="template_transform">
 
35
  <xsl:variable name="transform_value">
 
36
    <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>
 
37
    <xsl:apply-templates select="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]/*" />
 
38
  </xsl:variable>  
 
39
  <xsl:if test="string-length($transform_value) &gt; 0"><xsl:attribute name="transform"><xsl:value-of select="$transform_value" /></xsl:attribute></xsl:if>  
 
40
</xsl:template>
 
41
 
 
42
<xsl:template name="template_gradienttransform">
 
43
  <xsl:variable name="transform_value">
 
44
    <xsl:if test="@Canvas.Left and @Canvas.Top"><xsl:value-of select="concat('translate(', @Canvas.Left, ',', @Canvas.Top, ')')" /></xsl:if>
 
45
    <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>
 
46
    <xsl:apply-templates select="*[name(.) = 'Brush.Transform' or name(.) = concat(name(..), '.Transform')]" />
 
47
    <xsl:apply-templates select="*[name(.) = 'Brush.RelativeTransform' or name(.) = concat(name(..), '.RelativeTransform')]" />
 
48
  </xsl:variable>  
 
49
  <xsl:if test="string-length($transform_value) &gt; 0"><xsl:attribute name="gradientTransform"><xsl:value-of select="$transform_value" /></xsl:attribute></xsl:if>  
 
50
</xsl:template>
 
51
 
 
52
<xsl:template match="*[name(.) = 'UIElement.RenderTransform' or name(.) = 'Shape.RenderTransform' or name(.) = concat(name(..), '.RenderTransform')]">
 
53
  <!-- xsl:apply-templates /-->
 
54
</xsl:template>
 
55
 
 
56
<xsl:template match="*[name(.) = 'Brush.Transform' or name(.) = concat(name(..), '.Transform')]">
 
57
  <xsl:apply-templates />
 
58
</xsl:template>
 
59
 
 
60
<xsl:template match="*[name(.) = 'Brush.RelativeTransform' or name(.) = concat(name(..), '.RelativeTransform')]">
 
61
  <xsl:apply-templates />
 
62
</xsl:template>
 
63
 
 
64
<!--
 
65
<xsl:template match="*[name(.) = 'TransformCollection' or name(.) = 'TransformGroup']">
 
66
  <xsl:apply-templates />
 
67
</xsl:template>
 
68
-->
 
69
<xsl:template match="*[name(.) = 'TransformGroup']">
 
70
  <xsl:apply-templates />
 
71
</xsl:template>
 
72
 
 
73
 
 
74
<!--
 
75
<xsl:template mode="forward" match="*[name(.) = 'TransformDecorator']">
 
76
  <g>
 
77
    <xsl:attribute name="transform">
 
78
      <xsl:if test="@Transform"><xsl:value-of select="@Transform" /></xsl:if>
 
79
      <xsl:apply-templates select="*[name(.) = 'TransformDecorator.Transform']/*" />
 
80
    </xsl:attribute>
 
81
  <xsl:apply-templates select="*[name(.) = 'TransformDecorator.Transform']/*/*" />  
 
82
  <xsl:apply-templates mode="forward" select="*[name(.) != 'TransformDecorator.Transform']" />
 
83
  </g>
 
84
</xsl:template>
 
85
-->
 
86
 
 
87
<xsl:template match="*[name(.) = 'TranslateTransform']">
 
88
  <xsl:if test="@X">
 
89
    <xsl:value-of select="concat('translate(', @X)" />
 
90
    <xsl:if test="@Y"><xsl:value-of select="concat(', ', @Y)" /></xsl:if>
 
91
    <xsl:value-of select="') '" />      
 
92
  </xsl:if>  
 
93
</xsl:template>
 
94
 
 
95
<xsl:template match="*[name(.) = 'ScaleTransform']">
 
96
  <xsl:if test="@ScaleX">
 
97
    <xsl:value-of select="concat('scale(', @ScaleX)" />
 
98
    <xsl:if test="@ScaleY"><xsl:value-of select="concat(', ', @ScaleY)" /></xsl:if>
 
99
    <xsl:value-of select="') '" />      
 
100
  </xsl:if>   
 
101
</xsl:template>
 
102
 
 
103
<xsl:template match="*[name(.) = 'RotateTransform']">
 
104
  <xsl:if test="@Angle">
 
105
    <xsl:value-of select="concat('rotate(', @Angle)" />
 
106
    <xsl:if test="@Center"><xsl:value-of select="concat(',', @Center)" /></xsl:if>
 
107
    <xsl:value-of select="') '" />      
 
108
  </xsl:if>
 
109
</xsl:template>
 
110
 
 
111
<xsl:template match="*[name(.) = 'SkewTransform']">
 
112
  <xsl:if test="@AngleX"><xsl:value-of select="concat('skewX(', @AngleX,') ')" /></xsl:if>  
 
113
  <xsl:if test="@AngleY"><xsl:value-of select="concat('skewY(', @AngleY,') ')" /></xsl:if>
 
114
</xsl:template>
 
115
 
 
116
<xsl:template match="*[name(.) = 'MatrixTransform']">
 
117
  <xsl:if test="@Matrix"><xsl:value-of select="concat('matrix(', @Matrix,') ')" /></xsl:if>  
 
118
</xsl:template>
 
119
 
 
120
</xsl:stylesheet>