1
|
<?xml version="1.0"?>
|
2
|
<xsl:stylesheet xmlns:wmc="http://www.opengis.net/context" xmlns:mb="http://mapbuilder.sourceforge.net/mapbuilder" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0"><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:strip-space elements="*"/><xsl:param name="bbox"/><xsl:param name="width"/><xsl:param name="height"/><xsl:param name="srs"/><xsl:param name="version"/><xsl:param name="timeList"/><xsl:param name="timeListName"/><xsl:template match="Layer | wmc:Layer"><xsl:choose><xsl:when test="$timeList and wmc:DimensionList/wmc:Dimension[@name='time']"><xsl:call-template name="tokenize"><xsl:with-param name="str" select="$timeList"/><xsl:with-param name="sep" select="','"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:call-template name="layerOutput"/></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="layerOutput"><xsl:variable name="format">image/png</xsl:variable><xsl:variable name="styleParam"/><xsl:variable name="visibility"/><xsl:variable name="mapRequest"><xsl:choose><xsl:when test="starts-with($version, '1.0')">
|
3
|
|
4
|
WMTVER=<xsl:value-of select="$version"/>&REQUEST=map
|
5
|
|
6
|
</xsl:when><xsl:otherwise>
|
7
|
|
8
|
VERSION=<xsl:value-of select="$version"/>&REQUEST=GetMap
|
9
|
|
10
|
</xsl:otherwise></xsl:choose></xsl:variable><GetMap><mb:QueryString><xsl:variable name="src"><xsl:value-of select="$mapRequest"/>
|
11
|
|
12
|
&SRS=<xsl:value-of select="$srs"/>
|
13
|
|
14
|
&BBOX=<xsl:value-of select="$bbox"/>
|
15
|
|
16
|
&WIDTH=<xsl:value-of select="$width"/>
|
17
|
|
18
|
&HEIGHT=<xsl:value-of select="$height"/>
|
19
|
|
20
|
&LAYERS=<xsl:value-of select="Name"/>
|
21
|
|
22
|
&FORMAT=<xsl:value-of select="$format"/>
|
23
|
|
24
|
&<xsl:value-of select="$styleParam"/>
|
25
|
|
26
|
&TRANSPARENT=true
|
27
|
|
28
|
<xsl:if test="$timestamp">
|
29
|
|
30
|
&TIME=<xsl:value-of select="$timestamp"/></xsl:if></xsl:variable><xsl:value-of select="translate(normalize-space($src),' ', '' )" disable-output-escaping="no"/></mb:QueryString></GetMap></xsl:template><xsl:template name="tokenize"><xsl:param name="str"/><xsl:param name="sep"/><xsl:choose><xsl:when test="contains($str,$sep)"><xsl:call-template name="process-token"><xsl:with-param name="token" select="substring-before($str,$sep)"/></xsl:call-template><xsl:call-template name="tokenize"><xsl:with-param name="str" select="substring-after($str,$sep)"/><xsl:with-param name="sep" select="$sep"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:call-template name="process-token"><xsl:with-param name="token" select="$str"/></xsl:call-template></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="process-token"><xsl:param name="token"/><xsl:call-template name="layerOutput"><xsl:with-param name="timestamp" select="$token"/><xsl:with-param name="visibility">hidden</xsl:with-param></xsl:call-template></xsl:template><xsl:template match="wmc:Layer"><xsl:param name="version"><xsl:value-of select="wmc:Server/@version"/></xsl:param><xsl:variable name="format"><xsl:choose><xsl:when test="wmc:FormatList"><xsl:value-of select="wmc:FormatList/wmc:Format[@current='1']"/></xsl:when><xsl:otherwise>image/gif</xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="styleParam"><xsl:choose><xsl:when test="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD">
|
31
|
|
32
|
SLD=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:OnlineResource/@xlink:href"/></xsl:when><xsl:when test="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:StyledLayerDescriptor">
|
33
|
|
34
|
SLD=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:StyledLayerDescriptor"/></xsl:when><xsl:when test="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:FeatureTypeStyle">
|
35
|
|
36
|
SLD=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:SLD/wmc:FeatureTypeStyle"/></xsl:when><xsl:otherwise>
|
37
|
|
38
|
STYLES=<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:Name"/></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="visibility"><xsl:choose><xsl:when test="@hidden='1'">hidden</xsl:when><xsl:otherwise>visible</xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="mapRequest"><xsl:choose><xsl:when test="starts-with($version, '1.0')">
|
39
|
|
40
|
WMTVER=<xsl:value-of select="$version"/>&REQUEST=map
|
41
|
|
42
|
</xsl:when><xsl:otherwise>
|
43
|
|
44
|
VERSION=<xsl:value-of select="$version"/>&REQUEST=GetMap
|
45
|
|
46
|
</xsl:otherwise></xsl:choose></xsl:variable><GetMap><mb:QueryString><xsl:variable name="src"><xsl:value-of select="$mapRequest"/>
|
47
|
|
48
|
&SRS=<xsl:value-of select="$srs"/>
|
49
|
|
50
|
&BBOX=<xsl:value-of select="$bbox"/>
|
51
|
|
52
|
&WIDTH=<xsl:value-of select="$width"/>
|
53
|
|
54
|
&HEIGHT=<xsl:value-of select="$height"/>
|
55
|
|
56
|
&LAYERS=<xsl:value-of select="wmc:Name"/>
|
57
|
|
58
|
&FORMAT=<xsl:value-of select="$format"/>
|
59
|
|
60
|
&<xsl:value-of select="$styleParam"/>
|
61
|
|
62
|
&TRANSPARENT=true
|
63
|
|
64
|
<xsl:if test="$timestamp">
|
65
|
|
66
|
&TIME=<xsl:value-of select="$timestamp"/></xsl:if></xsl:variable><xsl:value-of select="translate(normalize-space($src),' ', '' )" disable-output-escaping="no"/></mb:QueryString></GetMap></xsl:template></xsl:stylesheet>
|