/[formed]/trunk/contrib/convert-formedtree2html.xsl
ViewVC logotype

Contents of /trunk/contrib/convert-formedtree2html.xsl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 67 - (show annotations)
Tue Aug 21 13:15:51 2007 UTC (17 years, 6 months ago) by frank
File MIME type: application/xml
File size: 5411 byte(s)
* contrib/convert-formedtree2html.xsl:
        Replace technical types with readable descriptions

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 <h2>
81 <xsl:text>{</xsl:text>
82 <xsl:value-of select="local-name()"/>
83 <xsl:text>} </xsl:text> <xsl:value-of select="@description"/>
84 </h2>
85 </td>
86 </tr>
87 <xsl:apply-templates/>
88 <tr>
89 <td colspan="9">
90 <h2>
91 <xsl:text>{/</xsl:text>
92 <xsl:value-of select="local-name()"/>
93 <xsl:text>} </xsl:text> <xsl:value-of select="@description"/>
94 </h2>
95 </td>
96 </tr>
97 </xsl:template>
98 <xsl:template match="radio|choice|checkbox">
99 <tr>
100 <td>
101 <b>
102 <xsl:text>[</xsl:text>
103 <xsl:value-of select="@description"/>
104 <xsl:text>]</xsl:text>
105 </b>
106 </td>
107 <td> <xsl:call-template name="local_name_mapping" /> </td>
108 <td> <xsl:value-of select="@name"/> </td>
109 <td colspan="6">
110 </td>
111 </tr>
112 <xsl:apply-templates select="bool" mode="select"/>
113 <tr>
114 <td colspan="9">
115 <b>
116 <xsl:text>[/</xsl:text>
117 <xsl:value-of select="@description"/>
118 <xsl:text>]</xsl:text>
119 </b>
120 </td>
121 </tr>
122 </xsl:template>
123
124 <xsl:template match="text|textarea|int|date|bool">
125 <tr>
126 <td> <xsl:value-of select="@description"/> </td>
127 <td> <xsl:call-template name="local_name_mapping" /> </td>
128 <td> <xsl:value-of select="@name"/> </td>
129 <td> <xsl:value-of select="@size"/> </td>
130 <td> <xsl:value-of select="@maxlength"/> </td>
131 <td> <xsl:value-of select="@minvalue"/> </td>
132 <td> <xsl:value-of select="@maxvalue"/> </td>
133 <td> <xsl:value-of select="@rows"/> </td>
134 <td> <xsl:value-of select="@cols"/> </td>
135 </tr>
136 </xsl:template>
137
138
139 <xsl:template match="bool" mode="select">
140 <tr>
141 <td></td>
142 <td> <xsl:value-of select="@description"/> </td>
143 <td colspan="7"></td>
144 </tr>
145 </xsl:template>
146
147 <xsl:template name="local_name_mapping">
148 <xsl:choose>
149 <xsl:when test="local-name() = 'switch'">
150 Unterschiede in Formularversionen
151 </xsl:when>
152 <xsl:when test="local-name() = 'radio'">
153 Radiobutton
154 </xsl:when>
155 <xsl:when test="local-name() = 'choice'">
156 Auswahlliste
157 </xsl:when>
158 <xsl:when test="local-name() = 'check'">
159 Checkbox
160 </xsl:when>
161 <xsl:when test="local-name() = 'text'">
162 Textfeld
163 </xsl:when>
164 <xsl:when test="local-name() = 'textarea'">
165 Textbereich
166 </xsl:when>
167 <xsl:when test="local-name() = 'date'">
168 Datum
169 </xsl:when>
170 <xsl:when test="local-name() = 'int'">
171 Zahl
172 </xsl:when>
173 <xsl:when test="local-name() = 'bool'">
174 Ja/Nein-Feld
175 </xsl:when>
176 <xsl:otherwise>
177 unbekannt: <xsl:value-of select="local-name()"/>
178 </xsl:otherwise>
179 </xsl:choose>
180 </xsl:template>
181
182
183 <!-- suppress unneeded textual content -->
184 <xsl:template match="text()"/>
185 </xsl:stylesheet>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26