1 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
2 |
<!-- |
3 |
(c) 2007 by Intevation GmbH |
4 |
Authors: Torsten Irlaender |
5 |
Frank Koormann |
6 |
Converts the Formed xml tree into html |
7 |
|
8 |
TODO: |
9 |
- Verstaendliche Typenbezeichnung: |
10 |
radio: Radiobutton |
11 |
choice: Auswahlliste |
12 |
checkbox: Checkbox |
13 |
text: Textfeld |
14 |
textarea: Textbereich |
15 |
int: Zahl |
16 |
date: Datum |
17 |
bool: s.u. |
18 |
--> |
19 |
<xsl:output indent="yes" method="html" encoding="UTF-8"/> |
20 |
<xsl:template match="/"> |
21 |
<xsl:text disable-output-escaping="yes"> |
22 |
<![CDATA[ |
23 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
24 |
]]> |
25 |
</xsl:text> |
26 |
<html> |
27 |
<head> |
28 |
<title> Formularfelder Auflistung </title> |
29 |
</head> |
30 |
<body> |
31 |
<table> |
32 |
<tr> |
33 |
<th>Formular Bezeichnung</th> |
34 |
<th>Typ</th> |
35 |
<th>Datenbank Id</th> |
36 |
<th>Textfeld Laenge</th> |
37 |
<th>Textfeld max. Laenge</th> |
38 |
<th>Int min. Wert</th> |
39 |
<th>Int max. Wert</th> |
40 |
<th>Textbereich anz. Reihen</th> |
41 |
<th>Textbereich anz. Spalten</th> |
42 |
</tr> |
43 |
<xsl:apply-templates/> |
44 |
</table> |
45 |
</body> |
46 |
</html> |
47 |
</xsl:template> |
48 |
|
49 |
<xsl:template match="group"> |
50 |
<tr> |
51 |
<td colspan="9"> |
52 |
<xsl:choose> |
53 |
<xsl:when test="count(ancestor::*) = 1"> |
54 |
<h1><xsl:value-of select="@description"/></h1> |
55 |
</xsl:when> |
56 |
<xsl:when test="count(ancestor::*) = 2"> |
57 |
<h2><xsl:value-of select="@description"/></h2> |
58 |
</xsl:when> |
59 |
<xsl:when test="count(ancestor::*) = 3"> |
60 |
<h3><xsl:value-of select="@description"/></h3> |
61 |
</xsl:when> |
62 |
<xsl:when test="count(ancestor::*) = 4"> |
63 |
<h4><xsl:value-of select="@description"/></h4> |
64 |
</xsl:when> |
65 |
<xsl:when test="count(ancestor::*) = 5"> |
66 |
<h5><xsl:value-of select="@description"/></h5> |
67 |
</xsl:when> |
68 |
<xsl:otherwise> |
69 |
<h6><xsl:value-of select="@description"/></h6> |
70 |
</xsl:otherwise> |
71 |
</xsl:choose> |
72 |
</td> |
73 |
</tr> |
74 |
<xsl:apply-templates/> |
75 |
</xsl:template> |
76 |
|
77 |
<xsl:template match="switch"> |
78 |
<tr> |
79 |
<td colspan="9"> |
80 |
<xsl:call-template name="local_name_mapping" /> |
81 |
</td> |
82 |
</tr> |
83 |
<xsl:for-each select="child::*"> |
84 |
<xsl:call-template name="elements_of_switch" /> |
85 |
</xsl:for-each> |
86 |
</xsl:template> |
87 |
|
88 |
<xsl:template name="elements_of_switch"> |
89 |
<tr> |
90 |
<td valign="top"><xsl:value-of select="@name"/></td> |
91 |
<td colspan="8"> |
92 |
<table> |
93 |
<xsl:apply-templates select="self::*"/> |
94 |
</table> |
95 |
</td> |
96 |
</tr> |
97 |
</xsl:template> |
98 |
|
99 |
<xsl:template match="radio|choice|checkbox"> |
100 |
<tr> |
101 |
<td> |
102 |
<b> |
103 |
<xsl:text>[</xsl:text> |
104 |
<xsl:value-of select="@description"/> |
105 |
<xsl:text>]</xsl:text> |
106 |
</b> |
107 |
</td> |
108 |
<td> <xsl:call-template name="local_name_mapping" /> </td> |
109 |
<td> <xsl:value-of select="@name"/> </td> |
110 |
<td colspan="6"> |
111 |
</td> |
112 |
</tr> |
113 |
<xsl:apply-templates select="bool" mode="select"/> |
114 |
<tr> |
115 |
<td colspan="9"> |
116 |
<b> |
117 |
<xsl:text>[/</xsl:text> |
118 |
<xsl:value-of select="@description"/> |
119 |
<xsl:text>]</xsl:text> |
120 |
</b> |
121 |
</td> |
122 |
</tr> |
123 |
</xsl:template> |
124 |
|
125 |
<xsl:template match="text|textarea|int|date|bool"> |
126 |
<tr> |
127 |
<td> <xsl:value-of select="@description"/> </td> |
128 |
<td> <xsl:call-template name="local_name_mapping" /> </td> |
129 |
<td> <xsl:value-of select="@name"/> </td> |
130 |
<td> <xsl:value-of select="@size"/> </td> |
131 |
<td> <xsl:value-of select="@maxlength"/> </td> |
132 |
<td> <xsl:value-of select="@minvalue"/> </td> |
133 |
<td> <xsl:value-of select="@maxvalue"/> </td> |
134 |
<td> <xsl:value-of select="@rows"/> </td> |
135 |
<td> <xsl:value-of select="@cols"/> </td> |
136 |
</tr> |
137 |
</xsl:template> |
138 |
|
139 |
|
140 |
<xsl:template match="bool" mode="select"> |
141 |
<tr> |
142 |
<td></td> |
143 |
<td> <xsl:value-of select="@description"/> </td> |
144 |
<td colspan="7"></td> |
145 |
</tr> |
146 |
</xsl:template> |
147 |
|
148 |
<xsl:template name="local_name_mapping"> |
149 |
<xsl:choose> |
150 |
<xsl:when test="local-name() = 'switch'"> |
151 |
Unterschiede in Formularversionen |
152 |
</xsl:when> |
153 |
<xsl:when test="local-name() = 'radio'"> |
154 |
Radiobutton |
155 |
</xsl:when> |
156 |
<xsl:when test="local-name() = 'choice'"> |
157 |
Auswahlliste |
158 |
</xsl:when> |
159 |
<xsl:when test="local-name() = 'check'"> |
160 |
Checkbox |
161 |
</xsl:when> |
162 |
<xsl:when test="local-name() = 'text'"> |
163 |
Textfeld |
164 |
</xsl:when> |
165 |
<xsl:when test="local-name() = 'textarea'"> |
166 |
Textbereich |
167 |
</xsl:when> |
168 |
<xsl:when test="local-name() = 'date'"> |
169 |
Datum |
170 |
</xsl:when> |
171 |
<xsl:when test="local-name() = 'int'"> |
172 |
Zahl |
173 |
</xsl:when> |
174 |
<xsl:when test="local-name() = 'bool'"> |
175 |
Ja/Nein-Feld |
176 |
</xsl:when> |
177 |
<xsl:otherwise> |
178 |
unbekannt: <xsl:value-of select="local-name()"/> |
179 |
</xsl:otherwise> |
180 |
</xsl:choose> |
181 |
</xsl:template> |
182 |
|
183 |
|
184 |
<!-- suppress unneeded textual content --> |
185 |
<xsl:template match="text()"/> |
186 |
</xsl:stylesheet> |