1
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
<!--
|
3
|
Description: parses a WMS capabilities Layer element and transforms it to a
|
4
|
Web Map Context document Layer element.
|
5
|
Author: adair
|
6
|
Licence: LGPL as specified in http://www.gnu.org/copyleft/lesser.html .
|
7
|
|
8
|
$Id$
|
9
|
$Name$
|
10
|
-->
|
11
|
|
12
|
<xsl:stylesheet version="1.0"
|
13
|
xmlns:wmc="http://www.opengis.net/context"
|
14
|
xmlns:wms="http://www.opengis.net/wms"
|
15
|
xmlns:wfs="http://www.opengis.net/wfs"
|
16
|
xmlns:sld="http://www.opengis.net/sld"
|
17
|
xmlns:owscat="http://www.ec.gc.ca/owscat"
|
18
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
19
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
20
|
|
21
|
<xsl:output method="xml"/>
|
22
|
<xsl:strip-space elements="*"/>
|
23
|
|
24
|
<!-- The coordinates of the DHTML Layer on the HTML page -->
|
25
|
<xsl:param name="modelId"/>
|
26
|
<xsl:param name="widgetId"/>
|
27
|
|
28
|
<xsl:param name="version"/>
|
29
|
<xsl:param name="serverUrl"/>
|
30
|
<xsl:param name="serviceName"/>
|
31
|
<xsl:param name="serverTitle"/>
|
32
|
<xsl:param name="format"/>
|
33
|
|
34
|
<!-- for selecting nodes from an WMS Capabilities document -->
|
35
|
<xsl:template match="Layer">
|
36
|
<wmc:Layer>
|
37
|
<xsl:attribute name="queryable">0</xsl:attribute>
|
38
|
<xsl:attribute name="hidden">0</xsl:attribute>
|
39
|
<wmc:Server>
|
40
|
<xsl:attribute name="service"><xsl:value-of select="$serviceName"/></xsl:attribute>
|
41
|
<xsl:attribute name="version"><xsl:value-of select="$version"/></xsl:attribute>
|
42
|
<xsl:attribute name="title"><xsl:value-of select="$serverTitle"/></xsl:attribute>
|
43
|
<wmc:OnlineResource xlink:type="simple" xlink:href="{$serverUrl}"/>
|
44
|
</wmc:Server>
|
45
|
<xsl:apply-templates select="child::node()"/>
|
46
|
<wmc:FormatList>
|
47
|
<wmc:Format current="1"><xsl:value-of select="$format"/></wmc:Format>
|
48
|
</wmc:FormatList>
|
49
|
</wmc:Layer>
|
50
|
</xsl:template>
|
51
|
|
52
|
<xsl:template match="Layer/Title">
|
53
|
<wmc:Title><xsl:value-of select="."/></wmc:Title>
|
54
|
</xsl:template>
|
55
|
|
56
|
<xsl:template match="Layer/Name">
|
57
|
<wmc:Name><xsl:value-of select="."/></wmc:Name>
|
58
|
</xsl:template>
|
59
|
|
60
|
<xsl:template match="Layer/Abstract">
|
61
|
<wmc:Abstract><xsl:value-of select="."/></wmc:Abstract>
|
62
|
</xsl:template>
|
63
|
|
64
|
<xsl:template match="DataURL">
|
65
|
<wmc:DataURL><xsl:value-of select="."/></wmc:DataURL>
|
66
|
</xsl:template>
|
67
|
|
68
|
<xsl:template match="MetadataURL">
|
69
|
<wmc:MetadataURL><xsl:value-of select="."/></wmc:MetadataURL>
|
70
|
</xsl:template>
|
71
|
|
72
|
<xsl:template match="SRS">
|
73
|
<wmc:SRS><xsl:value-of select="."/></wmc:SRS>
|
74
|
</xsl:template>
|
75
|
|
76
|
<!-- for selecting nodes from an OWSCat result set -->
|
77
|
<xsl:template match="owscat:service_resources">
|
78
|
<xsl:variable name="serverUrl"><xsl:value-of select="owscat:endpoint_getresource"/></xsl:variable>
|
79
|
<wmc:Layer>
|
80
|
<xsl:attribute name="queryable">0</xsl:attribute>
|
81
|
<xsl:attribute name="hidden">0</xsl:attribute>
|
82
|
<wmc:Server>
|
83
|
<xsl:attribute name="service"><xsl:value-of select="owscat:service_type"/></xsl:attribute>
|
84
|
<xsl:attribute name="version"><xsl:value-of select="owscat:service_version"/></xsl:attribute>
|
85
|
<xsl:attribute name="title"><xsl:value-of select="owscat:organization"/></xsl:attribute>
|
86
|
<wmc:OnlineResource xlink:type="simple" xlink:href="{$serverUrl}"/>
|
87
|
</wmc:Server>
|
88
|
<xsl:apply-templates/>
|
89
|
</wmc:Layer>
|
90
|
</xsl:template>
|
91
|
|
92
|
<xsl:template match="owscat:title">
|
93
|
<wmc:Title><xsl:value-of select="."/></wmc:Title>
|
94
|
</xsl:template>
|
95
|
|
96
|
<xsl:template match="owscat:name">
|
97
|
<wmc:Name><xsl:value-of select="."/></wmc:Name>
|
98
|
</xsl:template>
|
99
|
|
100
|
<xsl:template match="owscat:abstract">
|
101
|
<wmc:Abstract><xsl:value-of select="."/></wmc:Abstract>
|
102
|
</xsl:template>
|
103
|
|
104
|
<xsl:template match="owscat:dataurl">
|
105
|
<wmc:DataURL><xsl:value-of select="."/></wmc:DataURL>
|
106
|
</xsl:template>
|
107
|
|
108
|
<xsl:template match="owscat:metadataurl">
|
109
|
<wmc:MetadataURL><xsl:value-of select="."/></wmc:MetadataURL>
|
110
|
</xsl:template>
|
111
|
|
112
|
<xsl:template match="owscat:srs">
|
113
|
<wmc:SRS><xsl:value-of select="."/></wmc:SRS>
|
114
|
</xsl:template>
|
115
|
|
116
|
<xsl:template match="text()|@*"/>
|
117
|
|
118
|
</xsl:stylesheet>
|