1 |
4307
|
leinfelder
|
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
|
|
<xsl:stylesheet
|
3 |
|
|
xmlns:wmc="http://www.opengis.net/context"
|
4 |
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
5 |
|
|
xmlns:gml='http://www.opengis.net/gml'
|
6 |
|
|
xmlns:wfs='http://www.opengis.net/wfs'
|
7 |
|
|
xmlns:xlink='http://www.w3.org/1999/xlink'
|
8 |
|
|
version="1.0">
|
9 |
|
|
<!--
|
10 |
|
|
Description: Convert a Web Map Context into a HTML Legend
|
11 |
|
|
Author: Cameron Shorter cameron ATshorter.net
|
12 |
|
|
Licence: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
13 |
|
|
|
14 |
|
|
$Id: LegendOpaque.xsl 3907 2008-03-06 10:27:06Z steven $
|
15 |
|
|
$Name$
|
16 |
|
|
-->
|
17 |
|
|
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
|
18 |
|
|
|
19 |
|
|
<!-- The common params set for all widgets -->
|
20 |
|
|
<xsl:param name="lang">en</xsl:param>
|
21 |
|
|
<xsl:param name="modelId"/>
|
22 |
|
|
<xsl:param name="widgetId"/>
|
23 |
|
|
|
24 |
|
|
<xsl:param name="skinDir"/>
|
25 |
|
|
<xsl:param name="selectIcon">/images/id.gif</xsl:param>
|
26 |
|
|
|
27 |
|
|
<!-- Text params for this widget -->
|
28 |
|
|
<xsl:param name="title"/>
|
29 |
|
|
|
30 |
|
|
<!-- The name of the javascript context object to call -->
|
31 |
|
|
<xsl:param name="featureName"/>
|
32 |
|
|
<xsl:param name="hidden"/>
|
33 |
|
|
<xsl:param name="context">config.objects.<xsl:value-of select="$modelId"/></xsl:param>
|
34 |
|
|
|
35 |
|
|
<!-- Main html -->
|
36 |
|
|
<xsl:template match="/wmc:ViewContext">
|
37 |
|
|
<table>
|
38 |
|
|
<tr>
|
39 |
|
|
<th align="left" ><xsl:value-of select="$title"/></th>
|
40 |
|
|
</tr>
|
41 |
|
|
<xsl:choose>
|
42 |
|
|
<xsl:when test="$featureName">
|
43 |
|
|
<xsl:apply-templates select="wmc:ResourceList[wmc:Name='$featureName'] | wmc:LayerList[wmc:Name='$featureName']"/>
|
44 |
|
|
</xsl:when>
|
45 |
|
|
<xsl:otherwise>
|
46 |
|
|
<xsl:apply-templates select="wmc:ResourceList/* | wmc:LayerList/*">
|
47 |
|
|
<xsl:sort select="position()" order="descending" data-type="number"/>
|
48 |
|
|
</xsl:apply-templates>
|
49 |
|
|
</xsl:otherwise>
|
50 |
|
|
</xsl:choose>
|
51 |
|
|
</table>
|
52 |
|
|
</xsl:template>
|
53 |
|
|
|
54 |
|
|
<!-- Layer -->
|
55 |
|
|
<xsl:template match="wmc:Layer">
|
56 |
|
|
<tr>
|
57 |
|
|
<!-- Visiblity -->
|
58 |
|
|
<td>
|
59 |
|
|
<input id="legend_{wmc:name}">
|
60 |
|
|
<xsl:choose>
|
61 |
|
|
<xsl:when test="@opaque='1'">
|
62 |
|
|
<xsl:attribute name="type">radio</xsl:attribute>
|
63 |
|
|
<xsl:attribute name="name">legendGroup</xsl:attribute>
|
64 |
|
|
<xsl:attribute name="onclick">config.objects.<xsl:value-of select="$widgetId"/>.swapOpaqueLayer('<xsl:value-of select="wmc:Name"/>',!this.checked)</xsl:attribute>
|
65 |
|
|
</xsl:when>
|
66 |
|
|
<xsl:otherwise>
|
67 |
|
|
<xsl:attribute name="type">checkbox</xsl:attribute>
|
68 |
|
|
<xsl:attribute name="onclick"><xsl:value-of select="$context"/>.setHidden('<xsl:value-of select="wmc:Name"/>',!this.checked)</xsl:attribute>
|
69 |
|
|
</xsl:otherwise>
|
70 |
|
|
</xsl:choose>
|
71 |
|
|
<xsl:if test="@hidden='0'"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
|
72 |
|
|
</input>
|
73 |
|
|
<xsl:choose>
|
74 |
|
|
<xsl:when test="wmc:Title/@xml:lang">
|
75 |
|
|
<xsl:value-of select="wmc:Title[@xml:lang=$lang]"/>
|
76 |
|
|
</xsl:when>
|
77 |
|
|
<xsl:otherwise>
|
78 |
|
|
<xsl:value-of select="wmc:Title"/>
|
79 |
|
|
</xsl:otherwise>
|
80 |
|
|
</xsl:choose>
|
81 |
|
|
</td>
|
82 |
|
|
</tr>
|
83 |
|
|
<!-- StyleList
|
84 |
|
|
<tr>
|
85 |
|
|
<td></td>
|
86 |
|
|
<td></td>
|
87 |
|
|
<td>
|
88 |
|
|
<xsl:if test="wmc:StyleList/wmc:Style[@current='1']/wmc:LegendURL">
|
89 |
|
|
<xsl:element name="img">
|
90 |
|
|
<xsl:attribute name="src">
|
91 |
|
|
<xsl:value-of select="wmc:StyleList/wmc:Style[@current='1']/wmc:LegendURL/wmc:OnlineResource/@xlink:href"/>
|
92 |
|
|
</xsl:attribute>
|
93 |
|
|
</xsl:element>
|
94 |
|
|
</xsl:if>
|
95 |
|
|
</td>
|
96 |
|
|
</tr> -->
|
97 |
|
|
</xsl:template>
|
98 |
|
|
|
99 |
|
|
<xsl:template match="text()|@*"/>
|
100 |
|
|
|
101 |
|
|
</xsl:stylesheet>
|