1 <?xml version=
"1.0" standalone=
"no"?>
2 <xsl:stylesheet version=
"1.0"
3 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
4 xmlns:
svg=
"http://www.w3.org/2000/svg"
5 xmlns:
inkscape=
"http://www.inkscape.org/namespaces/inkscape">
7 <!-- write header to output -->
11 doctype-public=
"-//W3C//DTD SVG 1.1//EN"
12 doctype-system=
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"/>
15 <!-- default template: matches all elements e.g. <xsl:example>
16 and all attributes within elements e.g. x="foo" -->
18 <xsl:template match=
"@*|node()">
20 <xsl:apply-templates select=
"@*|node()"/>
24 <!-- svg preprocessing: match all svg elements (listed) and all
25 their attributes (matched by wildcard /@* ).
26 This template is called repeatedly - once for each attribute
27 matched by this search. -->
29 <xsl:template match=
"svg:g/@*|svg:rect/@*|svg:path/@*|svg:circle/@*|
30 svg:ellipse/@*|svg:line/@*|svg:polyline/@*|svg:polygon/@*|svg:text/@*">
31 <!-- copy current attribute's existing value -->
32 <xsl:copy-of select=
"."/>
33 <!-- select first 5 characters of the id= and inkscape:label fields
34 of current element -->
35 <xsl:variable name=
"IDPrefix" select=
"substring(../@id,1,5)"/>
36 <xsl:variable name=
"LabelPrefix" select=
"substring(../@inkscape:label,1,5)"/>
37 <!-- disable anti-aliasing for this element (group, path, circle etc)
38 if prefix matches list in command-line argument DisableAA_Select
39 eg. DisableAA_Select='NOAA_MASK_' - anti-aliasing will be disabled
40 for elements with ids/labels prefixed with NOAA_ or MASK_ -->
41 <xsl:if test=
"(contains($DisableAA_Select,$IDPrefix) and
42 string-length($IDPrefix)=5)
43 or (contains($DisableAA_Select,$LabelPrefix) and
44 string-length($LabelPrefix)=5)">
45 <xsl:attribute name=
"style">
46 <!-- this style attribute disables anti-aliasing in rsvg; behaviour may
47 vary according to svg renderer -->
48 <xsl:text>shape-rendering:optimizeSpeed;
</xsl:text>
49 <xsl:value-of select=
"../@style"/>