1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2<!--
3     @(#) $Id: xml_schema.xsl,v 1.1 2002/09/05 08:47:58 lsmith Exp $
4  -->
5<xsl:template match="/">
6    <!--  -->
7    <html><head><title>Metabase DB Documentation</title>
8    <STYLE>
9    .titlemini { font-family: Arial, Helvetica, sans-serif; font-size: 15px; font-weight: normal; color: rgb(133, 133, 133); text-decoration: none; letter-spacing: 1px; line-height: 95%; }
10    .textmini { font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: normal; color: rgb(133, 133, 133); text-decoration: none; }
11    .tablemain { border: solid 0px; margin: solid 0px; }
12    .tableheader { padding: 3px; border: solid 0px; margin: 0px; background-color: rgb(235, 235, 235); font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: rgb(133, 133, 133); font-weight: bold; text-decoration: none; }
13    .tablebody { padding: 3px; border-top: solid 1px; border-left: solid 1px; border-bottom: solid 1px; border-right: solid 1px; border-color: rgb(210, 210, 210); margin: solid 0px; font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: rgb(133, 133, 133); text-decoration: none; }
14    </STYLE>
15    </head>
16    <body>
17    <!-- -->
18    <br/><span class="titlemini">database
19    <xsl:value-of select="/database/name"/></span><br/><br/>
20    <TABLE class="tablemain">
21    <xsl:for-each select="/database/table">
22        <xsl:call-template name="showtable"/>
23    </xsl:for-each>
24    </TABLE>
25    <!-- -->
26    </body></html>
27    <!-- -->
28</xsl:template>
29
30<xsl:template name="showtable">
31    <tr><td colspan="4" class="tableheader"> <span class="titlemini">table
32        <xsl:value-of select="name"/></span> </td></tr>
33    <tr><td colspan="4"><span class="textmini">
34        <xsl:value-of select="comment"/></span></td></tr>
35
36    <tr><td class="tableheader">field</td>
37    <td class="tableheader">type</td>
38    <td class="tableheader">comment</td>
39    <td class="tableheader">attributes</td>
40    </tr>
41
42    <xsl:for-each select="descendant::declaration/field">
43        <xsl:call-template name="showfield"/>
44    </xsl:for-each>
45
46    <tr><td colspan="2" height="18">  </td> </tr>
47</xsl:template>
48
49<xsl:template name="showfield">
50    <tr><td class="tablebody"><span class="textmini">
51    <xsl:value-of select="name"/></span></td>
52    <td class="tablebody"><span class="textmini">
53    <xsl:value-of select="type"/>
54    <xsl:for-each select="descendant::length"><xsl:call-template name="showlength"/>
55    </xsl:for-each>
56    </span></td>
57
58    <td class="tablebody"><span class="textmini">
59    <xsl:value-of select="comment"/></span></td>
60
61    <td class="tablebody"><span class="textmini">
62    <xsl:for-each select="descendant::default"><xsl:call-template name="showdefault"/>
63    </xsl:for-each>
64
65    <xsl:for-each select="descendant::notnull"><xsl:call-template name="shownotnull"/>
66    </xsl:for-each>
67
68    <xsl:variable name="curfield" select="current()/name"/>
69
70    <xsl:for-each select="following-sibling::index">
71         <xsl:if test="$curfield=field/name">
72         <br/>index <xsl:value-of select="name"/>
73            <xsl:if test="unique"> unique</xsl:if>
74         </xsl:if>
75
76    </xsl:for-each>
77
78    </span></td>
79
80    </tr>
81</xsl:template>
82
83<xsl:template name="showlength">(<xsl:value-of select="//length"/>)
84</xsl:template>
85
86<xsl:template name="showdefault">
87    default=<xsl:value-of select="//default"/>
88</xsl:template>
89
90<xsl:template name="shownotnull">
91    notnull=<xsl:value-of select="//notnull"/>
92</xsl:template>
93
94</xsl:stylesheet>
95