~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

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
Version history:
 
25
 
 
26
20070907 Initial release
 
27
20070912 starts-with(@Data, 'F0 ') to strip of F0 from path data
 
28
20070912 nonzero and evenodd were outside xsl:attribute (reported by bulia byak and Ted Gould)
 
29
 
 
30
-->
 
31
 
 
32
<xsl:stylesheet version="1.0" 
 
33
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
34
xmlns:xlink="http://www.w3.org/1999/xlink"
 
35
xmlns:svg="http://www.w3.org/2000/svg"
 
36
xmlns:def="Definition"
 
37
exclude-result-prefixes="def">
 
38
<xsl:strip-space elements="*" />
 
39
<xsl:output method="xml" encoding="ISO-8859-1"/>
 
40
 
 
41
<xsl:template mode="forward" match="*[name(.) = 'Path']">
 
42
  <path>
 
43
    <xsl:if test="@Data">
 
44
      <xsl:attribute name="d">
 
45
        <xsl:choose>
 
46
          <xsl:when test="starts-with(@Data, 'F0 ')"><xsl:value-of select="substring-after(@Data, 'F0 ')" /></xsl:when>
 
47
          <xsl:when test="starts-with(@Data, 'F1 ')"><xsl:value-of select="substring-after(@Data, 'F1 ')" /></xsl:when>
 
48
          <xsl:otherwise><xsl:value-of select="@Data" /></xsl:otherwise>
 
49
        </xsl:choose>
 
50
      </xsl:attribute>
 
51
    </xsl:if>
 
52
    <xsl:choose>
 
53
      <xsl:when test="@FillRule = 'nonzero' or starts-with(@Data, 'F1 ')"><xsl:attribute name="fill-rule">nonzero</xsl:attribute></xsl:when>
 
54
      <xsl:when test="@FillRule = 'evenodd' or starts-with(@Data, 'F0 ')"><xsl:attribute name="fill-rule">evenodd</xsl:attribute></xsl:when>
 
55
    </xsl:choose>
 
56
    <xsl:call-template name="template_properties" />  
 
57
    <xsl:call-template name="template_transform" />  
 
58
    <xsl:apply-templates mode="forward" />
 
59
  </path>
 
60
</xsl:template>    
 
61
 
 
62
<xsl:template mode="forward" match="*[name(.) = 'Path.Data']">
 
63
  <xsl:attribute name="d">
 
64
    <xsl:apply-templates mode="forward" />
 
65
  </xsl:attribute>
 
66
  <xsl:if test="@FillRule">
 
67
    <xsl:attribute name="fill-rule">
 
68
      <xsl:choose>
 
69
        <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>
 
70
        <xsl:otherwise>evenodd</xsl:otherwise>
 
71
      </xsl:choose>
 
72
    </xsl:attribute>
 
73
  </xsl:if>
 
74
</xsl:template>
 
75
 
 
76
<xsl:template mode="forward" match="*[name(.) = 'Line']">
 
77
  <line>
 
78
    <xsl:if test="@X1"><xsl:attribute name="x1"><xsl:value-of select="@X1" /></xsl:attribute></xsl:if> 
 
79
    <xsl:if test="@Y1"><xsl:attribute name="y1"><xsl:value-of select="@Y1" /></xsl:attribute></xsl:if> 
 
80
    <xsl:if test="@X2"><xsl:attribute name="x2"><xsl:value-of select="@X2" /></xsl:attribute></xsl:if> 
 
81
    <xsl:if test="@Y2"><xsl:attribute name="y2"><xsl:value-of select="@Y2" /></xsl:attribute></xsl:if> 
 
82
    <xsl:call-template name="template_properties" />  
 
83
    <xsl:call-template name="template_transform" />  
 
84
    <xsl:apply-templates mode="forward" />
 
85
  </line>
 
86
</xsl:template>
 
87
 
 
88
<xsl:template mode="forward" match="*[name(.) = 'Ellipse']">
 
89
  <ellipse>
 
90
    <xsl:if test="@Width">
 
91
      <xsl:attribute name="rx"><xsl:value-of select="@Width div 2" /></xsl:attribute>
 
92
      <xsl:if test="@Canvas.Left">
 
93
        <xsl:attribute name="cx"><xsl:value-of select="@Canvas.Left + @Width div 2" /></xsl:attribute>
 
94
      </xsl:if>
 
95
    </xsl:if>
 
96
    <xsl:if test="@Height">
 
97
      <xsl:attribute name="ry"><xsl:value-of select="@Height div 2" /></xsl:attribute>
 
98
      <xsl:if test="@Canvas.Top">
 
99
        <xsl:attribute name="cy"><xsl:value-of select="@Canvas.Top + @Height div 2" /></xsl:attribute>
 
100
      </xsl:if>
 
101
    </xsl:if>
 
102
    <xsl:call-template name="template_properties" />  
 
