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.1</xsl:attribute>
17 <xsl:apply-templates select=
"schema/table|schema/sql"/>
22 <xsl:template match=
"table">
23 <xsl:variable name=
"table_name" select=
"@name"/>
25 <xsl:element name=
"table">
26 <xsl:attribute name=
"name"><xsl:value-of select=
"$table_name"/></xsl:attribute>
28 <xsl:if test=
"string-length(@platform) > 0">
29 <xsl:attribute name=
"platform"><xsl:value-of select=
"@platform"/></xsl:attribute>
32 <xsl:if test=
"string-length(@version) > 0">
33 <xsl:attribute name=
"version"><xsl:value-of select=
"@version"/></xsl:attribute>
36 <xsl:apply-templates select=
"descr[1]"/>
39 <xsl:when test=
"count(DROP) > 0">
40 <xsl:element name=
"DROP"/>
43 <xsl:apply-templates select=
"field"/>
47 <xsl:apply-templates select=
"constraint"/>
51 <xsl:apply-templates select=
"index"/>
55 <xsl:template match=
"field">
56 <xsl:element name=
"field">
57 <xsl:attribute name=
"name"><xsl:value-of select=
"@name"/></xsl:attribute>
58 <xsl:attribute name=
"type"><xsl:value-of select=
"@type"/></xsl:attribute>
60 <xsl:if test=
"string-length(@size) > 0">
61 <xsl:attribute name=
"size"><xsl:value-of select=
"@size"/></xsl:attribute>
65 <xsl:when test=
"count(PRIMARY) > 0">
66 <xsl:element name=
"PRIMARY"/>
68 <xsl:when test=
"count(KEY) > 0">
69 <xsl:element name=
"KEY"/>
71 <xsl:when test=
"count(NOTNULL) > 0">
72 <xsl:element name=
"NOTNULL"/>
77 <xsl:when test=
"count(AUTO) > 0">
78 <xsl:element name=
"AUTO"/>
80 <xsl:when test=
"count(AUTOINCREMENT) > 0">
81 <xsl:element name=
"AUTOINCREMENT"/>
86 <xsl:when test=
"count(DEFAULT) > 0">
87 <xsl:element name=
"DEFAULT">
88 <xsl:attribute name=
"value">
89 <xsl:value-of select=
"DEFAULT[1]/@value"/>
93 <xsl:when test=
"count(DEFDATE) > 0">
94 <xsl:element name=
"DEFDATE">
95 <xsl:attribute name=
"value">
96 <xsl:value-of select=
"DEFDATE[1]/@value"/>
100 <xsl:when test=
"count(DEFTIMESTAMP) > 0">
101 <xsl:element name=
"DEFDTIMESTAMP">
102 <xsl:attribute name=
"value">
103 <xsl:value-of select=
"DEFTIMESTAMP[1]/@value"/>
109 <xsl:if test=
"count(NOQUOTE) > 0">
110 <xsl:element name=
"NOQUOTE"/>
113 <xsl:apply-templates select=
"constraint"/>
118 <xsl:template match=
"constraint">
119 <xsl:element name=
"constraint">
120 <xsl:value-of select=
"normalize-space(text())"/>
125 <xsl:template match=
"index">
126 <xsl:element name=
"index">
127 <xsl:attribute name=
"name"><xsl:value-of select=
"@name"/></xsl:attribute>
128 <xsl:attribute name=
"table"><xsl:value-of select=
"../@name"/></xsl:attribute>
130 <xsl:apply-templates select=
"descr[1]"/>
132 <xsl:if test=
"count(CLUSTERED) > 0">
133 <xsl:element name=
"CLUSTERED"/>
136 <xsl:if test=
"count(BITMAP) > 0">
137 <xsl:element name=
"BITMAP"/>
140 <xsl:if test=
"count(UNIQUE) > 0">
141 <xsl:element name=
"UNIQUE"/>
144 <xsl:if test=
"count(FULLTEXT) > 0">
145 <xsl:element name=
"FULLTEXT"/>
148 <xsl:if test=
"count(HASH) > 0">
149 <xsl:element name=
"HASH"/>
153 <xsl:when test=
"count(DROP) > 0">
154 <xsl:element name=
"DROP"/>
157 <xsl:apply-templates select=
"col"/>
163 <!-- Index Column -->
164 <xsl:template match=
"col">
165 <xsl:element name=
"col">
166 <xsl:value-of select=
"normalize-space(text())"/>
170 <!-- SQL QuerySet -->
171 <xsl:template match=
"sql">
172 <xsl:element name=
"sql">
173 <xsl:if test=
"string-length(@platform) > 0">
174 <xsl:attribute name=
"platform"><xsl:value-of select=
"@platform"/></xsl:attribute>
177 <xsl:if test=
"string-length(@key) > 0">
178 <xsl:attribute name=
"key"><xsl:value-of select=
"@key"/></xsl:attribute>
181 <xsl:if test=
"string-length(@prefixmethod) > 0">
182 <xsl:attribute name=
"prefixmethod"><xsl:value-of select=
"@prefixmethod"/></xsl:attribute>
185 <xsl:apply-templates select=
"descr[1]"/>
186 <xsl:apply-templates select=
"query"/>
191 <xsl:template match=
"query">
192 <xsl:element name=
"query">
193 <xsl:if test=
"string-length(@platform) > 0">
194 <xsl:attribute name=
"platform"><xsl:value-of select=
"@platform"/></xsl:attribute>
197 <xsl:value-of select=
"normalize-space(text())"/>
202 <xsl:template match=
"descr">
203 <xsl:element name=
"descr">
204 <xsl:value-of select=
"normalize-space(text())"/>