Click here to Skip to main content
15,879,474 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 174.5K   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="Syntax" />
<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="USES_OBJECTS/USES_P" />
<xsl:template match="USES_OBJECTS/USES_F" />
<xsl:template match="USES_OBJECTS/USES_T" />
<xsl:template match="USES_OBJECTS/USES_V" />


<xsl:template match="DOC">
<html dir="ltr">
	<head>
		<title><xsl:value-of select="../ObjectName"/><xsl:text> </xsl:text>In-Line Function</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">In-Line Function</span></h1>
			</div>
		</div>
		<div id="nstext">

			<xsl:if test="SUMMARY">
				<xsl:value-of select="SUMMARY"/>
			</xsl:if>

			<div class="syntax">
				<xsl:value-of select="../Syntax" disable-output-escaping="yes"/>
			</div>
			
			<xsl:if test="PARAM_IN">
				<h4 class="dtH4">Input Parameters</h4>
				<dl>
					<xsl:for-each select="PARAM_IN">
						<dt><i><xsl:value-of select="./@name"/></i></dt>
						<dd><xsl:value-of select="."/></dd>
					</xsl:for-each>
				</dl>
			</xsl:if>

			<xsl:if test="RETURN_RES">
				<h4 class="dtH4">Returned Resultset</h4>
				<xsl:value-of select="RETURN_RES"/>
			</xsl:if>

			<p/>
			
			<xsl:if test="REMARKS">
				<h4 class="dtH4">Remarks</h4>
				<xsl:value-of select="REMARKS"/>
			</xsl:if>
			
			<p/>
			
			<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>

			<xsl:if test="../USES_OBJECTS/USES_P">
				<h4 class="dtH4">References these Stored Procedures</h4>
				<ul type="disc">
					<xsl:for-each select="../USES_OBJECTS/USES_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="../USES_OBJECTS/USES_F">
				<h4 class="dtH4">References these User Defined Functions</h4>
				<ul type="disc">
					<xsl:for-each select="../USES_OBJECTS/USES_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="../USES_OBJECTS/USES_T">
				<h4 class="dtH4">References these Tables</h4>
				<ul type="disc">
					<xsl:for-each select="../USES_OBJECTS/USES_T">
						<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="../USES_OBJECTS/USES_V">
				<h4 class="dtH4">References these Views</h4>
				<ul type="disc">
					<xsl:for-each select="../USES_OBJECTS/USES_V">
						<li>
							<xsl:value-of select="."/>
						</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