1 |
efrain |
1 |
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
3 |
|
|
|
4 |
<xsl:output omit-xml-declaration="yes"/>
|
|
|
5 |
|
|
|
6 |
<!-- Top level: disclaimer/intro -->
|
|
|
7 |
<xsl:template match="/">
|
|
|
8 |
<xsl:apply-templates/>
|
|
|
9 |
</xsl:template>
|
|
|
10 |
|
|
|
11 |
<!-- Tables: heading, comment -->
|
|
|
12 |
<xsl:template match="TABLE">
|
|
|
13 |
<xsl:variable name="tableid">table_<xsl:value-of select="@NAME"/></xsl:variable>
|
|
|
14 |
<h3 id="{$tableid}" style="margin-top:3em"><xsl:value-of select="@NAME"/></h3>
|
|
|
15 |
<xsl:call-template name="display-comment"><xsl:with-param name="PARA">y</xsl:with-param></xsl:call-template>
|
|
|
16 |
<xsl:apply-templates>
|
|
|
17 |
<xsl:with-param name="tableid" select="$tableid" />
|
|
|
18 |
</xsl:apply-templates>
|
|
|
19 |
</xsl:template>
|
|
|
20 |
|
|
|
21 |
<!-- Fields (if any): table with field, type, comment -->
|
|
|
22 |
<xsl:template match="FIELDS[FIELD]">
|
|
|
23 |
<xsl:param name="tableid" />
|
|
|
24 |
<table class="generaltable boxaligncenter" style="margin:1em 0" cellspacing="1" cellpadding="5" width="100%">
|
|
|
25 |
<tr>
|
|
|
26 |
<th class="header c0" scope="col">Field</th>
|
|
|
27 |
<th class="header c1" scope="col">Type</th>
|
|
|
28 |
<th class="header c2 lastcol" scope="col">Description</th>
|
|
|
29 |
</tr>
|
|
|
30 |
<xsl:apply-templates>
|
|
|
31 |
<xsl:with-param name="tableid" select="$tableid" />
|
|
|
32 |
</xsl:apply-templates>
|
|
|
33 |
</table>
|
|
|
34 |
</xsl:template>
|
|
|
35 |
|
|
|
36 |
<!-- Each individual field -->
|
|
|
37 |
<xsl:template match="FIELD">
|
|
|
38 |
<xsl:param name="tableid" />
|
|
|
39 |
<xsl:variable name="fieldid"><xsl:value-of select="$tableid"/>_field_<xsl:value-of select="@NAME"/></xsl:variable>
|
|
|
40 |
<xsl:variable name="COUNT" select="count(preceding-sibling::*)"/>
|
|
|
41 |
<tr class="r{$COUNT}">
|
|
|
42 |
<td id="{$fieldid}" class="cell c0"><xsl:value-of select="@NAME"/></td>
|
|
|
43 |
<td class="cell c1" style="white-space: nowrap;">
|
|
|
44 |
<xsl:value-of select="@TYPE"/>
|
|
|
45 |
(<xsl:value-of select="@LENGTH"/><xsl:if test="@DECIMALS">, <xsl:value-of select="@DECIMALS"/></xsl:if>)
|
|
|
46 |
<xsl:if test="@NOTNULL='true'">not null </xsl:if>
|
|
|
47 |
<xsl:if test="@DEFAULT">
|
|
|
48 |
<xsl:choose>
|
|
|
49 |
<xsl:when test="@TYPE='char'">default '<xsl:value-of select="@DEFAULT"/>'</xsl:when>
|
|
|
50 |
<xsl:when test="@TYPE='text'">default '<xsl:value-of select="@DEFAULT"/>'</xsl:when>
|
|
|
51 |
<xsl:otherwise>default <xsl:value-of select="@DEFAULT"/></xsl:otherwise>
|
|
|
52 |
</xsl:choose>
|
|
|
53 |
</xsl:if>
|
|
|
54 |
<xsl:if test="@SEQUENCE='true'">seq</xsl:if>
|
|
|
55 |
</td>
|
|
|
56 |
<td class="cell c2 lastcol"><xsl:call-template name="display-comment"/></td>
|
|
|
57 |
</tr>
|
|
|
58 |
</xsl:template>
|
|
|
59 |
|
|
|
60 |
<!-- Keys (if any): table with key, type, field(s), reference, and comment -->
|
|
|
61 |
<xsl:template match="KEYS[KEY]">
|
|
|
62 |
<h4>Keys</h4>
|
|
|
63 |
<table class="generaltable boxaligncenter" cellspacing="1" cellpadding="5" width="100%">
|
|
|
64 |
<tr>
|
|
|
65 |
<th class="header c0" scope="col">Name</th>
|
|
|
66 |
<th class="header c1" scope="col">Type</th>
|
|
|
67 |
<th class="header c2" scope="col">Field(s)</th>
|
|
|
68 |
<th class="header c3" scope="col">Reference</th>
|
|
|
69 |
<!-- If no keys have comments (which is usually sensible since it's
|
|
|
70 |
completely obvious what they are) then the comment column is not
|
|
|
71 |
included -->
|
|
|
72 |
<xsl:if test="*[normalize-space(@COMMENT)!='']">
|
|
|
73 |
<th class="header c4 lastcol" scope="col">Description</th>
|
|
|
74 |
</xsl:if>
|
|
|
75 |
</tr>
|
|
|
76 |
<xsl:apply-templates/>
|
|
|
77 |
</table>
|
|
|
78 |
</xsl:template>
|
|
|
79 |
|
|
|
80 |
<!-- Individual key -->
|
|
|
81 |
<xsl:template match="KEY">
|
|
|
82 |
<xsl:variable name="COUNT" select="count(preceding-sibling::*)"/>
|
|
|
83 |
<tr class="r{$COUNT}">
|
|
|
84 |
<td class="cell c0"><xsl:value-of select="@NAME"/></td>
|
|
|
85 |
<td class="cell c1"><xsl:value-of select="@TYPE"/></td>
|
|
|
86 |
<td class="cell c2"><xsl:value-of select="@FIELDS"/></td>
|
|
|
87 |
<td class="cell c3">
|
|
|
88 |
<xsl:if test="@REFTABLE">
|
|
|
89 |
<xsl:variable name="tableid">table_<xsl:value-of select="@REFTABLE"/></xsl:variable>
|
|
|
90 |
<a href="#{$tableid}"><xsl:value-of select="@REFTABLE"/></a> (<xsl:value-of select="@REFFIELDS"/>)
|
|
|
91 |
</xsl:if>
|
|
|
92 |
</td>
|
|
|
93 |
<xsl:if test="../*[normalize-space(@COMMENT)!='']">
|
|
|
94 |
<td class="cell c4 lastcol"><xsl:call-template name="display-comment"/></td>
|
|
|
95 |
</xsl:if>
|
|
|
96 |
</tr>
|
|
|
97 |
</xsl:template>
|
|
|
98 |
|
|
|
99 |
<!-- Indexes -->
|
|
|
100 |
<xsl:template match="INDEXES[INDEX]">
|
|
|
101 |
<h4>Indexes</h4>
|
|
|
102 |
<table class="generaltable boxaligncenter" cellspacing="1" cellpadding="5" width="100%">
|
|
|
103 |
<tr>
|
|
|
104 |
<th class="header c0" scope="col">Name</th>
|
|
|
105 |
<th class="header c1" scope="col">Type</th>
|
|
|
106 |
<th class="header c2" scope="col">Field(s)</th>
|
|
|
107 |
<xsl:if test="*[normalize-space(@COMMENT)!='']">
|
|
|
108 |
<th class="header c4 lastcol" scope="col">Description</th>
|
|
|
109 |
</xsl:if>
|
|
|
110 |
</tr>
|
|
|
111 |
<xsl:apply-templates/>
|
|
|
112 |
</table>
|
|
|
113 |
</xsl:template>
|
|
|
114 |
|
|
|
115 |
<!-- Individual index -->
|
|
|
116 |
<xsl:template match="INDEX">
|
|
|
117 |
<xsl:variable name="COUNT" select="count(preceding-sibling::*)"/>
|
|
|
118 |
<tr class="r{$COUNT}">
|
|
|
119 |
<td class="cell c0"><xsl:value-of select="@NAME"/></td>
|
|
|
120 |
<td class="cell c1">
|
|
|
121 |
<xsl:choose>
|
|
|
122 |
<xsl:when test="@UNIQUE='true'">Unique</xsl:when>
|
|
|
123 |
<xsl:otherwise>Not unique</xsl:otherwise>
|
|
|
124 |
</xsl:choose>
|
|
|
125 |
</td>
|
|
|
126 |
<td class="cell c2"><xsl:value-of select="@FIELDS"/></td>
|
|
|
127 |
<xsl:if test="../*[normalize-space(@COMMENT)!='']">
|
|
|
128 |
<td class="cell c4 lastcol"><xsl:call-template name="display-comment"/></td>
|
|
|
129 |
</xsl:if>
|
|
|
130 |
</tr>
|
|
|
131 |
</xsl:template>
|
|
|
132 |
|
|
|
133 |
<xsl:template name="display-comment">
|
|
|
134 |
<xsl:param name="PARA"/>
|
|
|
135 |
<xsl:if test="normalize-space(@COMMENT)!=''">
|
|
|
136 |
<xsl:choose>
|
|
|
137 |
<xsl:when test="$PARA">
|
|
|
138 |
<p class="xmldb_comment"><xsl:value-of select="@COMMENT"/></p>
|
|
|
139 |
</xsl:when>
|
|
|
140 |
<xsl:otherwise>
|
|
|
141 |
<xsl:value-of select="@COMMENT"/>
|
|
|
142 |
</xsl:otherwise>
|
|
|
143 |
</xsl:choose>
|
|
|
144 |
</xsl:if>
|
|
|
145 |
</xsl:template>
|
|
|
146 |
|
|
|
147 |
</xsl:stylesheet>
|