1 | <?xml version="1.0"?> |
---|
2 | <!-- |
---|
3 | Copyright 2002-2004 The Apache Software Foundation |
---|
4 | |
---|
5 | Licensed under the Apache License, Version 2.0 (the "License"); |
---|
6 | you may not use this file except in compliance with the License. |
---|
7 | You may obtain a copy of the License at |
---|
8 | |
---|
9 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | |
---|
11 | Unless required by applicable law or agreed to in writing, software |
---|
12 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | See the License for the specific language governing permissions and |
---|
15 | limitations under the License. |
---|
16 | --> |
---|
17 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
---|
18 | |
---|
19 | <xsl:param name="orientation-tb"/> |
---|
20 | <xsl:param name="orientation-lr"/> |
---|
21 | <xsl:param name="size"/> |
---|
22 | <xsl:param name="bg-color-name"/> |
---|
23 | <xsl:param name="stroke-color-name"/> |
---|
24 | <xsl:param name="fg-color-name"/> |
---|
25 | |
---|
26 | <!-- if not all colors are present, don't even try to render the corners --> |
---|
27 | <xsl:variable name="isize"><xsl:choose> |
---|
28 | <xsl:when test="$bg-color-name and $stroke-color-name and $fg-color-name"><xsl:value-of select="$size"/></xsl:when> |
---|
29 | <xsl:otherwise>0</xsl:otherwise> |
---|
30 | </xsl:choose></xsl:variable> |
---|
31 | <xsl:variable name="smallersize" select="number($isize)-1"/> |
---|
32 | <xsl:variable name="biggersize" select="number($isize)+1"/> |
---|
33 | <xsl:variable name="bg"><xsl:if test="skinconfig/colors/color[@name=$bg-color-name]">fill:<xsl:value-of select="skinconfig/colors/color[@name=$bg-color-name]/@value"/>;</xsl:if></xsl:variable> |
---|
34 | <xsl:variable name="fill"><xsl:if test="skinconfig/colors/color[@name=$stroke-color-name]">fill:<xsl:value-of select="skinconfig/colors/color[@name=$stroke-color-name]/@value"/>;</xsl:if></xsl:variable> |
---|
35 | <xsl:variable name="stroke"><xsl:if test="skinconfig/colors/color[@name=$fg-color-name]">stroke:<xsl:value-of select="skinconfig/colors/color[@name=$fg-color-name]/@value"/>;</xsl:if></xsl:variable> |
---|
36 | |
---|
37 | <xsl:template match="skinconfig"> |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | <svg width="{$isize}" height="{$isize}"> |
---|
42 | <!-- background--> |
---|
43 | <rect x="-1" y="-1" width="{$biggersize}" height="{$biggersize}" style="{$bg}stroke-width:0"/> |
---|
44 | <!-- 0,0 0,-4 4,0 4,-4--> |
---|
45 | |
---|
46 | <xsl:variable name="flip-tb-scale"> |
---|
47 | <xsl:choose> |
---|
48 | <xsl:when test="$orientation-tb='t'">1</xsl:when> |
---|
49 | <xsl:otherwise>-1</xsl:otherwise> |
---|
50 | </xsl:choose> |
---|
51 | </xsl:variable> |
---|
52 | |
---|
53 | <xsl:variable name="flip-lr-scale"> |
---|
54 | <xsl:choose> |
---|
55 | <xsl:when test="$orientation-lr='l'">1</xsl:when> |
---|
56 | <xsl:otherwise>-1</xsl:otherwise> |
---|
57 | </xsl:choose> |
---|
58 | </xsl:variable> |
---|
59 | |
---|
60 | <xsl:variable name="flip-tb-translate"> |
---|
61 | <xsl:choose> |
---|
62 | <xsl:when test="$orientation-tb='t'">0</xsl:when> |
---|
63 | <xsl:otherwise>-<xsl:value-of select="$isize" /></xsl:otherwise> |
---|
64 | </xsl:choose> |
---|
65 | </xsl:variable> |
---|
66 | |
---|
67 | <xsl:variable name="flip-lr-translate"> |
---|
68 | <xsl:choose> |
---|
69 | <xsl:when test="$orientation-lr='l'">0</xsl:when> |
---|
70 | <xsl:otherwise>-<xsl:value-of select="$isize" /></xsl:otherwise> |
---|
71 | </xsl:choose> |
---|
72 | </xsl:variable> |
---|
73 | |
---|
74 | <!-- flip transform --> |
---|
75 | <g transform="scale({$flip-lr-scale},{$flip-tb-scale}) translate({$flip-lr-translate}, {$flip-tb-translate})"> |
---|
76 | <xsl:call-template name="figure" /> |
---|
77 | </g> |
---|
78 | </svg> |
---|
79 | </xsl:template> |
---|
80 | |
---|
81 | |
---|
82 | <xsl:template name="figure"> |
---|
83 | <!-- Just change shape here --> |
---|
84 | <g transform="translate(0.5 0.5)"> |
---|
85 | <ellipse cx="{$smallersize}" cy="{$smallersize}" rx="{$smallersize}" ry="{$smallersize}" |
---|
86 | style="{$fill}{$stroke}stroke-width:1"/> |
---|
87 | </g> |
---|
88 | <!-- end --> |
---|
89 | </xsl:template> |
---|
90 | |
---|
91 | |
---|
92 | <xsl:template match="*"></xsl:template> |
---|
93 | <xsl:template match="text()"></xsl:template> |
---|
94 | |
---|
95 | </xsl:stylesheet> |
---|