103
    <xsl:call-template name="template_transform" />  
 
104
    <xsl:apply-templates mode="forward" />
 
105
  </ellipse>
 
106
</xsl:template>
 
107
 
 
108
<xsl:template mode="forward" match="*[name(.) = 'Rectangle']">
 
109
  <rect>
 
110
    <xsl:if test="@Canvas.Left"><xsl:attribute name="x"><xsl:value-of select="@Canvas.Left" /></xsl:attribute></xsl:if>  
 
111
    <xsl:if test="@Canvas.Top"><xsl:attribute name="y"><xsl:value-of select="@Canvas.Top" /></xsl:attribute></xsl:if>  
 
112
    <xsl:if test="@Width"><xsl:attribute name="width"><xsl:value-of select="@Width" /></xsl:attribute></xsl:if>  
 
113
    <xsl:if test="@Height"><xsl:attribute name="height"><xsl:value-of select="@Height" /></xsl:attribute></xsl:if>  
 
114
    <xsl:if test="@RadiusX"><xsl:attribute name="rx"><xsl:value-of select="@RadiusX" /></xsl:attribute></xsl:if>  
 
115
    <xsl:if test="@RadiusY"><xsl:attribute name="ry"><xsl:value-of select="@RadiusY" /></xsl:attribute></xsl:if>  
 
116
    <xsl:call-template name="template_properties" /> 
 
117
    <xsl:call-template name="template_transform" />
 
118
    <xsl:call-template name="template_timeline_animations" />
 
119
    <xsl:apply-templates mode="forward" />
 
120
  </rect>
 
121
</xsl:template>
 
122
 
 
123
<xsl:template mode="forward" match="*[name(.) = 'Polyline']">
 
124
  <polyline>
 
125
    <xsl:if test="@Points"><xsl:attribute name="points"><xsl:value-of select="@Points" /></xsl:attribute></xsl:if>
 
126
    <xsl:attribute name="fill-rule">
 
127
      <xsl:choose>
 
128
        <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>
 
129
        <xsl:when test="@FillRule = 'evenodd'">evenodd</xsl:when>
 
130
      </xsl:choose>
 
131
    </xsl:attribute>
 
132
    <xsl:call-template name="template_properties" />  
 
133
    <xsl:call-template name="template_transform" />  
 
134
    <xsl:apply-templates mode="forward" />
 
135
  </polyline>
 
136
</xsl:template>
 
137
 
 
138
<xsl:template mode="forward" match="*[name(.) = 'Polygon']">
 
139
  <polygon>
 
140
    <xsl:if test="@Points"><xsl:attribute name="points"><xsl:value-of select="@Points" /></xsl:attribute></xsl:if>
 
141
    <xsl:attribute name="fill-rule">
 
142
      <xsl:choose>
 
143
        <xsl:when test="@FillRule = 'nonzero'">nonzero</xsl:when>
 
144
        <xsl:when test="@FillRule = 'evenodd'">evenodd</xsl:when>
 
145
      </xsl:choose>
 
146
    </xsl:attribute>
 
147
    <xsl:call-template name="template_properties" />  
 
148
    <xsl:call-template name="template_transform" />  
 
149
    <xsl:apply-templates mode="forward" />
 
150
  </polygon>
 
151
</xsl:template>
 
152
 
 
153
<xsl:template mode="forward" match="*[name(.) = 'Glyphs']">
 
154
  <defs>
 
155
    <font-face>
 
156
      <xsl:attribute name="font-family"><xsl:value-of select="concat('TrueType ', generate-id(.))" /></xsl:attribute>
 
157
      <font-face-src><font-face-uri><xsl:attribute name="xlink:href"><xsl:value-of select="@FontUri" /></xsl:attribute></font-face-uri></font-face-src>
 
158
    </font-face>
 
159
  </defs>
 
160
  <text>
 
161
    <xsl:if test="@FontRenderingEmSize"><xsl:attribute name="font-size"><xsl:value-of select="@FontRenderingEmSize" /></xsl:attribute></xsl:if>
 
162
    <xsl:if test="@OriginX"><xsl:attribute name="x"><xsl:value-of select="@OriginX" /></xsl:attribute></xsl:if>
 
163
    <xsl:if test="@OriginY"><xsl:attribute name="y"><xsl:value-of select="@OriginY" /></xsl:attribute></xsl:if>
 
164
    <xsl:attribute name="font-family"><xsl:value-of select="concat('TrueType ', generate-id(.))" /></xsl:attribute>
 
165
    <xsl:call-template name="template_properties" />  
 
166
    <xsl:call-template name="template_transform" />  
 
167
    <xsl:if test="@UnicodeString"><xsl:value-of select="@UnicodeString" /></xsl:if>
 
168
  </text>
 
169
</xsl:template>
 
170
 
 
171
</xsl:stylesheet>