<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns:sd="http://www.microsoft.com/xml">


<xsl:template match="/">
	<html>
		<head>
			<style>
				body {
					color: black;
					font-familty: tahoma, arial;
					font-size: 8pt;
					font-weight: normal;
				}
				th {
					font-familty: tahoma, arial;
					font-size: 8pt;
					font-weight: bold;
					text-align: left;
				}
				td {
					font-familty: tahoma, arial;
					font-size: 8pt;
					font-weight: normal;
				}
				h1 {
					color: black;
					font-familty: tahoma, arial;
					font-size: 12pt;
					font-weight: bold;
				}
				h2 {
					color: black;
					font-familty: tahoma, arial;
					font-size: 10pt;
					font-weight: bold;
				}
				a {
					color: blue;
				}
				a:visited {
					color: blue;
				}
				a:hover {
					color: orange;
				}
			</style>
		</head>
		<body>
			<xsl:apply-templates/>
		</body>
	</html>
</xsl:template>


<xsl:template match="sd:SchemaDoc">
	<!-- Introduction -->
	<h1><xsl:value-of select="sd:comment-Product/sd:comment-ProductName"/> <xsl:value-of select="sd:comment-Product/sd:comment-VersionMajor"/><xsl:if test="sd:comment-Product/sd:comment-VersionMinor[.!='']">.<xsl:value-of select="sd:comment-Product/sd:comment-VersionMinor"/></xsl:if> Active Directory Schema Documentation</h1>
	<h2>About the Active Directory Schema</h2>
	<p>The Active Directory schema is the set of definitions that defines the kinds of objects, and the types of information about those objects, that can be stored in Active Directory. The definitions are themselves stored as objects so that Active Directory can manage the schema objects with the same object management operations used for managing the rest of the objects in the directory.</p>   
	<p>There are two types of definitions in the schema: attributes and classes. Attributes and classes are also referred to as schema objects or metadata.</p>
	<p>Attributes are defined separately from classes. Each attribute is defined only once and can be used in multiple classes. For example, the Description attribute is used in many classes, but is defined once in the schema, assuring consistency.</p>
	<p>Classes, also referred to as object classes, describe the possible directory objects that can be created. Each class is a collection of attributes. When you create an object, the attributes store the information that describes the object. The User class, for example, is composed of many attributes, including Network Address, Home Directory, and so on. Every object in Active Directory is an instance of an object class.</p>
	<h2>About this document</h2>
	<p><xsl:value-of select="sd:comment-Product/sd:comment-ProductDescription"/>. This document lists new classes and attributes that <xsl:value-of select="sd:comment-Product/sd:comment-ProductName"/> <xsl:value-of select="sd:comment-Product/sd:comment-VersionMajor"/><xsl:if test="sd:comment-Product/sd:comment-VersionMinor[.!='']">.<xsl:value-of select="sd:comment-Product/sd:comment-VersionMinor"/></xsl:if> adds to the Active Directory, and explains how they are used, who can modify them and their impact on directory replication.</p>
        
	<!-- Class Index -->
	<h1>Class Index</h1>
	<xsl:for-each select="sd:Class" order-by="sd:CN">
		<a><xsl:attribute name="href">#C<xsl:value-of select="sd:LDAPDisplayName"/></xsl:attribute><xsl:value-of select="sd:CN"/></a>
		<xsl:if test="context()[not(end())]">.</xsl:if>
	</xsl:for-each>
        
	<!-- Attribute Index -->
	<h1>Attribute Index</h1>
	<xsl:for-each select="sd:Attribute" order-by="sd:CN">
		<a><xsl:attribute name="href">#A<xsl:value-of select="sd:LDAPDisplayName"/></xsl:attribute><xsl:value-of select="sd:CN"/></a>
		<xsl:if test="context()[not(end())]">.</xsl:if>
	</xsl:for-each>
        
	<!-- Classes -->
	<h1>Classes</h1>
	<xsl:for-each select="sd:Class" order-by="sd:CN">
		<a><xsl:attribute name="name">C<xsl:value-of select="sd:LDAPDisplayName"/></xsl:attribute></a>
		<h2>Class: <xsl:value-of select="sd:CN"/></h2>
		<table cellpadding="2" cellspacing="0" style="margin-left: 20pt;">
			<tr>
				<th nowrap="1" valign="top">Common Name (CN):</th>
				<td valign="top"><xsl:value-of select="sd:CN"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">LDAP Name:</th>
				<td valign="top"><xsl:value-of select="sd:LDAPDisplayName"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Subclass Of:</th>
				<td valign="top"><xsl:value-of select="sd:SubClassOf"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Possible Superiors:</th>
				<td valign="top">
					<xsl:for-each select="sd:PossSuperiors[not (sd:AttrCommonName)]" order-by=".">
						<xsl:choose>
							<xsl:when test="/sd:SchemaDoc/sd:Class[sd:LDAPDisplayName=context()]">
								<a><xsl:attribute name="href">#C<xsl:value-of/></xsl:attribute><xsl:value-of select="/sd:SchemaDoc/sd:Class[sd:LDAPDisplayName=context()]/sd:CN"/></a>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of/>
							</xsl:otherwise>
						</xsl:choose>
						<br/>
					</xsl:for-each>
					<xsl:for-each select="sd:PossSuperiors/sd:AttrCommonName" order-by=".">
						<xsl:choose>
							<xsl:when test="/sd:SchemaDoc/sd:Class[sd:LDAPDisplayName=context()]">
								<a><xsl:attribute name="href">#C<xsl:value-of/></xsl:attribute><xsl:value-of select="/sd:SchemaDoc/sd:Class[sd:LDAPDisplayName=context()]/sd:CN"/></a>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of/>
							</xsl:otherwise>
						</xsl:choose>
						<br/>
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Required Attributes:</th>
				<td valign="top">
					<xsl:for-each select="sd:MustContain/sd:AttrCommonName" order-by=".">
						<xsl:choose>
							<xsl:when test="/sd:SchemaDoc/sd:Attribute[sd:LDAPDisplayName=context()]">
								<a><xsl:attribute name="href">#A<xsl:value-of/></xsl:attribute><xsl:value-of select="/sd:SchemaDoc/sd:Attribute[sd:LDAPDisplayName=context()]/sd:CN"/></a>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="/sd:SchemaDoc/sd:Attribute[sd:LDAPDisplayName=context()]/sd:CN"/>
							</xsl:otherwise>
						</xsl:choose>
						<br/>
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Optional Attributes:</th>
				<td valign="top">
					<xsl:for-each select="sd:MayContain/sd:AttrCommonName" order-by=".">
						<xsl:choose>
							<xsl:when test="/sd:SchemaDoc/sd:Attribute[sd:LDAPDisplayName=context()]">
								<a><xsl:attribute name="href">#A<xsl:value-of/></xsl:attribute><xsl:value-of select="/sd:SchemaDoc/sd:Attribute[sd:LDAPDisplayName=context()]/sd:CN"/></a>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="/sd:SchemaDoc/sd:Attribute[sd:LDAPDisplayName=context()]/sd:CN"/>
							</xsl:otherwise>
						</xsl:choose>
						<br/>
					</xsl:for-each>
				</td>
			</tr>
			<xsl:if test="/sd:SchemaDoc/sd:Comments/sd:Class[sd:LDAPDisplayName=context()/sd:LDAPDisplayName]">
				<xsl:for-each select="/sd:SchemaDoc/sd:Comments/sd:Class[sd:LDAPDisplayName=context()/sd:LDAPDisplayName]">
					<tr>
						<th nowrap="1" valign="top">Usage:</th>
						<td><xsl:value-of select="sd:comment-usage"/></td>
					</tr>
					<tr>
						<th nowrap="1" valign="top">Update Privilege:</th>
						<td><xsl:value-of select="sd:comment-updatePrivilege"/><xsl:value-of select="sd:comment-updatePrivilege"/></td>
					</tr>
					<tr>
						<th nowrap="1" valign="top">Update Frequency:</th>
						<td><xsl:value-of select="sd:comment-updateFrequency"/></td>
					</tr>
				</xsl:for-each>
			</xsl:if>
			<tr>
				<th nowrap="1" valign="top">Default Object Category:</th>
				<td valign="top"><xsl:value-of select="sd:DefaultObjectCategory"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Object Category:</th>
				<td valign="top"><xsl:value-of select="sd:ObjectCategory"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">RDN Attribute:</th>
				<td valign="top"><xsl:value-of select="sd:RDNAttID"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">OID:</th>
				<td valign="top"><xsl:value-of select="sd:GovernsID"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Schema GUID:</th>
				<td valign="top"><xsl:value-of select="sd:SchemaIDGUID"/></td>
			</tr>
		</table>
		<xsl:if test="context()[not(end())]"><hr/></xsl:if>
	</xsl:for-each>

	<!-- Attributes -->
	<h1>Attributes</h1>
	<xsl:for-each select="sd:Attribute" order-by="sd:CN">
		<a><xsl:attribute name="name">A<xsl:value-of select="sd:LDAPDisplayName"/></xsl:attribute></a>
		<h2>Attribute: <xsl:value-of select="sd:CN"/></h2>
		<table cellpadding="2" cellspacing="0" style="margin-left: 20pt;">
			<tr>
				<th nowrap="1" valign="top">Common Name (CN):</th>
				<td valign="top"><xsl:value-of select="sd:CN"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">LDAP Name:</th>
				<td valign="top"><xsl:value-of select="sd:LDAPDisplayName"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Contained In:</th>
				<td valign="top">
					<xsl:for-each select="/sd:SchemaDoc/sd:Class[(sd:MustContain/sd:AttrCommonName=context()/sd:LDAPDisplayName) or ((sd:MayContain/sd:AttrCommonName=context()/sd:LDAPDisplayName))]" order-by=".">
						<a><xsl:attribute name="href">#C<xsl:value-of select="sd:LDAPDisplayName"/></xsl:attribute><xsl:value-of select="sd:CN"/></a><br/>
					</xsl:for-each>
				</td>
			</tr>
			<xsl:if test="/sd:SchemaDoc/sd:Comments/sd:Attribute[sd:LDAPDisplayName=context()/sd:LDAPDisplayName]">
				<xsl:for-each select="/sd:SchemaDoc/sd:Comments/sd:Attribute[sd:LDAPDisplayName=context()/sd:LDAPDisplayName]">
					<tr>
						<th nowrap="1" valign="top">Usage:</th>
						<td><xsl:value-of select="sd:comment-usage"/></td>
					</tr>
					<tr>
						<th nowrap="1" valign="top">Update Privilege:</th>
						<td><xsl:value-of select="sd:comment-updatePrivilege"/><xsl:value-of select="sd:comment-updatePrivilege"/></td>
					</tr>
					<tr>
						<th nowrap="1" valign="top">Update Frequency:</th>
						<td><xsl:value-of select="sd:comment-updateFrequency"/></td>
					</tr>
					<tr>
						<th nowrap="1" valign="top">Size Estimate (Bytes):</th>
						<td><xsl:value-of select="sd:comment-sizeInBytes"/></td>
					</tr>
				</xsl:for-each>
			</xsl:if>
			<xsl:if test="sd:RangeLower[.!='']">
				<tr>
					<th nowrap="1" valign="top">Low Value:</th>
					<td valign="top"><xsl:value-of select="sd:RangeLower"/></td>
				</tr>
			</xsl:if>
			<xsl:if test="sd:RangeUpper[.!='']">
				<tr>
					<th nowrap="1" valign="top">High Value:</th>
					<td valign="top"><xsl:value-of select="sd:RangeUpper"/></td>
				</tr>
			</xsl:if>
			<tr>
				<th nowrap="1" valign="top">Single Valued:</th>
				<td valign="top"><xsl:value-of select="sd:IsSingleValued"/></td>
			</tr>
			<xsl:if test="sd:IsEphemeral[.!='']">
				<tr>
					<th nowrap="1" valign="top">Ephemeral:</th>
					<td valign="top"><xsl:value-of select="sd:IsEphemeral"/></td>
				</tr>
			</xsl:if>
			<xsl:if test="sd:IsMemberOfPartialAttributeSet[.!='']">
				<tr>
					<th nowrap="1" valign="top">Member Of Partial Attribute Set:</th>
					<td valign="top"><xsl:value-of select="sd:IsMemberOfPartialAttributeSet"/></td>
				</tr>
			</xsl:if>
			<xsl:if test="sd:IsIndexed[.!='']">
				<tr>
					<th nowrap="1" valign="top">Indexed:</th>
					<td valign="top"><xsl:value-of select="sd:IsIndexed"/></td>
				</tr>
			</xsl:if>
			<tr>
				<th nowrap="1" valign="top">Attribute ID:</th>
				<td valign="top"><xsl:value-of select="sd:AttributeID"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Link ID:</th>
				<td valign="top"><xsl:value-of select="sd:LinkID"/></td>
			</tr>
			<tr>
				<th nowrap="1" valign="top">Schema GUID:</th>
				<td valign="top"><xsl:value-of select="sd:SchemaIDGUID"/></td>
			</tr>
			<xsl:if test="sd:AttributeSecurityGUID[.!='']">
				<tr>
					<th nowrap="1" valign="top">Attribute Security GUID:</th>
					<td valign="top"><xsl:value-of select="sd:AttributeSecurityGUID"/></td>
				</tr>
			</xsl:if>
			<tr>
				<th nowrap="1" valign="top">Type:</th>
				<td valign="top">
					<xsl:choose>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.1']">DN</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.2']">OID</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.3']">String (case sensitive)</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.4']">String (case ignored)</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.5']">String (case sensitive)</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.6']">Numeric String</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.7']">ORName</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.8']">Boolean</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.9']">Integer</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.10']">Octet String</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.11']">Time</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.12']">String (case ignored)</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.13']">Presentation Address</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.14']">Access Point DN</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.15']">Security Descriptor</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.16']">Large Integer</xsl:when>
						<xsl:when test="sd:AttributeSyntax[.='2.5.5.17']">SID</xsl:when>
						<xsl:otherwise>
							attributeSyntax=<xsl:value-of select="sd:AttributeSyntax"/>, oMSyntax=<xsl:value-of select="sd:OMSyntax"/>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</table>
		<xsl:if test="context()[not(end())]"><hr/></xsl:if>
	</xsl:for-each>
        
	<!-- Product Information -->
	<xsl:for-each select="sd:comment-Product">
		<h1>Product Information</h1>
		<table cellpadding="2" cellspacing="0">
			<tr><th>Name:</th><td><xsl:value-of select="sd:comment-ProductName"/></td></tr>
			<tr><th>Description:</th><td><xsl:value-of select="sd:comment-ProductDescription"/></td></tr>
			<tr><th>Version:</th><td><xsl:value-of select="sd:comment-VersionMajor"/><xsl:if test="sd:comment-VersionMinor[.!='']">.<xsl:value-of select="sd:comment-VersionMinor"/></xsl:if></td></tr>
		</table>
	</xsl:for-each>
	
	<!-- Vendor Information -->
	<xsl:for-each select="sd:comment-Vendor">
		<h1>Vendor Information</h1>
		<table cellpadding="2" cellspacing="0">
			<tr><th>Name:</th><td><xsl:value-of select="sd:comment-VendorName"/></td></tr>
			<tr><th>Address:</th><td><xsl:value-of select="sd:comment-VendorAddress"/></td></tr>
			<tr><th>City:</th><td><xsl:value-of select="sd:comment-VendorCity"/></td></tr>
			<tr><th>State or Province:</th><td><xsl:value-of select="sd:comment-VendorStateOrProvince"/></td></tr>
			<tr><th>Country:</th><td><xsl:value-of select="sd:comment-VendorCountry"/></td></tr>
			<tr><th>Postal Code:</th><td><xsl:value-of select="sd:comment-VendorPostalCode"/></td></tr>
			<tr><th>Telephone:</th><td><xsl:value-of select="sd:comment-VendorTelephone"/></td></tr>
			<tr><th>E-mail:</th><td><xsl:value-of select="sd:comment-VendorEmail"/></td></tr>
		</table>
	</xsl:for-each>
	
</xsl:template>


</xsl:stylesheet>

