<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
	<!ENTITY pub.date "June 1, 2002">
	<!ENTITY mdash "--">
	<!ENTITY nbsp "&#160;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<!-- 
ALL HTML TAGS MUST BE LOWERCASE and conform to XHTML and should use double-quotes for all attribute values for consistency and to make building entity references easier.  -->
	<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>
	<!-- *********************** BUILD HTML CONTAINER (SKELETON)  ******************************* -->
	<xsl:template match="document">
		<html>
			<!-- ======================== HTML HEADER ===================== -->
			<head>
				<title>
					<xsl:value-of select="docinfo/title"/>
				</title>
				<link rel="stylesheet" type="text/css" href="simple_doc.css"/>
			</head>
			<body leftmargin="0" rightmargin="0" topmargin="0" marginwidth="0" marginheight="0">
				<table id="header" border="0" cellpadding="5" cellspacing="0" width="100%" height="29">
					<tr bgcolor="#000000">
						<td id="navBar" valign="top" align="right">
							<a name="top"/>
							<span class="barNavMenu">
								<a class="barNavLink" href="../map.html">Site Map</a> | <a class="barNavLink" href="../main.html">Home</a>
							</span></td>
					</tr>
				</table>
				<!-- END HTML HEADER -->
				<!-- ============ CONTENT AREA: All content goes inside the div section in table below.  =================== -->
				<table id="contentArea" border="0" cellpadding="10" cellspacing="0" width="625" height="0">
					<tr>
						<td valign="top" align="left">
							<!-- Next line is for page or doc title headline. -->
							<span class="titleHead">
								<xsl:value-of select="docinfo/title"/>
								<br/>
							</span>
							<hr size="1" color="#800000" align="left" width="337px"/>
							<span id="byline">By Steve Hoenisch<br/>
Last updated on &pub.date; | Search this page: <kbd>Ctrl+F</kbd>
								<br/>
								<a href="simple_doc.pdf">View this Document in PDF <img border="0" src="pdf.gif" align="top" width="17" height="18"/>
								</a>
								<br/>
								<hr size="1" color="#800000" align="left" width="337px"/>
							</span>
							<!-- ============ Contents besides standing content and page header go inside the following div. ========= -->
							<div id="contents">
								<xsl:apply-templates select="body"/>
							</div>
							<!-- doc-specific contents should end before the above div tag. -->
						</td>
					</tr>
				</table>
				<!-- ============================= END CONTENT AREA ====================================== -->
				<!-- ============ HTML FOOTER ============ -->
				<table id="footer" border="0" cellpadding="10" cellspacing="0" width="100%" height="0" bgcolor="#CCCCAA">
					<tr>
						<td width="98%" valign="top" align="right">
							<hr size="1" color="#800000"/>
							<span id="botLinks">
								<a href="#top">
									<img border="0" src="to_top.gif" width="9" height="6"/>
								</a>
								<a href="#top"> Top</a> | <a href="../map.html"> Site Map</a> | <a href="../main.html">Home</a>
							</span>
						</td>
						<td width="2%" valign="top" align="right">&nbsp;</td>
					</tr>
				</table>
				<!-- END HTML FOOTER -->
			</body>
		</html>
	</xsl:template>
	<!-- *********************** END BUILD HTML CONTAINER ******************************* -->

	<!-- *********************** BUILD BODY, INCLUDING Table of Contents  ******************************* -->
	<xsl:template match="body">
		<h1>
			<a name="contents">Table of Contents</a>
		</h1>
		<xsl:call-template name="toc"/>
		<xsl:apply-templates select="div1"/>
	</xsl:template>
	
	<xsl:template match="div1/head">
		<hr size="1" color="brown"/>
		<h1>
			<xsl:call-template name="head"/>
		</h1>
	</xsl:template>
	<xsl:template match="div2/head">
		<h2>
			<xsl:call-template name="head"/>
		</h2>
	</xsl:template>
	<xsl:template match="div3/head">
		<h3>
			<xsl:call-template name="head"/>
		</h3>
	</xsl:template>
	<xsl:template match="div4/head">
		<h4>
			<xsl:call-template name="head"/>
		</h4>
	</xsl:template>
	<xsl:template match="div5/head">
		<h5>
			<xsl:call-template name="head"/>
		</h5>
	</xsl:template>
	<xsl:template match="div6/head">
		<h6>
			<xsl:call-template name="head"/>
		</h6>
	</xsl:template>
	
	<xsl:template name="head">
		<xsl:for-each select="..">
			<xsl:call-template name="insertID"/>
			<xsl:apply-templates select="." mode="number"/>
		</xsl:for-each>
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="div1">
		<xsl:apply-templates/>
	</xsl:template>

	<!-- ========= XHTML Quick Print Module for low-lying elements ======================== -->
	<xsl:template match="p | code | a | cite |  em | b">
		<xsl:copy>
			<xsl:for-each select="@* ">
				<xsl:copy/>
			</xsl:for-each>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>

	<!-- ************************ NOTE ****************************** -->
	<!-- This note template is for inline notes that are to be set off with emphasis.  -->
	<xsl:template match="note">
		<div class="note" style="background: #DFDFDF; padding: 0.5em; width: 575; border: 0.1px solid none;">
			<xsl:apply-templates/>
		</div>
	</xsl:template>
	<!-- ================= IMAGES ================= -->
	<xsl:template match="img">
		<xsl:copy>
			<xsl:for-each select="@* ">
				<xsl:copy/>
			</xsl:for-each>
			<xsl:apply-templates/>
			<br/>
		</xsl:copy>
	</xsl:template>
	
	<!-- ======= TRANSCLUSION CONSTRUCT ## used to include referenced topic, p, or other elements and their children 
