Debian Codegraph @

samples/extensions/xsl/data.xsl

raw
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!-- ======================================================================
4 Licensed to the Apache Software Foundation (ASF) under one or more
5 contributor license agreements. See the NOTICE file distributed with
6 this work for additional information regarding copyright ownership.
7 The ASF licenses this file to You under the Apache License, Version 2.0
8 (the "License"); you may not use this file except in compliance with
9 the License. You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ====================================================================== -->
19
20 <!-- ========================================================================= -->
21 <!-- Courtesy of Max Froumentin. This document is referenced by data.xml -->
22 <!-- -->
23 <!-- @author [email protected] -->
24 <!-- @version $Id$ -->
25 <!-- ========================================================================= -->
26 <?xml-stylesheet href="" type="text/xsl"?>
27 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 xmlns="http://www.w3.org/2000/svg"
29 xmlns:xlink="http://www.w3.org/1999/xlink"
30 version="1.0">
31
32 <xsl:template match="/">
33 <svg viewBox="-40 -40 80 80" width="1024" height="768" preserveAspectRatio="xMidYMid slice">
34 <defs>
35 <linearGradient id="gradient" gradientUnits="userSpaceOnUse"
36 x1="-100" y1="-100" x2="100" y2="100">
37 <stop offset="0" stop-color="crimson"/>
38 <stop offset="0.8" stop-color="gold"/>
39 <stop offset="1" stop-color="yellow" />
40 </linearGradient>
41
42 <linearGradient id="strokeGradient" gradientUnits="userSpaceOnUse"
43 x1="100" y1="100" x2="-100" y2="-100">
44 <stop offset=".2" stop-color="gold"/>
45 <stop offset="1" stop-color="rgb(128,0,0)" />
46 </linearGradient>
47 </defs>
48
49 <g id="spiral">
50 <xsl:call-template name="draw-primitive">
51 <xsl:with-param name="depth" select="data[position()=1]/@depth"/>
52 </xsl:call-template>
53 </g>
54 </svg>
55 </xsl:template>
56
57 <xsl:template name="draw-primitive">
58 <xsl:param name="depth" select="0"/>
59 <xsl:if test="$depth > 0">
60 <g transform="scale(.8, .8) rotate(10)">
61 <rect x="-100" y="-100" width="200" height="200" fill="url(#gradient)" stroke="none" stroke-width="5"/>
62 <xsl:call-template name="draw-primitive">
63 <xsl:with-param name="depth" select="$depth - 1"/>
64 </xsl:call-template>
65 </g>
66 </xsl:if>
67 </xsl:template>
68 </xsl:stylesheet>