Click here to Skip to main content
15,891,905 members
Articles / Programming Languages / Visual Basic

DBdoc: automated CHM documentation for a SQL Server 2000 database

Rate me:
Please Sign up or sign in to vote.
4.84/5 (39 votes)
14 Nov 200615 min read 175.6K   1.8K   163  
A tool to generate CHM documentation files for SQL Server 2000 databases
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="ROOT">
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="PageHeader" />
<xsl:template match="PageFooter" />
<xsl:template match="ObjectName" />
<xsl:template match="USEDBY_OBJECTS/USEDBY_P" />
<xsl:template match="USEDBY_OBJECTS/USEDBY_F" />
<xsl:template match="USEDBY_OBJECTS/USEDBY_TR" />
<!--xsl:template match="USEDBY_OBJECTS/USEDBY_V" /-->


<xsl:template match="DOC">
<html dir="ltr">
	<head>
		<title><xsl:value-of select="../ObjectName"/><xsl:text> </xsl:text>Table</title>
		<link rel="stylesheet" type="text/css" href="MSDN.css"/>
	</head>
	<body id="bodyID" class="dtBODY">
		<div id="nsbanner">
			<div id="bannerrow1">
				<table class="bannerparthead" cellspacing="0">
					<tr id="hdr">
						<td class="runninghead"><xsl:value-of select="../PageHeader" disable-output-escaping="yes"/></td>
					</tr>
				</table>
			</div>
			<div id="TitleRow">
				<h1 class="dtH1"><xsl:value-of select="../ObjectName"/><xsl:text> </xsl:text><span class="dtH1small">Table</span></h1>
			</div>
		</div>
		<div id="nstext">

			<xsl:if test="SUMMARY">
				<xsl:value-of select="SUMMARY" disable-output-escaping="yes"/>
			</xsl:if>
			
<!-- TODO -->
			<h4 class="dtH4">Table Columns</h4>
			<div class="tablediv">
				<table class="dtTABLE" cellspacing="0" ID="Table1">
					<tr valign="top">
						<th width="20%">Name</th>
						<th width="10%">Datatype</th>
						<th width="70%">Description</th>
					</tr>
					<xsl:for-each select="COLUMN">
						<tr valign="top">
							<td width="20%">
								<xsl:value-of select="./@name"/>
							</td>
							<td width="10%" nowrap="">
								<xsl:value-of select="./@datatype"/>
							</td>
							<td width="70%">
								<xsl:value-of select="." disable-output-escaping="yes"/>
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</div>

			<p/>
			
<!-- TODO: verify -->

			<!--xsl:if test="../USEDBY_OBJECTS/USEDBY_V">
				<h4 class="dtH4">Referenced by these Views</h4>
				<ul type="disc">
					<xsl:for-each select="../USEDBY_OBJECTS/USEDBY_V">
						<li>
							<xsl:element name="A">
								<xsl:attribute name="href">
									<xsl:value-of select="./@href"/>
								</xsl:attribute>
								<xsl:value-of select="."/>
							</xsl:element>	
						</li>
					</xsl:for-each>
				</ul>
			</xsl:if-->
			
			<xsl:if test="../USEDBY_OBJECTS/USEDBY_P">
				<h4 class="dtH4">Referenced by these Stored Procedures</h4>
				<ul type="disc">
					<xsl:for-each select="../USEDBY_OBJECTS/USEDBY_P">
						<li>
							<xsl:element name="A">
								<xsl:attribute name="href">
									<xsl:value-of select="./@href"/>
								</xsl:attribute>
								<xsl:value-of select="."/>
							</xsl:element>	
						</li>
					</xsl:for-each>
				</ul>
			</xsl:if>

			<xsl:if test="../USEDBY_OBJECTS/USEDBY_F">
				<h4 class="dtH4">Referenced by these User Defined Functions</h4>
				<ul type="disc">
					<xsl:for-each select="../USEDBY_OBJECTS/USEDBY_F">
						<li>
							<xsl:element name="A">
								<xsl:attribute name="href">
									<xsl:value-of select="./@href"/>
								</xsl:attribute>
								<xsl:value-of select="."/>
							</xsl:element>	
						</li>
					</xsl:for-each>
				</ul>
			</xsl:if>

			<xsl:if test="../USEDBY_OBJECTS/USEDBY_TR">
				<h4 class="dtH4">Referenced by these Triggers</h4>
				<ul type="disc">
					<xsl:for-each select="../USEDBY_OBJECTS/USEDBY_TR">
						<li>
							<xsl:element name="A">
								<xsl:attribute name="href">
									<xsl:value-of select="./@href"/>
								</xsl:attribute>
								<xsl:value-of select="."/>
							</xsl:element>	
						</li>
					</xsl:for-each>
				</ul>
			</xsl:if>
			
			<hr/>
			
			<div id="footer">
				<p><xsl:value-of select="../PageFooter" disable-output-escaping="yes"/></p>
			</div>
			
		</div>
	</body>
</html>

</xsl:template>

</xsl:stylesheet>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Technical Lead
Italy Italy
I was born in 1970.

My first computer experience dates back to early 80s, with a Sinclair ZX81.
From that time on, as many "friends" say, my IT-illness has increased year by year.

I graduated in Electronic Engineering and earned the following Microsoft certifications:
MCP, MCT, MCDBA, MCSD, MCAD, MCSD for .NET (early achiever).

I worked in IT as a developer, a teacher, a consultant, a technical writer, a technical leader.
IT knowledge applied to real life is my primary interest and focus.

Comments and Discussions