db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Baker" <gary.ba...@movielink.com>
Subject Style sheet for your torque XML file (an alternative to [project-name]-schema.html)
Date Tue, 30 Sep 2003 02:16:21 GMT
OK.  This is the last one.  I promise.  This one has fk fields that are
linked and have the mouse-over feature from the torque report.

-Gary

PS:  maybe this can get included in the torque distribution?? Anyone?


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html>
            <header>
                <title>xms-schema</title>
                <style>
                    .normalFont {
                    font-family: Verdana; font-size: 10pt;
                    }
                </style>
            </header>
            <body class="normalFont">
                <xsl:apply-templates />
            </body>
        </html>
    </xsl:template>
    <xsl:template match="database">
        <table border="1" cellspacing="0" cellpadding="0">
            <tr bgcolor="#CCCCCC">
                <th class="normalFont">Table Name</th>
                <th class="normalFont">Description</th>
            </tr>
            <xsl:for-each select="table">
                <tr>
                    <td><a href="#{@name}"><xsl:value-of
select="@name"/></a></td>
                    <td><xsl:value-of select="@description"/></td>
                </tr>
            </xsl:for-each>
        </table>
        <xsl:apply-templates select="table"/>
    </xsl:template>
    <xsl:template match="table">
        <a name="{@name}"/>
        <h2><xsl:value-of select="@name"/></h2>
        <table border="1" cellspacing="0">
            <tr bgcolor="#CCCCCC">
                <th>Name</th>
                <th>Type</th>
                <th>Size</th>
                <th>Default</th>
                <th>PK</th>
                <th>FK</th>
                <th>not null</th>
                <th>Description</th>
            </tr>
            <xsl:apply-templates select="column"/>
        </table>
    </xsl:template>
    <xsl:template match="column">
        <tr>
            <td id="{../@name}.{@name}"><b><xsl:value-of
select="@name"/></b></td>
            <td align="right"><xsl:value-of select="@type"/>  </td>
            <td><xsl:value-of select="@size"/></td>
            <td><xsl:value-of select="@default"/></td>
            <td align="center"><xsl:if
test="string(@primaryKey)='true'">X</xsl:if></td>
            <td align="center">
                <xsl:if test="../foreign-key/reference/@local=@name">
                    <xsl:variable name="fk"
select="concat(string(../foreign-key/reference[@local=current()/@name]/.
./@foreignTable),'.',string(../foreign-key/reference[@local=current()/@n
ame]/@foreign))"/>
                    <a href="#{$fk}" title="Foreign key from {$fk}">
                        X
                    </a>
                </xsl:if>
            </td>
            <td align="center"><xsl:if
test="string(@required)='true'">X</xsl:if></td>
            <td><xsl:value-of select="@description"/></td>
        </tr>
    </xsl:template>
</xsl:stylesheet>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message