<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet[
<!ENTITY nbsp "&#160;">
]>
<!--
 
 toguidelines.xsl Version 0.8 2004-12-10
 This stylesheet transforms documents encoded in the 
 Best Practice Rules DTD Version 0.8 into an html document
 that describes the rules.
 Copyright (C) 2004 Aziza Technology Associates, LLC Pittsburgh, PA 
 http://www.azizatech.com
 This program is free software; you can redistribute it and/or modify 
 it under the terms of the Mozilla Public License available at 
http://www.mozilla.org/MPL/

 This program is distributed in the hope that it will be useful, 
 but WITHOUT ANY WARRANTY; without even the implied warranty of 
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="html" indent="yes"/>
	<xsl:template match="/">
	<html>
		<head>
			<title>RLG  Best Practice Guidelines for Encoded Archival Description</title>
		</head>
		<body>
		<h2>RLG  Best Practice Guidelines for Encoded Archival Description</h2>
		<xsl:apply-templates/>
		</body>
	</html>
	</xsl:template>


<xsl:template match="//group">
		<h2>
			<xsl:value-of select="title"/>
		</h2>
		<table border="1" width="100%">
			<tbody>
				<tr>
					<th width="20%">Element Location</th>
					<th width="15%">Attributes or Child Elements</th>
					<th width="5%">Status</th>
					<th width="30%">Application Notes</th>
					<th width="15%">Possible Values</th>
					<th width="15%">Conditions</th>
				</tr>
				
					<xsl:for-each select="element">
					<tr><td>
						<xsl:choose>
						<xsl:when test="@context"><xsl:value-of select="@context"/>
</xsl:when><xsl:otherwise><xsl:value-of select="@path"/></xsl:otherwise>
					</xsl:choose>&nbsp;</td>
					<td>&nbsp;&nbsp;</td>
					<td><xsl:value-of select="@status"/>&nbsp;</td>
					<td><xsl:value-of select="appnotes"/>&nbsp;</td>
					<td>&nbsp;&nbsp;</td>
					<td><xsl:value-of select="@test"/>&nbsp;</td>
					
					</tr>
					<xsl:apply-templates select="children"/>
					<xsl:apply-templates select="attribute"/>
					<xsl:apply-templates select="option"/>
					
					</xsl:for-each>
					
					</tbody>
					</table>
					
					</xsl:template>
					<xsl:template match="attribute">

					<tr><td>
						<!--<xsl:choose>
						<xsl:when test="ancestor::element/@context"><xsl:value-of select="ancestor::element/@context"/>
</xsl:when><xsl:otherwise><xsl:value-of select="ancestor::element/@path"/></xsl:otherwise>
					</xsl:choose>-->&nbsp;</td>
					<td>&nbsp;&nbsp;<xsl:value-of select="@name"/> =&nbsp;</td>
					<td><xsl:value-of select="@status"/>&nbsp;</td>
					<td><xsl:value-of select="appnotes"/>&nbsp;</td>
                         <td><xsl:choose><xsl:when test="values/@type='single'">Set to '<xsl:value-of select="values/value"/>'</xsl:when>
<xsl:when test="values/@type='pattern' and values/@standard">Use <xsl:value-of select="values/@standard"/></xsl:when>
<xsl:when test="values/@type='cdata'">cdata</xsl:when>
<xsl:when test="values/@type='multi'">Possible values: <br/> <xsl:for-each select="values/value"><xsl:if test="@crosswalk"><xsl:value-of select="@crosswalk"/>: </xsl:if><xsl:value-of select="."/><br/></xsl:for-each>&nbsp;
					</xsl:when>																									</xsl:choose>
                        </td> <td><xsl:value-of select="@test"/>
                        &nbsp;</td>


					</tr>
					</xsl:template>
<xsl:template match="option">
<tr><td><xsl:choose>
						<xsl:when test="ancestor::element/@context"><xsl:value-of select="ancestor::element/@context"/>
</xsl:when><xsl:otherwise><xsl:value-of select="ancestor::element/@path"/></xsl:otherwise>
					</xsl:choose>&nbsp;</td>
<td>Include one of: <xsl:for-each select="attribute"><br/> &nbsp;<xsl:value-of select="@name"/>=</xsl:for-each> </td>
<td><xsl:value-of select="@status"/>&nbsp;</td>
<td><xsl:value-of select="appnotes"/>&nbsp;</td>
					<td>Attributes ; <xsl:for-each select="attribute"><br/><xsl:value-of select="@name"/></xsl:for-each>&nbsp;</td>
					<td>&nbsp;</td>
					
					</tr>
 
</xsl:template>
<xsl:template match="children">
<tr><td>
						<xsl:choose>
						<xsl:when test="ancestor::element/@context"><xsl:value-of select="ancestor::element/@context"/>
</xsl:when><xsl:otherwise><xsl:value-of select="ancestor::element/@path"/></xsl:otherwise>
					</xsl:choose>&nbsp;</td>
					<td><xsl:value-of select="@include"/><br/><xsl:for-each select="child"><xsl:value-of select="."/> <xsl:if test="position() != last()"><xsl:choose>
	<xsl:when test="ancestor::children/@include='oneof'"> or </xsl:when>
	<xsl:when test="ancestor::children/@include='all' or ancestor::children/@include='include'"> and </xsl:when>
</xsl:choose> </xsl:if></xsl:for-each>&nbsp;</td>
					<td><xsl:value-of select="@status"/>&nbsp;</td>
					<td><xsl:value-of select="appnotes"/>&nbsp;</td>
					<td><xsl:for-each select="child"><xsl:value-of select="."/> <xsl:if test="position() != last()"><xsl:choose>
	<xsl:when test="ancestor::children/@include='oneof'"> or </xsl:when>
	<xsl:when test="ancestor::children/@include='all' or ancestor::children/@include='include'"> and </xsl:when>
</xsl:choose> </xsl:if></xsl:for-each>&nbsp;</td>
					<td>&nbsp;&nbsp;</td>
					

	</tr>

</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2004. Sonic Software Corporation. All rights reserved.
<metaInformation>
<scenarios/><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->