source: subversion/applications/rendering/osmarender4/symbol-catalogue.xsl @ 2731

Last change on this file since 2731 was 2126, checked in by jochen, 14 years ago

Removed @dy attribute from text element in src/draw.xsl and added it to all <text> elements in the rules file.
More symbols from http://wiki.openstreetmap.org/index.php/SVG_Symbols added. (Not yet added to rules file.)
Symbols in catalogue now sorted alphabetically.

File size: 2.7 KB
Line 
1<?xml version="1.0" encoding="iso8859-1"?>
2<!-- This stylesheet creates a catalogue of all symbols known to Osmarender -->
3<xsl:stylesheet
4    version="1.0"
5    xmlns="http://www.w3.org/2000/svg"
6    xmlns:svg="http://www.w3.org/2000/svg"
7    xmlns:xlink="http://www.w3.org/1999/xlink"
8    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9    exclude-result-prefixes="svg">
10
11    <xsl:output method="xml" omit-xml-declaration="no" indent="yes" encoding="UTF-8"/>
12
13    <xsl:variable name="columns" select="2"/>
14    <xsl:variable name="scale" select="18"/>
15
16    <xsl:template match="/">
17        <svg version="1.1" baseProfile="full" width="210mm" height="297mm">
18            <xsl:comment> This file is created automatically from symbols.svg. DO NOT CHANGE! </xsl:comment>
19            <title>Catalogue of symbols known to Osmarender</title>
20
21            <defs id="def-styles">
22                <style id="styles" type="text/css">
23<xsl:text>
24    .crosshair {
25        stroke-width: 0.05;
26        stroke: #a0a0a0;
27        fill: none;
28    }
29
30    .crosshair-fine {
31        stroke-width: 0.005;
32        stroke: #404040;
33        fill: none;
34    }
35
36    text.desc {
37        font-size: 1;
38    }
39</xsl:text>
40                </style>
41
42            <xsl:apply-templates select="/dir/f[substring-after(@n, '.') = 'svg']" mode="defs">
43                <xsl:sort select="@n"/>
44            </xsl:apply-templates>
45            </defs>
46
47            <g id="catalogue" transform="scale({$scale})">
48                <xsl:apply-templates select="/dir/f[substring-after(@n, '.') = 'svg']" mode="draw">
49                    <xsl:sort select="@n"/>
50                </xsl:apply-templates>
51            </g>
52        </svg>
53    </xsl:template>
54
55    <xsl:template match="f" mode="defs">
56        <xsl:copy-of select="document(concat('symbols/', @n))/svg:svg/svg:defs/svg:symbol"/>
57    </xsl:template>
58
59    <xsl:template match="f" mode="draw">
60        <g id="demo-{substring-before(@n, '.')}" transform="translate({2 + (position()-1) mod $columns * 20}, {2 + floor((position()-1) div $columns) * 3})">
61            <line class="crosshair" x1="-1" y1="0" x2="1" y2="0"/>
62            <line class="crosshair" x1="0" y1="-1" x2="0" y2="1"/>
63            <rect class="crosshair" x="-0.5" y="-0.5" width="1" height="1"/>
64            <line class="crosshair-fine" x1="-1" y1="0" x2="1" y2="0"/>
65            <line class="crosshair-fine" x1="0" y1="-1" x2="0" y2="1"/>
66            <rect class="crosshair-fine" x="-0.5" y="-0.5" width="1" height="1"/>
67            <use xlink:href="#symbol-{substring-before(@n, '.')}" width="1" height="1"/>
68            <text class="desc" x="3" y="0.4"><xsl:value-of select="substring-before(@n, '.')"/></text>
69        </g>
70    </xsl:template>
71
72</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.