1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet version="1.0" xmlns:wmc="http://www.opengis.net/context" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" >
|
3
|
|
4
|
<!--
|
5
|
Description: Prototype stylesheet to automatically generate a form from an XML doc.
|
6
|
Author: Mike Adair
|
7
|
Licence: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
8
|
|
9
|
XmlForm.xsl,v 1.1 2004/06/28 03:46:49 madair1 Exp
|
10
|
-->
|
11
|
|
12
|
<xsl:output method="xml" encoding="utf-8"/>
|
13
|
|
14
|
<!-- The common params set for all widgets -->
|
15
|
<xsl:param name="modelId"/>
|
16
|
<xsl:param name="widgetId"/>
|
17
|
|
18
|
<xsl:param name="procNode"></xsl:param>
|
19
|
|
20
|
<!-- The name of the form for coordinate output -->
|
21
|
<xsl:param name="formName">XmlForm</xsl:param>
|
22
|
|
23
|
<!-- Main html -->
|
24
|
<xsl:template match="/">
|
25
|
<div>
|
26
|
<form name="{$formName}" id="{$formName}">
|
27
|
<xsl:apply-templates select="wmc:ViewContext/wmc:General/wmc:ContactInformation"/>
|
28
|
</form>
|
29
|
</div>
|
30
|
</xsl:template>
|
31
|
|
32
|
<xsl:template match="*">
|
33
|
<xsl:choose>
|
34
|
<xsl:when test="string-length(normalize-space(text()))>0">
|
35
|
<xsl:value-of select="name()"/>
|
36
|
<xsl:element name="INPUT">
|
37
|
<xsl:attribute name="ID">elId</xsl:attribute>
|
38
|
<xsl:attribute name="TYPE">text</xsl:attribute>
|
39
|
<xsl:attribute name="VALUE"><xsl:value-of select='text()'/></xsl:attribute>
|
40
|
</xsl:element>
|
41
|
<br/>
|
42
|
<xsl:apply-templates />
|
43
|
</xsl:when>
|
44
|
<xsl:otherwise>
|
45
|
<dl>
|
46
|
<dt>
|
47
|
<xsl:value-of select="name()"/>
|
48
|
</dt>
|
49
|
<dd>
|
50
|
<xsl:apply-templates />
|
51
|
</dd>
|
52
|
</dl>
|
53
|
</xsl:otherwise>
|
54
|
</xsl:choose>
|
55
|
</xsl:template>
|
56
|
|
57
|
<xsl:template match="text()|@*"/>
|
58
|
|
59
|
</xsl:stylesheet>
|