Revision 4307
Added by ben leinfelder over 15 years ago
wmc_AddResource.xsl | ||
---|---|---|
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> |
|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet xmlns:wmc="http://www.opengis.net/context" xmlns:wms="http://www.opengis.net/wms" xmlns:wfs="http://www.opengis.net/wfs" xmlns:sld="http://www.opengis.net/sld" xmlns:owscat="http://www.ec.gc.ca/owscat" 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="modelId"/><xsl:param name="widgetId"/><xsl:param name="version"/><xsl:param name="serverUrl"/><xsl:param name="serviceName"/><xsl:param name="serverTitle"/><xsl:param name="format"/><xsl:template match="Layer"><wmc:Layer><xsl:attribute name="queryable"><xsl:value-of select="./@queryable"/></xsl:attribute><xsl:attribute name="hidden">0</xsl:attribute><wmc:Server><xsl:attribute name="service"><xsl:value-of select="$serviceName"/></xsl:attribute><xsl:attribute name="version"><xsl:value-of select="$version"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="$serverTitle"/></xsl:attribute><wmc:OnlineResource xlink:type="simple" xlink:href="{$serverUrl}"/></wmc:Server><xsl:apply-templates select="child::node()"/><wmc:FormatList><wmc:Format current="1"><xsl:value-of select="$format"/></wmc:Format></wmc:FormatList></wmc:Layer></xsl:template><xsl:template match="Style"><wmc:StyleList><wmc:Style current="1"><xsl:apply-templates select="child::node()"/></wmc:Style></wmc:StyleList></xsl:template><xsl:template match="LegendURL"><wmc:LegendURL><xsl:apply-templates select="child::node()"/></wmc:LegendURL></xsl:template><xsl:template match="OnlineResource"><xsl:variable name="legendUrl"><xsl:value-of select="concat(./@href,./@xlink:href)"/></xsl:variable><wmc:OnlineResource xlink:type="simple" xlink:href="{$legendUrl}"/></xsl:template><xsl:template match="Layer/Title"><wmc:Title><xsl:value-of select="."/></wmc:Title></xsl:template><xsl:template match="Layer/Name"><wmc:Name><xsl:value-of select="."/></wmc:Name></xsl:template><xsl:template match="Layer/Abstract"><wmc:Abstract><xsl:value-of select="."/></wmc:Abstract></xsl:template><xsl:template match="DataURL"><wmc:DataURL><xsl:value-of select="."/></wmc:DataURL></xsl:template><xsl:template match="MetadataURL"><wmc:MetadataURL><xsl:value-of select="."/></wmc:MetadataURL></xsl:template><xsl:template match="SRS"><wmc:SRS><xsl:value-of select="."/></wmc:SRS></xsl:template><xsl:template match="owscat:service_resources"><xsl:variable name="serverUrl"><xsl:value-of select="owscat:endpoint_getresource"/></xsl:variable><wmc:Layer><xsl:attribute name="queryable"><xsl:value-of select="./@queryable"/></xsl:attribute><xsl:attribute name="hidden">0</xsl:attribute><wmc:Server><xsl:attribute name="service"><xsl:value-of select="owscat:service_type"/></xsl:attribute><xsl:attribute name="version"><xsl:value-of select="owscat:service_version"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="owscat:organization"/></xsl:attribute><wmc:OnlineResource xlink:type="simple" xlink:href="{$serverUrl}"/></wmc:Server><xsl:apply-templates/></wmc:Layer></xsl:template><xsl:template match="owscat:title"><wmc:Title><xsl:value-of select="."/></wmc:Title></xsl:template><xsl:template match="owscat:name"><wmc:Name><xsl:value-of select="."/></wmc:Name></xsl:template><xsl:template match="owscat:abstract"><wmc:Abstract><xsl:value-of select="."/></wmc:Abstract></xsl:template><xsl:template match="owscat:dataurl"><wmc:DataURL><xsl:value-of select="."/></wmc:DataURL></xsl:template><xsl:template match="owscat:metadataurl"><wmc:MetadataURL><xsl:value-of select="."/></wmc:MetadataURL></xsl:template><xsl:template match="owscat:srs"><wmc:SRS><xsl:value-of select="."/></wmc:SRS></xsl:template><xsl:template match="text()|@*"/></xsl:stylesheet> |
Also available in: Unified diff
upgrade to MapBuilder 1.5rc2 - includes support for Firefox 3 compatibility (yes, it is also EOLed)