[TASK] Update ADOdb to 5.18
[Packages/TYPO3.CMS.git] / typo3 / sysext / adodb / adodb / xsl / convert-0.2-0.3.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 >
5         <xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="UTF-8"/>
6
7         <!-- Schema -->
8         <xsl:template match="/">
9                 <xsl:comment>
10 ADODB XMLSchema
11 http://adodb-xmlschema.sourceforge.net
12 </xsl:comment>
13
14                 <xsl:element name="schema">
15                         <xsl:attribute name="version">0.3</xsl:attribute>
16
17                         <xsl:apply-templates select="schema/table|schema/sql"/>
18                 </xsl:element>
19         </xsl:template>
20
21         <!-- Table -->
22         <xsl:template match="table">
23                 <xsl:element name="table">
24                         <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
25
26                         <xsl:if test="string-length(@platform) > 0">
27                                 <xsl:attribute name="platform"><xsl:value-of select="@platform"/></xsl:attribute>
28                         </xsl:if>
29
30                         <xsl:if test="string-length(@version) > 0">
31                                 <xsl:attribute name="version"><xsl:value-of select="@version"/></xsl:attribute>
32                         </xsl:if>
33
34                         <xsl:apply-templates select="descr[1]"/>
35
36                         <xsl:choose>
37                                 <xsl:when test="count(DROP) > 0">
38                                         <xsl:element name="DROP"/>
39                                 </xsl:when>
40                                 <xsl:otherwise>
41                                         <xsl:apply-templates select="field"/>
42                                 </xsl:otherwise>
43                         </xsl:choose>
44
45                         <xsl:apply-templates select="constraint"/>
46
47                         <xsl:apply-templates select="opt"/>
48
49                         <xsl:apply-templates select="index"/>
50
51                         <xsl:apply-templates select="data"/>
52                 </xsl:element>
53         </xsl:template>
54
55         <!-- Field -->
56         <xsl:template match="field">
57                 <xsl:element name="field">
58                         <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
59                         <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
60
61                         <xsl:if test="string-length(@size) > 0">
62                                 <xsl:attribute name="size"><xsl:value-of select="@size"/></xsl:attribute>
63                         </xsl:if>
64
65                         <xsl:choose>
66                                 <xsl:when test="string-length(@opts) = 0">
67                                         <xsl:if test="count(UNSIGNED) > 0">
68                                                 <xsl:element name="UNSIGNED"/>
69                                         </xsl:if>
70                                 </xsl:when>
71                                 <xsl:when test="@opts = 'UNSIGNED'">
72                                         <xsl:element name="UNSIGNED"/>
73                                 </xsl:when>
74                                 <xsl:when test="contains(@opts,'UNSIGNED')">
75                                         <xsl:attribute name="opts">
76                                                 <xsl:value-of select="concat(substring-before(@opts,'UNSIGNED'),substring-after(@opts,'UNSIGNED'))"/>
77                                         </xsl:attribute>
78                                         <xsl:element name="UNSIGNED"/>
79                                 </xsl:when>
80                                 <xsl:otherwise>
81                                         <xsl:attribute name="opts"><xsl:value-of select="@opts"/></xsl:attribute>
82                                         <xsl:if test="count(UNSIGNED) > 0">
83                                                 <xsl:element name="UNSIGNED"/>
84                                         </xsl:if>
85                                 </xsl:otherwise>
86                         </xsl:choose>
87
88                         <xsl:apply-templates select="descr[1]"/>
89
90                         <xsl:choose>
91                                 <xsl:when test="count(PRIMARY) > 0">
92                                         <xsl:element name="PRIMARY"/>
93                                 </xsl:when>
94                                 <xsl:when test="count(KEY) > 0">
95                                         <xsl:element name="KEY"/>
96                                 </xsl:when>
97                                 <xsl:when test="count(NOTNULL) > 0">
98                                         <xsl:element name="NOTNULL"/>
99                                 </xsl:when>
100                         </xsl:choose>
101
102                         <xsl:choose>
103                                 <xsl:when test="count(AUTO) > 0">
104                                         <xsl:element name="AUTO"/>
105                                 </xsl:when>
106                                 <xsl:when test="count(AUTOINCREMENT) > 0">
107                                         <xsl:element name="AUTOINCREMENT"/>
108                                 </xsl:when>
109                         </xsl:choose>
110
111                         <xsl:choose>
112                                 <xsl:when test="count(DEFAULT) > 0">
113                                         <xsl:element name="DEFAULT">
114                                                 <xsl:attribute name="value">
115                                                         <xsl:value-of select="DEFAULT[1]/@value"/>
116                                                 </xsl:attribute>
117                                         </xsl:element>
118                                 </xsl:when>
119                                 <xsl:when test="count(DEFDATE) > 0">
120                                         <xsl:element name="DEFDATE">
121                                                 <xsl:attribute name="value">
122                                                         <xsl:value-of select="DEFDATE[1]/@value"/>
123                                                 </xsl:attribute>
124                                         </xsl:element>
125                                 </xsl:when>
126                                 <xsl:when test="count(DEFTIMESTAMP) > 0">
127                                         <xsl:element name="DEFTIMESTAMP">
128                                                 <xsl:attribute name="value">
129                                                         <xsl:value-of select="DEFTIMESTAMP[1]/@value"/>
130                                                 </xsl:attribute>
131                                         </xsl:element>
132                                 </xsl:when>
133                         </xsl:choose>
134
135                         <xsl:if test="count(NOQUOTE) > 0">
136                                 <xsl:element name="NOQUOTE"/>
137                         </xsl:if>
138
139                         <xsl:apply-templates select="constraint"/>
140
141                         <xsl:apply-templates select="opt"/>
142                 </xsl:element>
143         </xsl:template>
144
145         <!-- Constraint -->
146         <xsl:template match="constraint">
147                 <xsl:element name="constraint">
148                         <xsl:if test="string-length(@platform) > 0">
149                                 <xsl:attribute name="platform"><xsl:value-of select="@platform"/></xsl:attribute>
150                         </xsl:if>
151
152                         <xsl:value-of select="normalize-space(text())"/>
153                 </xsl:element>
154         </xsl:template>
155
156         <!-- Opt -->
157         <xsl:template match="opt">
158                 <xsl:element name="opt">
159                         <xsl:if test="string-length(@platform) > 0">
160                                 <xsl:attribute name="platform"><xsl:value-of select="@platform"/></xsl:attribute>
161                         </xsl:if>
162
163                         <xsl:value-of select="normalize-space(text())"/>
164                 </xsl:element>
165         </xsl:template>
166
167         <!-- Index -->
168         <xsl:template match="index">
169                 <xsl:element name="index">
170                         <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
171
172                         <xsl:apply-templates select="descr[1]"/>
173
174                         <xsl:if test="count(CLUSTERED) > 0">
175                                 <xsl:element name="CLUSTERED"/>
176                         </xsl:if>
177
178                         <xsl:if test="count(BITMAP) > 0">
179                                 <xsl:element name="BITMAP"/>
180                         </xsl:if>
181
182                         <xsl:if test="count(UNIQUE) > 0">
183                                 <xsl:element name="UNIQUE"/>
184                         </xsl:if>
185
186                         <xsl:if test="count(FULLTEXT) > 0">
187                                 <xsl:element name="FULLTEXT"/>
188                         </xsl:if>
189
190                         <xsl:if test="count(HASH) > 0">
191                                 <xsl:element name="HASH"/>
192                         </xsl:if>
193
194                         <xsl:choose>
195                                 <xsl:when test="count(DROP) > 0">
196                                         <xsl:element name="DROP"/>
197                                 </xsl:when>
198                                 <xsl:otherwise>
199                                         <xsl:apply-templates select="col"/>
200                                 </xsl:otherwise>
201                         </xsl:choose>
202                 </xsl:element>
203         </xsl:template>
204
205         <!-- Index Column -->
206         <xsl:template match="col">
207                 <xsl:element name="col">
208                         <xsl:value-of select="normalize-space(text())"/>
209                 </xsl:element>
210         </xsl:template>
211
212         <!-- SQL QuerySet -->
213         <xsl:template match="sql">
214                 <xsl:element name="sql">
215                         <xsl:if test="string-length(@platform) > 0">
216                                 <xsl:attribute name="platform"><xsl:value-of select="@platform"/></xsl:attribute>
217                         </xsl:if>
218
219                         <xsl:if test="string-length(@key) > 0">
220                                 <xsl:attribute name="key"><xsl:value-of select="@key"/></xsl:attribute>
221                         </xsl:if>
222
223                         <xsl:if test="string-length(@prefixmethod) > 0">
224                                 <xsl:attribute name="prefixmethod"><xsl:value-of select="@prefixmethod"/></xsl:attribute>
225                         </xsl:if>
226
227                         <xsl:apply-templates select="descr[1]"/>
228
229                         <xsl:apply-templates select="query"/>
230                 </xsl:element>
231         </xsl:template>
232
233         <!-- Query -->
234         <xsl:template match="query">
235                 <xsl:element name="query">
236                         <xsl:if test="string-length(@platform) > 0">
237                                 <xsl:attribute name="platform"><xsl:value-of select="@platform"/></xsl:attribute>
238                         </xsl:if>
239
240                         <xsl:value-of select="normalize-space(text())"/>
241                 </xsl:element>
242         </xsl:template>
243
244         <!-- Description -->
245         <xsl:template match="descr">
246                 <xsl:element name="descr">
247                         <xsl:value-of select="normalize-space(text())"/>
248                 </xsl:element>
249         </xsl:template>
250
251         <!-- Data -->
252         <xsl:template match="data">
253                 <xsl:element name="data">
254                         <xsl:if test="string-length(@platform) > 0">
255                                 <xsl:attribute name="platform"><xsl:value-of select="@platform"/></xsl:attribute>
256                         </xsl:if>
257
258                         <xsl:apply-templates select="descr[1]"/>
259
260                         <xsl:apply-templates select="row"/>
261                 </xsl:element>
262         </xsl:template>
263
264         <!-- Data Row -->
265         <xsl:template match="row">
266                 <xsl:element name="row">
267                         <xsl:apply-templates select="f"/>
268                 </xsl:element>
269         </xsl:template>
270
271         <!-- Data Field -->
272         <xsl:template match="f">
273                 <xsl:element name="f">
274                         <xsl:if test="string-length(@name) > 0">
275                                 <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
276                         </xsl:if>
277
278                         <xsl:value-of select="normalize-space(text())"/>
279                 </xsl:element>
280         </xsl:template>
281 </xsl:stylesheet>