summaryrefslogtreecommitdiff
path: root/navit/xslt/sailfish_svg.xslt
blob: 63d384a5a5c1dc725e94d74aecfb5bdf8c57e603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xi="http://www.w3.org/2001/XInclude">

	<xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/>

   <!-- Default rule: copy all -->
   <xsl:template match="node()|@*">
      <xsl:copy>
         <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
   </xsl:template>

   <!-- Force default cursor size of all layouts, force tunnel transparency -->
   <xsl:template match="/layout">
      <xsl:copy>
         <xsl:apply-templates select="@*"/>
         <xsl:attribute name="icon_w">16</xsl:attribute>
         <xsl:attribute name="icon_h">16</xsl:attribute>
         <xsl:attribute name="underground_alpha">0x33</xsl:attribute>
         <xsl:apply-templates select="node()"/>
      </xsl:copy>
   </xsl:template>

   <!-- Force all png icons to svg and add w and h if not exist -->
   <xsl:template match="icon">
      <xsl:copy>
         <xsl:apply-templates select="@*"/>
         <xsl:if test="@src[substring(., string-length()-3)='.png']|@src[substring(., string-length()-3)='.xpm']">
         <xsl:attribute name="src">
            <xsl:value-of select="concat(substring(@src,1, string-length(@src)-3),'svg')"/>
         </xsl:attribute>
         </xsl:if>
         <xsl:apply-templates select="node()"/>
      </xsl:copy>
   </xsl:template>

</xsl:stylesheet>