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