of another document in the one being generated.  =================== -->
	<!-- TEMPLATE FOR INCLUDEREF TEMPLATE RULE; insert this in doc being generated at level of topic, p, note, or list:
<includeRef href="intranet.xml" nodeRef="p" refid="Transfer"/>  
-->
	<xsl:template match="includeRef">
		<xsl:variable name="refid">
			<xsl:value-of select="@refid"/>
		</xsl:variable>
		<xsl:copy-of select="document(@href)//*[@id=$refid]"/>
	</xsl:template>

	<!-- ========================= MACROS ETC. ============================= -->
	<xsl:template name="toc">
		<xsl:for-each select="/document/body/div1">
			<xsl:call-template name="makeref"/>
			<br/>
			<xsl:for-each select="div2">
				<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
				<xsl:call-template name="makeref"/>
				<br/>
				<xsl:for-each select="div3">
					<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
					<xsl:call-template name="makeref"/>
					<br/>
					<xsl:for-each select="div4">
						<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
						<xsl:call-template name="makeref"/>
						<br/>
						<xsl:for-each select="div5">
							<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
							<xsl:call-template name="makeref"/>
							<br/>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:for-each>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="insertID">
		<xsl:choose>
			<xsl:when test="@id">
				<a name="{@id}"/>
			</xsl:when>
			<xsl:otherwise>
				<a name="section-{translate(head,' ','-')}"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="makeref">
		<xsl:apply-templates select="." mode="number"/>
		<xsl:choose>
			<xsl:when test="@id">
				<a href="#{@id}">
					<xsl:value-of select="head"/>
				</a>
			</xsl:when>
			<xsl:otherwise>
				<a href="#section-{translate(head,' ','-')}">
					<xsl:value-of select="head"/>
				</a>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>



	<!-- ========  NUMBERING ELEMENTS IN BODY ======== -->
	<xsl:template mode="number" match="*">
		<xsl:number level="multiple" count="div1 |div2 | div3 | div4 | div5 | div6" format="1.1 "/>
	</xsl:template>
</xsl:stylesheet>
