1
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
<!--
|
3
|
Description: Build a HTML register of components from a Mapbuilder
|
4
|
Config file.
|
5
|
Descriptions for the components are extracted from the
|
6
|
config.xsd schema document.
|
7
|
Licence: LGPL as specified in http://www.gnu.org/copyleft/lesser.html .
|
8
|
|
9
|
$Id: register.xsl 1744 2005-10-20 11:02:56Z camerons $
|
10
|
$Name$
|
11
|
-->
|
12
|
|
13
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mb="http://mapbuilder.sourceforge.net/mapbuilder" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
14
|
|
15
|
<xsl:output method="html"/>
|
16
|
|
17
|
<!-- Root node. -->
|
18
|
<xsl:template match="/">
|
19
|
<html>
|
20
|
<head>
|
21
|
<title>Mapbuilder Components Register</title>
|
22
|
|
23
|
<link rel="stylesheet" href="../../lib/skin/default/html.css" type="text/css"/>
|
24
|
|
25
|
<script>
|
26
|
// URL of Mapbuilder configuration file.
|
27
|
var mbConfigUrl='config.xml';
|
28
|
</script>
|
29
|
<script type="text/javascript" src="../../lib/Mapbuilder.js"></script>
|
30
|
</head>
|
31
|
|
32
|
<body onload="mbDoLoad()">
|
33
|
<h1>Mapbuilder Components Register</h1>
|
34
|
<xsl:apply-templates select="//mb:widgets/*"/>
|
35
|
</body>
|
36
|
</html>
|
37
|
</xsl:template>
|
38
|
|
39
|
<!-- Widget -->
|
40
|
<xsl:template match="mb:widgets/*">
|
41
|
<xsl:variable
|
42
|
name="widgetName"
|
43
|
select="name(.)"/>
|
44
|
<xsl:variable
|
45
|
name="componentType"
|
46
|
select="substring-after(document('../../lib/schemas/config.xml')//xs:element[@name=$widgetName]/@type,':')"/>
|
47
|
|
48
|
<h2><xsl:value-of select="name(.)"/> Widget</h2>
|
49
|
<ul>
|
50
|
<table border="1">
|
51
|
<tr>
|
52
|
<th>Description</th>
|
53
|
<td>
|
54
|
<p>
|
55
|
<!-- Print component description -->
|
56
|
<xsl:apply-templates select="document('../../lib/schemas/config.xml')//xs:complexType[@name=$componentType]/xs:annotation/xs:documentation"/>
|
57
|
</p>
|
58
|
|
59
|
</td>
|
60
|
</tr>
|
61
|
<xsl:if test="mb:stylesheet">
|
62
|
<tr>
|
63
|
<th>Stylesheet</th>
|
64
|
<td><xsl:value-of select="mb:stylesheet"/></td>
|
65
|
</tr>
|
66
|
</xsl:if>
|
67
|
<tr>
|
68
|
<th>Example</th>
|
69
|
<td>
|
70
|
<div>
|
71
|
<xsl:attribute name="id">
|
72
|
<xsl:choose>
|
73
|
<xsl:when test="mb:htmlTagId">
|
74
|
<xsl:value-of select="mb:htmlTagId"/>
|
75
|
</xsl:when>
|
76
|
<xsl:otherwise>
|
77
|
<xsl:value-of select="@id"/>
|
78
|
</xsl:otherwise>
|
79
|
</xsl:choose>
|
80
|
</xsl:attribute>
|
81
|
</div>
|
82
|
</td>
|
83
|
</tr>
|
84
|
</table>
|
85
|
</ul>
|
86
|
</xsl:template>
|
87
|
<!-- Example -->
|
88
|
<xsl:template match="mb:Example">
|
89
|
<tr>
|
90
|
<td>
|
91
|
<h3><xsl:value-of select="mb:title"/></h3>
|
92
|
<p><xsl:value-of select="mb:description"/></p>
|
93
|
</td>
|
94
|
<td>
|
95
|
<div>
|
96
|
<xsl:attribute name="id">
|
97
|
<xsl:value-of select="mb:divId"/>
|
98
|
</xsl:attribute>
|
99
|
</div>
|
100
|
</td>
|
101
|
<td><xsl:value-of select="mb:html"/></td>
|
102
|
<td><xsl:value-of select="mb:configSnippet"/></td>
|
103
|
</tr>
|
104
|
</xsl:template>
|
105
|
|
106
|
<!-- complex type-->
|
107
|
<xsl:template match="xs:complexType">
|
108
|
<i>ComplexType:<xsl:value-of select="."/></i>
|
109
|
</xsl:template>
|
110
|
|
111
|
<!-- Schema documentation -->
|
112
|
<xsl:template match="xs:documentation">
|
113
|
<i><xsl:value-of select="."/></i>
|
114
|
</xsl:template>
|
115
|
|
116
|
|
117
|
</xsl:stylesheet>
|