summaryrefslogtreecommitdiff
path: root/xsl/googlemaps.xsl
blob: 3c84f117c6c37d69efd2500f827f400870dfa5f5 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0" 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:s="https://beratung-franzke.de/web-tpl"
  xmlns:str="http://exslt.org/strings"
  extension-element-prefixes="str">

  <xsl:template match="s:googlemap" mode="html">
    <xsl:call-template name="googlemap">
      <xsl:with-param name="location" select="@location" />
      <xsl:with-param name="width">
        <xsl:choose>
          <xsl:when test="@width">
            <xsl:value-of select="@width" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="'640'" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="height">
        <xsl:choose>
          <xsl:when test="@height">
            <xsl:value-of select="@height" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="'480'" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
      <xsl:with-param name="lang">
        <xsl:choose>
          <xsl:when test="@lang">
            <xsl:value-of select="@lang" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="'de'" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="googlemap">
    <xsl:param name="location" />
    <xsl:param name="width" select="'640'" />
    <xsl:param name="height" select="'480'" />
    <xsl:param name="lang" select="'de'" />
    
    <xsl:variable name="base_uri" select="concat('http://maps.google.de/maps?f=q&amp;hl=', $lang)" />
    <xsl:variable name="map_base_uri"  select="concat($base_uri, '&amp;source=s_q&amp;output=embed&amp;q=')" />
    <xsl:variable name="link_base_uri" select="concat($base_uri, '&amp;source=embed&amp;output=embed&amp;q=')" />

    <xsl:variable name="map_uri">
	    <xsl:choose>
		    <xsl:when test="function-available('str:encode-uri')">
			    <xsl:value-of select="str:encode-uri(concat($map_base_uri, $location), false())" />-->
		    </xsl:when>
		    <xsl:otherwise>
			    <xsl:value-of select="concat($map_base_uri, $location)" />
		    </xsl:otherwise>
	    </xsl:choose>
    </xsl:variable>

    <xsl:element name="iframe">
      <xsl:attribute name="src">
        <xsl:value-of select="$map_uri" />
      </xsl:attribute>
      <xsl:attribute name="width"><xsl:value-of select="$width" /></xsl:attribute>
      <xsl:attribute name="height"><xsl:value-of select="$height" /></xsl:attribute>
      <xsl:attribute name="frameborder">0</xsl:attribute>
      <xsl:attribute name="marginheight">0</xsl:attribute>
      <xsl:attribute name="marginwidth">0</xsl:attribute>
      <xsl:attribute name="scrolling">no</xsl:attribute>
    </xsl:element>

    <!--
    <br />
    <small>
      <a href="{concat($link_base_uri, $location)}" style="color:#0000FF; text-align:left">
        Größere Kartenansicht
      </a>
    </small>
    -->
  </xsl:template>
</xsl:stylesheet>