1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <xsl:stylesheet version=
"1.0"
3 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 <xsl:output method=
"xml" indent=
"yes" omit-xml-declaration=
"no" encoding=
"UTF-8"/>
8 <xsl:template match=
"/">
11 http://adodb-xmlschema.sourceforge.net
14 <xsl:element name=
"schema">
15 <xsl:attribute name=
"version">0.3</xsl:attribute>
17 <xsl:apply-templates select=
"schema/table|schema/sql"/>
22 <xsl:template match=
"table">
23 <xsl:element name=
"table">
24 <xsl:attribute name=
"name"><xsl:value-of select=
"@name"/></xsl:attribute>
26 <xsl:if test=
"string-length(@platform) > 0">
27 <xsl:attribute name=
"platform"><xsl:value-of select=
"@platform"/></xsl:attribute>
30 <xsl:if test=
"string-length(@version) > 0">
31 <xsl:attribute name=
"version"><xsl:value-of select=
"@version"/></xsl:attribute>
34 <xsl:apply-templates select=
"descr[1]"/>
37 <xsl:when test=
"count(DROP) > 0">
38 <xsl:element name=
"DROP"/>
41 <xsl:apply-templates select=
"field"/>
45 <xsl:apply-templates select=
"constraint"/>
47 <xsl:apply-templates select=
"opt"/>
49 <xsl:apply-templates select=
"index"/>
51 <xsl:apply-templates select=
"data"/>
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>
61 <xsl:if test=
"string-length(@size) > 0">
62 <xsl:attribute name=
"size"><xsl:value-of select=
"@size"/></xsl:attribute>
66 <xsl:when test=
"string-length(@opts) = 0">
67 <xsl:if test=
"count(UNSIGNED) > 0">
68 <xsl:element name=
"UNSIGNED"/>
71 <xsl:when test=
"@opts = 'UNSIGNED'">
72 <xsl:element name=
"UNSIGNED"/>
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'))"/>
78 <xsl:element name=
"UNSIGNED"/>
81 <xsl:attribute name=
"opts"><xsl:value-of select=
"@opts"/></xsl:attribute>
82 <xsl:if test=
"count(UNSIGNED) > 0">
83 <xsl:element name=
"UNSIGNED"/>
88 <xsl:apply-templates select=
"descr[1]"/>
91 <xsl:when test=
"count(PRIMARY) > 0">
92 <xsl:element name=
"PRIMARY"/>
94 <xsl:when test=
"count(KEY) > 0">
95 <xsl:element name=
"KEY"/>
97 <xsl:when test=
"count(NOTNULL) > 0">
98 <xsl:element name=
"NOTNULL"/>
103 <xsl:when test=
"count(AUTO) > 0">
104 <xsl:element name=
"AUTO"/>
106 <xsl:when test=
"count(AUTOINCREMENT) > 0">
107 <xsl:element name=
"AUTOINCREMENT"/>
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"/>
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"/>
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"/>
135 <xsl:if test=
"count(NOQUOTE) > 0">
136 <xsl:element name=
"NOQUOTE"/>
139 <xsl:apply-templates select=
"constraint"/>
141 <xsl:apply-templates select=
"opt"/>
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>
152 <xsl:value-of select=
"normalize-space(text())"/>
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>
163 <xsl:value-of select=
"normalize-space(text())"/>
168 <xsl:template match=
"index">
169 <xsl:element name=
"index">
170 <xsl:attribute name=
"name"><xsl:value-of select=
"@name"/></xsl:attribute>
172 <xsl:apply-templates select=
"descr[1]"/>
174 <xsl:if test=
"count(CLUSTERED) > 0">
175 <xsl:element name=
"CLUSTERED"/>
178 <xsl:if test=
"count(BITMAP) > 0">
179 <xsl:element name=
"BITMAP"/>
182 <xsl:if test=
"count(UNIQUE) > 0">
183 <xsl:element name=
"UNIQUE"/>
186 <xsl:if test=
"count(FULLTEXT) > 0">
187 <xsl:element name=
"FULLTEXT"/>
190 <xsl:if test=
"count(HASH) > 0">
191 <xsl:element name=
"HASH"/>
195 <xsl:when test=
"count(DROP) > 0">
196 <xsl:element name=
"DROP"/>
199 <xsl:apply-templates select=
"col"/>
205 <!-- Index Column -->
206 <xsl:template match=
"col">
207 <xsl:element name=
"col">
208 <xsl:value-of select=
"normalize-space(text())"/>
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>
219 <xsl:if test=
"string-length(@key) > 0">
220 <xsl:attribute name=
"key"><xsl:value-of select=
"@key"/></xsl:attribute>
223 <xsl:if test=
"string-length(@prefixmethod) > 0">
224 <xsl:attribute name=
"prefixmethod"><xsl:value-of select=
"@prefixmethod"/></xsl:attribute>
227 <xsl:apply-templates select=
"descr[1]"/>
229 <xsl:apply-templates select=
"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>
240 <xsl:value-of select=
"normalize-space(text())"/>
245 <xsl:template match=
"descr">
246 <xsl:element name=
"descr">
247 <xsl:value-of select=
"normalize-space(text())"/>
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>
258 <xsl:apply-templates select=
"descr[1]"/>
260 <xsl:apply-templates select=
"row"/>
265 <xsl:template match=
"row">
266 <xsl:element name=
"row">
267 <xsl:apply-templates select=
"f"/>
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>
278 <xsl:value-of select=
"normalize-space(text())"/>