2.1 --- a/docs/COPYING.txt Tue May 27 23:43:55 2014 +0200
2.2 +++ b/docs/COPYING.txt Sun Nov 01 23:29:31 2015 +0100
2.3 @@ -2,7 +2,7 @@
2.4 -----------------
2.5
2.6 Copyright (C) 2008 Wayne Tucker
2.7 -Copyright (C) 2011, 2012 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2011, 2012, 2013, 2014, 2015 Paul Boddie <paul@boddie.org.uk>
2.9 Copyright (C) 2012 Frederick Capovilla (Libéo) <fcapovilla@live.ca>
2.10
2.11 This software is free software; you can redistribute it and/or
2.12 @@ -19,3 +19,26 @@
2.13 License along with this library; see the file LICENCE.txt
2.14 If not, write to the Free Software Foundation, Inc.,
2.15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2.16 +
2.17 +Licence for the notugly.xsl Stylesheet
2.18 +--------------------------------------
2.19 +
2.20 +Copyright (c) 2012 Vidar Hokstad <vidar@hokstad.com>
2.21 +
2.22 +Permission is hereby granted, free of charge, to any person obtaining a
2.23 +copy of this software and associated documentation files (the "Software"),
2.24 +to deal in the Software without restriction, including without limitation
2.25 +the rights to use, copy, modify, merge, publish, distribute, sublicense,
2.26 +and/or sell copies of the Software, and to permit persons to whom the
2.27 +Software is furnished to do so, subject to the following conditions:
2.28 +
2.29 +The above copyright notice and this permission notice shall be included
2.30 +in all copies or substantial portions of the Software.
2.31 +
2.32 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2.33 +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2.34 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2.35 +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2.36 +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2.37 +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2.38 +OTHER DEALINGS IN THE SOFTWARE.
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/resources/notugly.xsl Sun Nov 01 23:29:31 2015 +0100
4.3 @@ -0,0 +1,613 @@
4.4 +<?xml version="1.0" ?>
4.5 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
4.6 + xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg">
4.7 +<xsl:output method="xml" indent="yes"
4.8 + doctype-public="-//W3C//DTD SVG 1.0//EN"
4.9 + doctype-system="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
4.10 +
4.11 +<xsl:variable name="text-style">font-size:10px; font-family:sans-serif;</xsl:variable>
4.12 +
4.13 +<!-- Used to generate unique gradient fills for colors given by hex value
4.14 + Search for generate-id to find where its used
4.15 +-->
4.16 +<xsl:key name="fills" match="*" use="@fill"/>
4.17 +
4.18 +<xsl:template match="@*|node()">
4.19 + <xsl:copy>
4.20 + <xsl:apply-templates select="@*|node()"/>
4.21 + </xsl:copy>
4.22 +</xsl:template>
4.23 +
4.24 +<xsl:template match="svg:svg">
4.25 + <svg xmlns="http://www.w3.org/2000/svg">
4.26 + <!-- Order is important here, so the attributes below overrides the
4.27 + originals, which are copied "wholesale" -->
4.28 + <xsl:apply-templates select="@*" />
4.29 +
4.30 + <defs>
4.31 + <linearGradient id="white" x1="0%" y1="0%" x2="0%" y2="0%">
4.32 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.33 + </linearGradient>
4.34 +
4.35 + <linearGradient id="black" x1="0%" y1="0%" x2="0%" y2="0%">
4.36 + <stop offset="0%" style="stop-color:rgb(0,0,0);stop-opacity:1"/>
4.37 + </linearGradient>
4.38 +
4.39 + <linearGradient id="aquamarine" x1="0%" y1="0%" x2="100%" y2="100%">
4.40 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.41 + <stop offset="100%" style="stop-color:rgb(127,255,212);stop-opacity:1"/>
4.42 + </linearGradient>
4.43 +
4.44 + <linearGradient id="azure" x1="0%" y1="0%" x2="100%" y2="100%">
4.45 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.46 + <stop offset="100%" style="stop-color:rgb(240,255,255);stop-opacity:1"/>
4.47 + </linearGradient>
4.48 +
4.49 + <linearGradient id="blue" x1="0%" y1="0%" x2="100%" y2="100%">
4.50 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.51 + <stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1"/>
4.52 + </linearGradient>
4.53 +
4.54 + <linearGradient id="blueviolet" x1="0%" y1="0%" x2="100%" y2="100%">
4.55 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.56 + <stop offset="100%" style="stop-color:rgb(138,43,226);stop-opacity:1"/>
4.57 + </linearGradient>
4.58 +
4.59 + <linearGradient id="brown" x1="0%" y1="0%" x2="100%" y2="100%">
4.60 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.61 + <stop offset="100%" style="stop-color:rgb(165,42,42);stop-opacity:1"/>
4.62 + </linearGradient>
4.63 +
4.64 + <linearGradient id="cadetblue" x1="0%" y1="0%" x2="100%" y2="100%">
4.65 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.66 + <stop offset="100%" style="stop-color:rgb(95,158,160);stop-opacity:1"/>
4.67 + </linearGradient>
4.68 +
4.69 + <linearGradient id="chocolate" x1="0%" y1="0%" x2="100%" y2="100%">
4.70 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.71 + <stop offset="100%" style="stop-color:rgb(210,105,30);stop-opacity:1"/>
4.72 + </linearGradient>
4.73 +
4.74 + <linearGradient id="cornflowerblue" x1="0%" y1="0%" x2="100%" y2="100%">
4.75 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.76 + <stop offset="100%" style="stop-color:rgb(100,149,237);stop-opacity:1"/>
4.77 + </linearGradient>
4.78 +
4.79 + <linearGradient id="crimson" x1="0%" y1="0%" x2="100%" y2="100%">
4.80 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.81 + <stop offset="100%" style="stop-color:rgb(220,20,60);stop-opacity:1"/>
4.82 + </linearGradient>
4.83 +
4.84 + <linearGradient id="cyan" x1="0%" y1="0%" x2="100%" y2="100%">
4.85 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.86 + <stop offset="100%" style="stop-color:rgb(0,255,255);stop-opacity:1"/>
4.87 + </linearGradient>
4.88 +
4.89 + <linearGradient id="darkgreen" x1="0%" y1="0%" x2="100%" y2="100%">
4.90 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.91 + <stop offset="100%" style="stop-color:rgb(0,100,0);stop-opacity:1"/>
4.92 + </linearGradient>
4.93 +
4.94 + <linearGradient id="darkorange" x1="0%" y1="0%" x2="100%" y2="100%">
4.95 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.96 + <stop offset="100%" style="stop-color:rgb(255,140,0);stop-opacity:1"/>
4.97 + </linearGradient>
4.98 +
4.99 + <linearGradient id="gold" x1="0%" y1="0%" x2="100%" y2="100%">
4.100 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.101 + <stop offset="100%" style="stop-color:rgb(255,215,0);stop-opacity:1"/>
4.102 + </linearGradient>
4.103 +
4.104 + <linearGradient id="gray" x1="0%" y1="0%" x2="100%" y2="100%">
4.105 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.106 + <stop offset="100%" style="stop-color:rgb(192,192,192);stop-opacity:1"/>
4.107 + </linearGradient>
4.108 +
4.109 + <linearGradient id="greenyellow" x1="0%" y1="0%" x2="100%" y2="100%">
4.110 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.111 + <stop offset="100%" style="stop-color:rgb(173,255,47);stop-opacity:1"/>
4.112 + </linearGradient>
4.113 +
4.114 + <linearGradient id="green" x1="0%" y1="0%" x2="100%" y2="100%">
4.115 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.116 + <stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1"/>
4.117 + </linearGradient>
4.118 +
4.119 + <linearGradient id="grey" x1="0%" y1="0%" x2="100%" y2="100%">
4.120 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.121 + <stop offset="100%" style="stop-color:rgb(192,192,192);stop-opacity:1"/>
4.122 + </linearGradient>
4.123 +
4.124 + <linearGradient id="hotpink" x1="0%" y1="0%" x2="100%" y2="100%">
4.125 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.126 + <stop offset="100%" style="stop-color:rgb(255,105,180);stop-opacity:1"/>
4.127 + </linearGradient>
4.128 +
4.129 + <linearGradient id="indianred" x1="0%" y1="0%" x2="100%" y2="100%">
4.130 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.131 + <stop offset="100%" style="stop-color:rgb(205,92,92);stop-opacity:1"/>
4.132 + </linearGradient>
4.133 +
4.134 + <linearGradient id="indigo" x1="0%" y1="0%" x2="100%" y2="100%">
4.135 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.136 + <stop offset="100%" style="stop-color:rgb(75,0,130);stop-opacity:1"/>
4.137 + </linearGradient>
4.138 +
4.139 + <linearGradient id="lavender" x1="0%" y1="0%" x2="100%" y2="100%">
4.140 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.141 + <stop offset="100%" style="stop-color:rgb(230,230,250);stop-opacity:1"/>
4.142 + </linearGradient>
4.143 +
4.144 + <linearGradient id="lightblue" x1="0%" y1="0%" x2="100%" y2="100%">
4.145 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.146 + <stop offset="100%" style="stop-color:rgb(173,216,230);stop-opacity:1"/>
4.147 + </linearGradient>
4.148 +
4.149 + <linearGradient id="lightgray" x1="0%" y1="0%" x2="100%" y2="100%">
4.150 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.151 + <stop offset="100%" style="stop-color:rgb(211,211,211);stop-opacity:1"/>
4.152 + </linearGradient>
4.153 +
4.154 + <linearGradient id="lightgrey" x1="0%" y1="0%" x2="100%" y2="100%">
4.155 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.156 + <stop offset="100%" style="stop-color:rgb(211,211,211);stop-opacity:1"/>
4.157 + </linearGradient>
4.158 +
4.159 + <linearGradient id="magenta" x1="0%" y1="0%" x2="100%" y2="100%">
4.160 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.161 + <stop offset="100%" style="stop-color:rgb(255,0,255);stop-opacity:1"/>
4.162 + </linearGradient>
4.163 +
4.164 + <linearGradient id="maroon" x1="0%" y1="0%" x2="100%" y2="100%">
4.165 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.166 + <stop offset="100%" style="stop-color:rgb(176,48,96);stop-opacity:1"/>
4.167 + </linearGradient>
4.168 +
4.169 + <linearGradient id="mediumblue" x1="0%" y1="0%" x2="100%" y2="100%">
4.170 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.171 + <stop offset="100%" style="stop-color:rgb(0,0,205);stop-opacity:1"/>
4.172 + </linearGradient>
4.173 +
4.174 + <linearGradient id="mediumpurple" x1="0%" y1="0%" x2="100%" y2="100%">
4.175 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.176 + <stop offset="100%" style="stop-color:rgb(147,112,219);stop-opacity:1"/>
4.177 + </linearGradient>
4.178 +
4.179 + <linearGradient id="orange" x1="0%" y1="0%" x2="100%" y2="100%">
4.180 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.181 + <stop offset="100%" style="stop-color:rgb(255,165,0);stop-opacity:1"/>
4.182 + </linearGradient>
4.183 +
4.184 + <linearGradient id="pink" x1="0%" y1="0%" x2="100%" y2="100%">
4.185 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.186 + <stop offset="100%" style="stop-color:rgb(255,192,203);stop-opacity:1"/>
4.187 + </linearGradient>
4.188 +
4.189 + <linearGradient id="purple" x1="0%" y1="0%" x2="100%" y2="100%">
4.190 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.191 + <stop offset="100%" style="stop-color:rgb(160,32,240);stop-opacity:1"/>
4.192 + </linearGradient>
4.193 +
4.194 + <linearGradient id="red" x1="0%" y1="0%" x2="100%" y2="100%">
4.195 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.196 + <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1"/>
4.197 + </linearGradient>
4.198 +
4.199 + <linearGradient id="steelblue" x1="0%" y1="0%" x2="100%" y2="100%">
4.200 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.201 + <stop offset="100%" style="stop-color:rgb(70,130,180);stop-opacity:1"/>
4.202 + </linearGradient>
4.203 +
4.204 + <linearGradient id="violet" x1="0%" y1="0%" x2="100%" y2="100%">
4.205 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.206 + <stop offset="100%" style="stop-color:rgb(238,130,238);stop-opacity:1"/>
4.207 + </linearGradient>
4.208 +
4.209 + <linearGradient id="yellow" x1="0%" y1="0%" x2="100%" y2="100%">
4.210 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.211 + <stop offset="100%" style="stop-color:rgb(255,255,0);stop-opacity:1"/>
4.212 + </linearGradient>
4.213 +
4.214 + <linearGradient id="none" x1="0%" y1="0%" x2="100%" y2="100%">
4.215 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.216 + <stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.217 + </linearGradient>
4.218 +
4.219 + <xsl:for-each select="*//*[generate-id() = generate-id(key('fills',@fill)[1])][substring(@fill,1,1)='#']">
4.220 + <linearGradient x1="0%" y1="0%" x2="100%" y2="100%">
4.221 + <xsl:attribute name="id">fill-<xsl:value-of select="substring(@fill,2,6)"/></xsl:attribute>
4.222 + <stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
4.223 + <stop offset="100%">
4.224 + <xsl:attribute name="style">stop-color:<xsl:value-of select="@fill" />;stop-opacity:1</xsl:attribute>
4.225 + </stop>
4.226 + </linearGradient>
4.227 + </xsl:for-each>
4.228 +
4.229 + </defs>
4.230 +
4.231 +
4.232 + <xsl:apply-templates />
4.233 + </svg>
4.234 +</xsl:template>
4.235 +
4.236 +<!-- Match the top most "g" -->
4.237 +<xsl:template match="/svg:svg/svg:g">
4.238 + <g>
4.239 + <xsl:apply-templates select="@*"/>
4.240 + <!-- Graphviz uses a polygon as the background. Don't want a gradient there -->
4.241 + <xsl:for-each select="svg:polygon">
4.242 + <xsl:copy><xsl:apply-templates select="@*" /></xsl:copy>
4.243 + </xsl:for-each>
4.244 + <xsl:apply-templates select="svg:title|svg:g" />
4.245 + </g>
4.246 +</xsl:template>
4.247 +
4.248 +
4.249 +<xsl:template match="svg:text">
4.250 + <text>
4.251 + <xsl:apply-templates select="@*" />
4.252 + <xsl:if test="not(@font-family) and not(@font-size)">
4.253 + <xsl:attribute name="style"><xsl:value-of select="$text-style" /></xsl:attribute>
4.254 + </xsl:if>
4.255 + <xsl:apply-templates select="text()"/>
4.256 + </text>
4.257 +</xsl:template>
4.258 +
4.259 +
4.260 +<xsl:template match="svg:g">
4.261 + <xsl:copy>
4.262 + <xsl:apply-templates select="@*" />
4.263 + <xsl:choose>
4.264 + <!-- Handle linked groups. -->
4.265 + <xsl:when test="svg:a">
4.266 + <xsl:for-each select="svg:a">
4.267 + <xsl:copy>
4.268 + <xsl:apply-templates select="@*" />
4.269 + <xsl:call-template name="group">
4.270 + <xsl:with-param name="class" select="../@class"/>
4.271 + </xsl:call-template>
4.272 + </xsl:copy>
4.273 + </xsl:for-each>
4.274 + </xsl:when>
4.275 + <!-- Handle bare groups. -->
4.276 + <xsl:otherwise>
4.277 + <xsl:call-template name="group"/>
4.278 + </xsl:otherwise>
4.279 + </xsl:choose>
4.280 + </xsl:copy>
4.281 +</xsl:template>
4.282 +
4.283 +
4.284 +<xsl:template name="group">
4.285 + <xsl:param name="class" select="@class"/>
4.286 +
4.287 + <xsl:for-each select="svg:polygon|svg:ellipse">
4.288 + <xsl:call-template name="poly-shadow" />
4.289 + </xsl:for-each>
4.290 +
4.291 + <xsl:choose>
4.292 + <!-- Rewrite node outlines. -->
4.293 + <xsl:when test="$class='node' and svg:path|svg:polyline">
4.294 + <xsl:call-template name="node-outline">
4.295 + <xsl:with-param name="current" select="*[1]"/>
4.296 + <xsl:with-param name="style">shadow</xsl:with-param>
4.297 + <xsl:with-param name="first" select="true()"/>
4.298 + </xsl:call-template>
4.299 + </xsl:when>
4.300 + <xsl:otherwise>
4.301 + <xsl:for-each select="svg:path">
4.302 + <xsl:call-template name="path-shadow-edge" />
4.303 + </xsl:for-each>
4.304 + </xsl:otherwise>
4.305 + </xsl:choose>
4.306 +
4.307 + <xsl:for-each select="svg:polygon|svg:ellipse">
4.308 + <xsl:sort select="@ry" order="descending" />
4.309 + <xsl:call-template name="poly-main" />
4.310 + </xsl:for-each>
4.311 +
4.312 + <xsl:choose>
4.313 + <!-- Rewrite node outlines. -->
4.314 + <xsl:when test="$class='node' and svg:path">
4.315 + <xsl:for-each select="svg:path">
4.316 + <xsl:call-template name="node-outline">
4.317 + <xsl:with-param name="current" select="."/>
4.318 + <xsl:with-param name="first" select="true()"/>
4.319 + </xsl:call-template>
4.320 + </xsl:for-each>
4.321 + </xsl:when>
4.322 + <xsl:when test="$class='node' and svg:polyline">
4.323 + <xsl:for-each select="svg:polyline">
4.324 + <xsl:call-template name="node-outline">
4.325 + <xsl:with-param name="current" select="."/>
4.326 + <xsl:with-param name="first" select="true()"/>
4.327 + </xsl:call-template>
4.328 + </xsl:for-each>
4.329 + </xsl:when>
4.330 + <xsl:otherwise>
4.331 + <xsl:for-each select="svg:path">
4.332 + <path><xsl:apply-templates select="@*" /></path>
4.333 + </xsl:for-each>
4.334 + </xsl:otherwise>
4.335 + </xsl:choose>
4.336 +
4.337 + <xsl:apply-templates select="svg:text" />
4.338 +</xsl:template>
4.339 +
4.340 +<xsl:template name="node-outline">
4.341 + <xsl:param name="path-so-far"/>
4.342 + <xsl:param name="current"/>
4.343 + <xsl:param name="style"/>
4.344 + <xsl:param name="first" select="false()"/>
4.345 +
4.346 + <xsl:choose>
4.347 + <!-- Visit each child element, collecting the path details. -->
4.348 + <xsl:when test="$current">
4.349 + <xsl:choose>
4.350 + <xsl:when test="local-name($current) = 'path'">
4.351 + <xsl:call-template name="filter-path">
4.352 + <xsl:with-param name="path-so-far" select="$path-so-far"/>
4.353 + <xsl:with-param name="point" select="substring-before($current/@d, 'C')"/>
4.354 + <xsl:with-param name="points" select="concat('C', substring-after($current/@d, 'C'))"/>
4.355 + <xsl:with-param name="current" select="$current"/>
4.356 + <xsl:with-param name="style" select="$style"/>
4.357 + <xsl:with-param name="include" select="$first"/>
4.358 + </xsl:call-template>
4.359 + </xsl:when>
4.360 + <xsl:when test="local-name($current) = 'polyline'">
4.361 + <xsl:call-template name="polyline-to-path">
4.362 + <xsl:with-param name="path-so-far" select="$path-so-far"/>
4.363 + <xsl:with-param name="point" select="concat('M', substring-before($current/@points, ' '))"/>
4.364 + <xsl:with-param name="points" select="substring-after($current/@points, ' ')"/>
4.365 + <xsl:with-param name="current" select="$current"/>
4.366 + <xsl:with-param name="style" select="$style"/>
4.367 + <xsl:with-param name="include" select="$first"/>
4.368 + </xsl:call-template>
4.369 + </xsl:when>
4.370 + <xsl:otherwise>
4.371 + <xsl:call-template name="node-outline">
4.372 + <xsl:with-param name="path-so-far" select="$path-so-far"/>
4.373 + <xsl:with-param name="current" select="$current/following-sibling::*[1]"/>
4.374 + <xsl:with-param name="style" select="$style"/>
4.375 + <xsl:with-param name="first" select="$first"/>
4.376 + </xsl:call-template>
4.377 + </xsl:otherwise>
4.378 + </xsl:choose>
4.379 + </xsl:when>
4.380 + <!-- With no more elements to visit, generate the path. -->
4.381 + <xsl:otherwise>
4.382 + <xsl:choose>
4.383 + <xsl:when test="$style = 'shadow'">
4.384 + <path style="fill: black; stroke: none; fill-opacity:0.15" transform="translate(3,3)"
4.385 + d="{$path-so-far}"/>
4.386 + </xsl:when>
4.387 + <xsl:otherwise>
4.388 + <!-- Provide the path attributes using dynamic colour discoveries. -->
4.389 + <xsl:element name="path">
4.390 + <xsl:attribute name="d"><xsl:value-of select="$path-so-far"/></xsl:attribute>
4.391 + <xsl:call-template name="make-style-attribute">
4.392 + <xsl:with-param name="fill"
4.393 + select="normalize-space(substring-after(substring-before(ancestor::*[svg:polygon]/svg:polygon[1]/@style,';'),'fill:'))"/>
4.394 + <xsl:with-param name="fill-explicit"
4.395 + select="@fill"/>
4.396 + <xsl:with-param name="stroke"
4.397 + select="normalize-space(substring-after(substring-before(ancestor::*[svg:polygon]/svg:polygon[1]/@style,';'),'stroke:'))"/>
4.398 + <xsl:with-param name="stroke-explicit">black</xsl:with-param>
4.399 + <xsl:with-param name="none-is-transparent" select="true()"/>
4.400 + </xsl:call-template>
4.401 + </xsl:element>
4.402 + </xsl:otherwise>
4.403 + </xsl:choose>
4.404 + </xsl:otherwise>
4.405 + </xsl:choose>
4.406 +</xsl:template>
4.407 +
4.408 +<xsl:template name="filter-path">
4.409 + <xsl:param name="path-so-far"/>
4.410 + <xsl:param name="point"/>
4.411 + <xsl:param name="points"/>
4.412 + <xsl:param name="current"/>
4.413 + <xsl:param name="style"/>
4.414 + <xsl:param name="include" select="true()"/>
4.415 +
4.416 + <xsl:variable name="next" select="substring-before($points, ' ')"/>
4.417 + <xsl:variable name="remaining" select="substring-after($points, ' ')"/>
4.418 +
4.419 + <xsl:choose>
4.420 + <!-- With path points remaining, include the current point if appropriate
4.421 + and visit those remaining. -->
4.422 + <xsl:when test="$remaining">
4.423 + <xsl:choose>
4.424 + <xsl:when test="$include">
4.425 + <xsl:call-template name="filter-path">
4.426 + <xsl:with-param name="path-so-far" select="concat($path-so-far, ' ', $point)"/>
4.427 + <xsl:with-param name="point" select="$next"/>
4.428 + <xsl:with-param name="points" select="$remaining"/>
4.429 + <xsl:with-param name="current" select="$current"/>
4.430 + <xsl:with-param name="style" select="$style"/>
4.431 + </xsl:call-template>
4.432 + </xsl:when>
4.433 + <xsl:otherwise>
4.434 + <xsl:call-template name="filter-path">
4.435 + <xsl:with-param name="path-so-far" select="$path-so-far"/>
4.436 + <xsl:with-param name="point" select="$next"/>
4.437 + <xsl:with-param name="points" select="$remaining"/>
4.438 + <xsl:with-param name="current" select="$current"/>
4.439 + <xsl:with-param name="style" select="$style"/>
4.440 + </xsl:call-template>
4.441 + </xsl:otherwise>
4.442 + </xsl:choose>
4.443 + </xsl:when>
4.444 + <!-- With up to one remaining after this point, include the current point,
4.445 + if appropriate, and the one remaining. -->
4.446 + <xsl:otherwise>
4.447 + <xsl:choose>
4.448 + <xsl:when test="$include">
4.449 + <xsl:call-template name="node-outline">
4.450 + <xsl:with-param name="path-so-far" select="concat($path-so-far, ' ', $point, ' ', $points)"/>
4.451 + <xsl:with-param name="current" select="$current/following-sibling::*[1]"/>
4.452 + <xsl:with-param name="style" select="$style"/>
4.453 + </xsl:call-template>
4.454 + </xsl:when>
4.455 + <xsl:otherwise>
4.456 + <xsl:call-template name="node-outline">
4.457 + <xsl:with-param name="path-so-far" select="concat($path-so-far, ' ', $points)"/>
4.458 + <xsl:with-param name="current" select="$current/following-sibling::*[1]"/>
4.459 + <xsl:with-param name="style" select="$style"/>
4.460 + </xsl:call-template>
4.461 + </xsl:otherwise>
4.462 + </xsl:choose>
4.463 + </xsl:otherwise>
4.464 + </xsl:choose>
4.465 +</xsl:template>
4.466 +
4.467 +<xsl:template name="polyline-to-path">
4.468 + <xsl:param name="path-so-far"/>
4.469 + <xsl:param name="point"/>
4.470 + <xsl:param name="points"/>
4.471 + <xsl:param name="current"/>
4.472 + <xsl:param name="style"/>
4.473 + <xsl:param name="include" select="true()"/>
4.474 +
4.475 + <xsl:variable name="next" select="substring-before($points, ' ')"/>
4.476 + <xsl:variable name="remaining" select="substring-after($points, ' ')"/>
4.477 +
4.478 + <xsl:choose>
4.479 + <!-- With path points remaining, include the current point if appropriate
4.480 + and visit those remaining. -->
4.481 + <xsl:when test="$remaining">
4.482 + <xsl:choose>
4.483 + <xsl:when test="$include">
4.484 + <xsl:call-template name="polyline-to-path">
4.485 + <xsl:with-param name="path-so-far" select="concat($path-so-far, ' ', $point)"/>
4.486 + <xsl:with-param name="point" select="concat('L', $next)"/>
4.487 + <xsl:with-param name="points" select="$remaining"/>
4.488 + <xsl:with-param name="current" select="$current"/>
4.489 + <xsl:with-param name="style" select="$style"/>
4.490 + </xsl:call-template>
4.491 + </xsl:when>
4.492 + <xsl:otherwise>
4.493 + <xsl:call-template name="polyline-to-path">
4.494 + <xsl:with-param name="path-so-far" select="$path-so-far"/>
4.495 + <xsl:with-param name="point" select="concat('L', $next)"/>
4.496 + <xsl:with-param name="points" select="$remaining"/>
4.497 + <xsl:with-param name="current" select="$current"/>
4.498 + <xsl:with-param name="style" select="$style"/>
4.499 + </xsl:call-template>
4.500 + </xsl:otherwise>
4.501 + </xsl:choose>
4.502 + </xsl:when>
4.503 + <!-- With up to one remaining after this point, include the current point,
4.504 + if appropriate, and the one remaining. -->
4.505 + <xsl:otherwise>
4.506 + <xsl:choose>
4.507 + <xsl:when test="$include">
4.508 + <xsl:call-template name="node-outline">
4.509 + <xsl:with-param name="path-so-far" select="concat($path-so-far, ' ', $point, ' L', $points)"/>
4.510 + <xsl:with-param name="current" select="$current/following-sibling::*[2]"/>
4.511 + <xsl:with-param name="style" select="$style"/>
4.512 + </xsl:call-template>
4.513 + </xsl:when>
4.514 + <xsl:otherwise>
4.515 + <xsl:call-template name="node-outline">
4.516 + <xsl:with-param name="path-so-far" select="concat($path-so-far, ' L', $points)"/>
4.517 + <xsl:with-param name="current" select="$current/following-sibling::*[1]"/>
4.518 + <xsl:with-param name="style" select="$style"/>
4.519 + </xsl:call-template>
4.520 + </xsl:otherwise>
4.521 + </xsl:choose>
4.522 + </xsl:otherwise>
4.523 + </xsl:choose>
4.524 +</xsl:template>
4.525 +
4.526 +<xsl:template name="poly-shadow">
4.527 + <xsl:element name="{name()}">
4.528 + <xsl:apply-templates select="@*"/>
4.529 + <xsl:attribute name="style">fill: black; stroke: none; fill-opacity:0.3</xsl:attribute>
4.530 + <xsl:attribute name="transform">translate(3,3)</xsl:attribute>
4.531 + </xsl:element>
4.532 +</xsl:template>
4.533 +
4.534 +<xsl:template name="path-shadow-edge">
4.535 + <xsl:element name="{name()}">
4.536 + <xsl:apply-templates select="@*"/>
4.537 + <xsl:attribute name="style">fill: none; stroke: black; stroke-opacity:0.3</xsl:attribute>
4.538 + <xsl:attribute name="transform">translate(3,3)</xsl:attribute>
4.539 + </xsl:element>
4.540 +</xsl:template>
4.541 +
4.542 +<xsl:template name="poly-main">
4.543 + <xsl:element name="{name()}">
4.544 + <xsl:apply-templates select="@*" />
4.545 + <xsl:call-template name="make-style-attribute">
4.546 + <xsl:with-param name="fill"
4.547 + select="normalize-space(substring-after(substring-before(@style,';'),'fill:'))"/>
4.548 + <xsl:with-param name="fill-explicit"
4.549 + select="@fill"/>
4.550 + <xsl:with-param name="stroke"
4.551 + select="normalize-space(substring-after(substring-after(@style,';'),'stroke:'))"/>
4.552 + <xsl:with-param name="stroke-explicit"
4.553 + select="@stroke"/>
4.554 + </xsl:call-template>
4.555 + </xsl:element>
4.556 +</xsl:template>
4.557 +
4.558 +<xsl:template name="path-main">
4.559 + <path>
4.560 + <xsl:apply-templates select="@*" />
4.561 + <!-- This is somewhat broken - the gradient is set based on the position/size of the element it is used with; as a result it doesn't line up properly with the main polygon -->
4.562 + <xsl:call-template name="make-style-attribute">
4.563 + <xsl:with-param name="fill"
4.564 + select="normalize-space(substring-after(substring-before(ancestor::*[svg:polygon]/svg:polygon[1]/@style,';'),'fill:'))"/>
4.565 + <xsl:with-param name="fill-explicit"
4.566 + select="ancestor::*[svg:polygon]/svg:polygon[1]/@fill"/>
4.567 + <xsl:with-param name="stroke"
4.568 + select="normalize-space(substring-after(substring-before(ancestor::*[svg:polygon]/svg:polygon[1]/@style,';'),'stroke:'))"/>
4.569 + <xsl:with-param name="stroke-explicit">black</xsl:with-param>
4.570 + </xsl:call-template>
4.571 + </path>
4.572 +</xsl:template>
4.573 +
4.574 +<xsl:template name="make-style-attribute">
4.575 + <xsl:param name="fill"/>
4.576 + <xsl:param name="fill-explicit"/>
4.577 + <xsl:param name="stroke"/>
4.578 + <xsl:param name="stroke-explicit"/>
4.579 + <xsl:param name="none-is-transparent" select="false()"/>
4.580 +
4.581 + <xsl:attribute name="style">
4.582 + <xsl:choose>
4.583 + <xsl:when test="$fill and (not($none-is-transparent) or $fill != 'none')">
4.584 + <xsl:call-template name="make-style-fill">
4.585 + <xsl:with-param name="fill" select="$fill"/>
4.586 + </xsl:call-template>
4.587 + </xsl:when>
4.588 + <xsl:when test="$fill-explicit and (not($none-is-transparent) or $fill-explicit != 'none')">
4.589 + <xsl:choose>
4.590 + <xsl:when test="starts-with($fill-explicit, '#')">
4.591 + <xsl:call-template name="make-style-fill">
4.592 + <xsl:with-param name="fill" select="$fill-explicit"/>
4.593 + </xsl:call-template>
4.594 + </xsl:when>
4.595 + <xsl:otherwise>fill: url(#<xsl:value-of select="$fill-explicit"/>);</xsl:otherwise>
4.596 + </xsl:choose>
4.597 + </xsl:when>
4.598 + <xsl:otherwise>fill: none;</xsl:otherwise>
4.599 + </xsl:choose>
4.600 + <xsl:choose>
4.601 + <xsl:when test="$stroke">stroke: <xsl:value-of select="$stroke"/>;</xsl:when>
4.602 + <xsl:when test="$stroke-explicit">stroke: <xsl:value-of select="$stroke-explicit"/>;</xsl:when>
4.603 + <xsl:otherwise>stroke: black;</xsl:otherwise>
4.604 + </xsl:choose>
4.605 + </xsl:attribute>
4.606 +</xsl:template>
4.607 +
4.608 +<xsl:template name="make-style-fill">
4.609 + <xsl:param name="fill"/>
4.610 + <xsl:choose>
4.611 + <xsl:when test="substring($fill,1,1) = '#'">fill: url(#fill-<xsl:value-of select="substring($fill,2,6)"/>);</xsl:when>
4.612 + <xsl:otherwise>fill: url(#<xsl:value-of select="$fill"/>);</xsl:otherwise>
4.613 + </xsl:choose>
4.614 +</xsl:template>
4.615 +
4.616 +</xsl:stylesheet>