<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet[
<!ENTITY nbsp "&#160;">
]>

<!--This stylesheet takes a set of rules encoded in the rules dtd and transforms them into a stylesheet  that processes a document instance against those rules.
It takes the parameter  "output" set to 'dynamic' or 'static'. The default is 'dynamic'
If set to dynamic it outputs a stylesheet that will transfrom for an online or java applet version. If set to static it outputs a stylesheet that can be used in a desktop application that creates static documents.

This can process any set of rules captured in the rules dtd 
(http://www.azizatech.com/rules/rules.dtd)Version 0.8
and generate a stylesheet to process a document instance.

The following parameters will be specified in the outpput of this transformation. You can either alter them here or submit them as parameters to the stylesheet that results from this transformation
$all = yes By default this will test against all guidelines (M, MA, Req, Opt, Rec). If  switched to 'no' only  those elements and attributes codified as M, MA and Req will be processed.
$sourcedoc=  In static mode provides the name of the document that contains the html view of the source file transformed using 'verbid.xsl' . This is used to provide links from thetext mode. Do not set if using the dynamic mode.

Dynamic mode uses 'verbid.xsl' to put an html version of the document instance in a hidden div. It uses javascript to View Context in an alternate target frame or window called targetArea1.
 
In the template named 'valuesreport' a EAD specific routine to identify crosswalks is generated. If you want to use other crosswalks modify accordingly
Title information  in both the <head><title> element and in the <h2/> is captured using the eadheader//titleproper. For other documents you may alter to an appropriate Xpath 

 
 createstyles.xsl Version 0.8 2004-12-10
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:axsl="http://www.w3.org/1999/XSL/TransformAlias">
	<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!--determines whether stylesheet output is for dynamic or static mode -->
<xsl:param name="output">dynamic</xsl:param>

<xsl:param name="date">unknown</xsl:param>
	<xsl:template match="/">
		<axsl:stylesheet version="1.0">
<xsl:if test="$output='dynamic'"><axsl:import href="verbid.xsl"/>
</xsl:if>		
			<axsl:output method="html"/>
	<xsl:comment>
	This stylesheet was generated automatically from 'creatstyles.xsl'.
	Last modified <xsl:value-of select="$date"/>.
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. 
 

	This stylesheet produces a version that can be used in a <xsl:value-of select="$output"/> implementation. 
You can specify the values of the parameters at the commandline or through a parameter fed through a form to the XSLT processor.
$all = yes By default this will test against all guidelines (M, MA, Req, Opt, Rec). If  switched to 'no' only  those elements and attributes codified as M, MA and Req will be processed.
<xsl:if test="$output='static'">$sourcedoc=  In static mode provides the name of the document that contains the html view of the source file transformed using 'verbid.xsl' . This is used to provide links from the View Context mode. Do not set if using the dynamic mode.</xsl:if>

<xsl:if test="$output='dynamic'">
$sourcedoc is ignored in the dynamic version</xsl:if>

This stylesheet was generated automatically from 'createbpgstyles.xsl' by <xsl:value-of select="system-property('xml:vendor')"/> URL <xsl:value-of select="system-property('xml:vendor-url')"/> 
</xsl:comment>		
			
					<!--By default this will test against all guidelines (M, MA, Req, Opt, Rec). If  switched to 'no' only M, MA and Req will be processed  -->
			<axsl:param name="all">yes</axsl:param>
			
			<!-- change this parameter to the Xpath of your document title or other identifying mark  -->
			<axsl:param name="doctitle">//eadheader//titleproper</axsl:param>
	<!-- The parameter provides the name of the document that contains the html view of the source file transformed using 'verbid.xsl' used only in static mode-->

			<axsl:param name="sourcedoc">source.html</axsl:param>


			<axsl:template match="/">
				<html>
					<head>
				
						<title>Report for <axsl:value-of><xsl:attribute name="select">//eadheader//titleproper</xsl:attribute></axsl:value-of></title>
							
							
							   <style>
.appnotes {
position:absolute;
width:300px;
height:300px;
color:blue;
background-color:#FDF5E6;
text-align:center;
visibility:hidden;
z-index:10;
}
</style>
<script language="JavaScript">
<axsl:comment> 
//Begin
function getAppNotes(appnotes) {

msg=window.open("","msg","height=300,width=300,left=80,top=80 resizable=yes scrollbar=yes");
msg.document.write(document.getElementById(appnotes).innerHTML);
msg.document.close();
msg.focus();
   }
   function writeSource(sourcediv)
    {

     
      var title="Finding Aid Source Document";
      var doc=parent.targetArea1.document;      
      doc.open();
      doc.write("&lt;h3&gt;" + title + "&lt;/h3&gt;");

    
      doc.write(document.getElementById(sourcediv).innerHTML);
               doc.close();   
     //   top.targetArea1.location.href=  "#" + location; 
    }

 
//  End </axsl:comment>
</script>


										</head>
<body><xsl:if test="$output='dynamic'"><xsl:attribute name="onload">writeSource('source')</xsl:attribute></xsl:if>
						<h4>Report for <axsl:value-of><xsl:attribute name="select">//eadheader//titleproper</xsl:attribute></axsl:value-of></h4>
						<axsl:choose>
							<axsl:when test="$all='yes'">
								<p>Reporting both Mandatory and Optional Guidelines</p>
							</axsl:when>
							<axsl:otherwise><p>Reporting Only Mandatory Guidelines</p></axsl:otherwise>
						</axsl:choose>
						<xsl:apply-templates/>
					<xsl:if test="$output='dynamic'"><div><axsl:attribute name="class">appnotes</axsl:attribute><axsl:attribute name="id">source</axsl:attribute><axsl:apply-templates mode="verb" select="."/></div></xsl:if>
					</body>
				</html>
			</axsl:template>
			<axsl:template name="getcontext">
			<axsl:choose>
					<axsl:when test="name(..) ='ead'"><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id()"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a></axsl:when>
					<axsl:when test="name()= 'did'"><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id(..)"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a>
</axsl:when>
					<axsl:when test="name(..)= 'did'"><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id(../..)"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a>
</axsl:when>
<axsl:when test="name(../..) ='did'"><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id(../../..)"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a>
</axsl:when>

<axsl:when test="name(..) ='eadheader'"><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id(..)"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a>
</axsl:when>
<axsl:when test="name(../..) ='archdesc' and name(..)='did'"><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id(..)"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a>
</axsl:when>
<axsl:otherwise><br/><a><axsl:attribute name="onclick">writeSource('<axsl:value-of select="generate-id(..)"/>')</axsl:attribute><axsl:attribute name="style">color:red;text-decoration:underline;cursor:pointer;cursor:hand</axsl:attribute>View Context</a>
</axsl:otherwise>

</axsl:choose>	
					</axsl:template>
					<axsl:template name="getStaticLink">
<a><axsl:attribute name="href"><axsl:value-of select="$sourcedoc"/>#<axsl:value-of select="generate-id()"/></axsl:attribute><axsl:attribute name="target">targetArea1</axsl:attribute>
View Context</a> 
</axsl:template>	
		</axsl:stylesheet>
	</xsl:template>
	<xsl:template match="//group">
		<h2>
			<xsl:value-of select="title"/>
		</h2>
		<table border="1" width="100%" rules="all">
			<tbody><tr>
					<th width="20%">Element Location</th>
					<th width="15%">Attributes or Child Elements</th>
					<th width="5%">Status</th>
					<th width="40%">Application Notes</th>
					<th width="20%">Possible Values</th>
									</tr>
				
					<xsl:for-each select="element">
						<xsl:choose>
							<xsl:when test="@test">
								<axsl:choose>
									<axsl:when>
										<xsl:attribute name="test"><xsl:value-of select="@test"/></xsl:attribute>
										<xsl:call-template name="checkelements"/>
									</axsl:when>
									<axsl:otherwise>
</axsl:otherwise>
								</axsl:choose>
							</xsl:when>
							<xsl:otherwise>
								<xsl:call-template name="checkelements"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				
			</tbody>
		</table>
	</xsl:template>
	<xsl:template name="getoptions">
		<xsl:for-each select="option">
			<xsl:choose>
				<xsl:when test="@type='oneof'">
					<axsl:choose>
						<axsl:when>
							<xsl:attribute name="test"><xsl:for-each select="attribute">@<xsl:value-of select="@name"/><xsl:if test="position() != last()"> or </xsl:if></xsl:for-each></xsl:attribute>
						</axsl:when>
						<axsl:otherwise>
							<xsl:call-template name="report">
								<xsl:with-param name="path">
									<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>

								</xsl:with-param>
								<xsl:with-param name="status">
									<xsl:value-of select="@status"/>
								</xsl:with-param>
								<xsl:with-param name="encodinginfo">n/a</xsl:with-param>
								<xsl:with-param name="alternateappnotes">You must supply at least one of the attributes: <xsl:for-each select="attribute">
										<xsl:value-of select="@name"/>
										<xsl:if test="position() != last()"> or </xsl:if>
									</xsl:for-each>
								</xsl:with-param>
								<xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>
							</xsl:call-template>
						</axsl:otherwise>
					</axsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<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>

						</td>
						<td rowspan="3">Invalid Option</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="getattributes">
		<xsl:for-each select="attribute">
			<xsl:choose>
				<xsl:when test="@test">
					<axsl:choose>
						<axsl:when>
							<xsl:attribute name="test"><xsl:value-of select="@test"/></xsl:attribute>
							<xsl:call-template name="checkattributes"/>
						</axsl:when>
						<axsl:otherwise>
</axsl:otherwise>
					</axsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="checkattributes"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="getchildren">
		<xsl:if test="children">
			<xsl:for-each select="children">
				<xsl:choose>
					<xsl:when test="@include='oneof'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test"><xsl:for-each select="child"><xsl:value-of select="."/><xsl:if test="position() != last()">|</xsl:if></xsl:for-each></xsl:attribute>
								<xsl:comment>Remain silent No error</xsl:comment>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
									<xsl:with-param name="path">
										<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>

									</xsl:with-param>
									<xsl:with-param name="childnodes"><xsl:for-each select="child">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()"> or </xsl:if>
										</xsl:for-each>
</xsl:with-param>
									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">
										<xsl:for-each select="child">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()"> or </xsl:if>
										</xsl:for-each>
									</xsl:with-param>
									<xsl:with-param name="alternateappnotes">At least one child element should be supplied. 

</xsl:with-param>								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
					<xsl:when test="@include='all' or @include='include'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test"><xsl:for-each select="child"><xsl:value-of select="."/><xsl:if test="position() != last()">  and </xsl:if></xsl:for-each></xsl:attribute>
								<xsl:comment>Remain silent No error</xsl:comment>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
									<xsl:with-param name="path">
										<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>

									</xsl:with-param>
									<xsl:with-param name="childnodes"><xsl:for-each select="child">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()"> or </xsl:if>
										</xsl:for-each>
</xsl:with-param>

									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">
										<xsl:for-each select="child">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()"> and </xsl:if>
										</xsl:for-each>
									</xsl:with-param>
									<xsl:with-param name="alternateappnotes"><xsl:if test="@include='all'">All child elements must be supplied. 


</xsl:if>
<xsl:if test="@include='include'">Include these child elements as applicable. 
						
</xsl:if>
</xsl:with-param><xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>

								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
				</xsl:choose>
			</xsl:for-each>
		</xsl:if>
	</xsl:template>
	<xsl:template name="gettests">
		<xsl:if test="tests">
			<xsl:for-each select="tests">
				<xsl:choose>
					<xsl:when test="@include='oneof'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test"><xsl:for-each select="test"><xsl:value-of select="."/><xsl:if test="position() != last()">|</xsl:if></xsl:for-each></xsl:attribute>
								<xsl:comment>Remain silent No error</xsl:comment>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
									<xsl:with-param name="path">
										<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>

									</xsl:with-param>
									<xsl:with-param name="childnodes"><xsl:for-each select="test">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()"> or </xsl:if>
										</xsl:for-each>
</xsl:with-param>
									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">
										<xsl:for-each select="test">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()"> or </xsl:if>
										</xsl:for-each>
									</xsl:with-param>
									<xsl:with-param name="alternateappnotes">At least one should be supplied. 

</xsl:with-param>								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
					<xsl:when test="@include='all' or @include='include'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test"><xsl:for-each select="test"><xsl:value-of select="."/><xsl:if test="position() != last()">  and </xsl:if></xsl:for-each></xsl:attribute>
								<xsl:comment>Remain silent No error</xsl:comment>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
									<xsl:with-param name="path">
										<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>

									</xsl:with-param>
									<xsl:with-param name="childnodes"><xsl:for-each select="test">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()">, </xsl:if>
										</xsl:for-each>
</xsl:with-param>

									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">
										<xsl:for-each select="test">
&lt;<xsl:value-of select="."/>&gt;
<xsl:if test="position() != last()">, </xsl:if>
										</xsl:for-each>
									</xsl:with-param>
									<xsl:with-param name="alternateappnotes"><xsl:if test="@include='all'">All  must be supplied. 


</xsl:if>
<xsl:if test="@include='include'">Include these  as applicable. 
						
</xsl:if>
</xsl:with-param><xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>

								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
				</xsl:choose>
			</xsl:for-each>
		</xsl:if>
	</xsl:template>

	<xsl:template name="getappnotes">
		<xsl:if test="appnotes">
			
			<div><xsl:attribute name="class">appnotes</xsl:attribute><xsl:attribute name="id">app.<xsl:value-of select="generate-id()"/></xsl:attribute><h4>Application notes for <xsl:choose>
	<xsl:when test="@context or ancestor::element/@context"><xsl:value-of select="@context"/><xsl:value-of select="ancestor::element/@context"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@path"/><xsl:value-of select="ancestor::element/@path"/></xsl:otherwise>
</xsl:choose></h4><p><xsl:value-of select="appnotes"/></p></div>
			<br/><a><xsl:attribute name="onclick">getAppNotes('app.<xsl:value-of select="generate-id()"/>')</xsl:attribute><xsl:attribute name="style">color:green;text-decoration:underline;cursor:pointer;cursor:hand</xsl:attribute>View Application Notes</a>
			
		</xsl:if>
	</xsl:template>
	<xsl:template name="singlefreq">
		<axsl:choose>
			<axsl:when>
				<xsl:attribute name="test"><xsl:value-of select="@path"/></xsl:attribute>
				<axsl:for-each>
					<xsl:attribute name="select"><xsl:value-of select="@path"/></xsl:attribute>
					<xsl:call-template name="gettests"/>
<xsl:call-template name="getoptions"/>
					<xsl:call-template name="getattributes"/>
					<xsl:call-template name="getchildren"/>
				</axsl:for-each>
			</axsl:when>
			<axsl:otherwise>
				<xsl:call-template name="report">
					<xsl:with-param name="path"><xsl:choose>
						<xsl:when test="@context"><xsl:value-of select="@context"/></xsl:when>
						<xsl:otherwise><xsl:value-of select="@path"/></xsl:otherwise>
					</xsl:choose>
										</xsl:with-param>
					<xsl:with-param name="status">
						<xsl:value-of select="@status"/>
					</xsl:with-param>
					<xsl:with-param name="encodinginfo"/>
					<xsl:with-param name="alternateappnotes">The element &lt; <xsl:choose>
						<xsl:when test="@context"><xsl:value-of select="@context"/></xsl:when>
						<xsl:otherwise><xsl:value-of select="@path"/></xsl:otherwise>
					</xsl:choose>
&gt; does not appear in this document.</xsl:with-param>
<xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>

				</xsl:call-template>
			</axsl:otherwise>
		</axsl:choose>
	</xsl:template>
	<xsl:template name="report">
		<xsl:param name="path"/>
		<xsl:param name="status"/>
		<xsl:param name="encodinginfo"/>
		<xsl:param name="alternateappnotes"/>
		<xsl:param name="childnodes"/>
		<xsl:param name="condition"/>
		<xsl:if test="@status='M' or @status='MA' or @status='Req'">
			<tr>
				<td>
					<xsl:value-of select="$path"/>
				&nbsp;</td><td><xsl:value-of select="$childnodes"/>&nbsp;</td>
				<td>
					<xsl:value-of select="$status"/>
				&nbsp;</td>
				<td>
					<xsl:value-of select="$alternateappnotes"/>
					
					<xsl:if test="name()='attribute' or name()='children'">
				<xsl:if test="$output='dynamic'"><axsl:call-template name="getcontext"/></xsl:if>
				<xsl:if test="$output='static'"><axsl:call-template name="getStaticLink"/></xsl:if>
	
						
					</xsl:if>
					<xsl:call-template name="getappnotes"/>

				&nbsp;</td>
				<td>
					<xsl:value-of select="$encodinginfo"/>
				&nbsp;</td>
						</tr>
		</xsl:if>
		<xsl:if test="@status='Rec' or @status='Opt'">
			<axsl:if test="$all='yes'">
			<tr>
				<td>
					<xsl:value-of select="$path"/>
				&nbsp;</td><td><xsl:value-of select="$childnodes"/>&nbsp;</td>
				<td>
					<xsl:value-of select="$status"/>
				&nbsp;</td>
				<td>
					<xsl:value-of select="$alternateappnotes"/>
					
					<xsl:if test="name()='attribute' or name()='children'">
					<xsl:if test="$output='dynamic'"><axsl:call-template name="getcontext"/></xsl:if>
				<xsl:if test="$output='static'"><axsl:call-template name="getStaticLink"/></xsl:if>

						
					</xsl:if>
					<xsl:call-template name="getappnotes"/>

				&nbsp;</td>
				<td>
					<xsl:value-of select="$encodinginfo"/>&nbsp;
				</td>
				</tr>
			</axsl:if>
		</xsl:if>
	</xsl:template>
		<xsl:template name="valuesreport">
		<xsl:choose>	<!-- this little routine is EAD BPG specific. Modify if other crosswalks are used -->
			<xsl:when test="values/value/@crosswalk">
				<xsl:if test="values/value[@crosswalk='MARC21']"> For MARC21:<xsl:for-each select="values/value[@crosswalk='MARC21']"> '<xsl:value-of select="."/>' <xsl:if test="position() != last()"> or </xsl:if>
					</xsl:for-each>.<br/>
</xsl:if>
				<xsl:if test="values/value[@crosswalk='DC']"><br/>
 For DC <xsl:for-each select="values/value[@crosswalk='DC']">'<xsl:value-of select="."/>' <xsl:if test="position() != last()"> or </xsl:if>
					</xsl:for-each>. <br/>
</xsl:if>
				<xsl:if test="values/value[@crosswalk='ISAD-G-v2']"><br/>
For ISAD(G)v2:<xsl:for-each select="values/value[@crosswalk='ISAD-G-v2']">'<xsl:value-of select="."/>' <xsl:if test="position() != last()"> or </xsl:if>
					</xsl:for-each><br/>
				</xsl:if>
				<!-- end of EAD specific routine -->

			</xsl:when>
			<xsl:otherwise>
				<xsl:for-each select="values/value"><br/>'<xsl:value-of select="."/>' <xsl:if test="position() != last()"> or </xsl:if>
				</xsl:for-each>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="checkattributes">
		<axsl:choose>
			<axsl:when>
				<xsl:attribute name="test">@<xsl:value-of select="@name"/></xsl:attribute>
				<xsl:choose>
					<xsl:when test="values/@type='cdata'"/>
					<xsl:when test="values/@type='single'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test">@<xsl:value-of select="@name"/>='<xsl:value-of select="values/value"/>'</xsl:attribute>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
									<xsl:with-param name="path"><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>

										</xsl:with-param>
									<xsl:with-param name="childnodes"><xsl:value-of select="@name"/>
=</xsl:with-param>
									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">
										<xsl:call-template name="valuesreport"/>
									</xsl:with-param>
									<xsl:with-param name="alternateappnotes">@<xsl:value-of select="@name"/> is not set correctly </xsl:with-param><xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>
								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
					<xsl:when test="values/@type='pattern'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test">@<xsl:value-of select="@name"/>[<xsl:value-of select="values"/>]</xsl:attribute>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
									<xsl:with-param name="path"><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>

										</xsl:with-param>
									<xsl:with-param name="childnodes"><xsl:value-of select="@name"/>=</xsl:with-param>
									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">Use  "<xsl:value-of select="values/@standard"/>" to format the attribute value.</xsl:with-param>
									<xsl:with-param name="alternateappnotes">This attribute is not formated correctly </xsl:with-param><xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>
								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
					<xsl:when test="values/@type='multi'">
						<axsl:choose>
							<axsl:when>
								<xsl:attribute name="test"><xsl:for-each select="values/value">@<xsl:value-of select="ancestor::attribute/@name"/>='<xsl:value-of select="."/>' <xsl:if test="position() != last()"> or </xsl:if></xsl:for-each></xsl:attribute>
							</axsl:when>
							<axsl:otherwise>
								<xsl:call-template name="report">
								<xsl:with-param name="path"><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>

										</xsl:with-param>

									<xsl:with-param name="childnodes">
										
<xsl:value-of select="@name"/>=
									</xsl:with-param>
									<xsl:with-param name="status">
										<xsl:value-of select="@status"/>
									</xsl:with-param>
									<xsl:with-param name="encodinginfo">
										<xsl:call-template name="valuesreport"/>
									</xsl:with-param>
									<xsl:with-param name="alternateappnotes">The current value is not correct. 
</xsl:with-param><xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>
								</xsl:call-template>
							</axsl:otherwise>
						</axsl:choose>
					</xsl:when>
				</xsl:choose>
			</axsl:when>
			<axsl:otherwise>
				<xsl:call-template name="report">
				<xsl:with-param name="path"><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>

										</xsl:with-param>

					<xsl:with-param name="childnodes">
						<xsl:value-of select="@name"/>=
					</xsl:with-param>
					<xsl:with-param name="status">
						<xsl:value-of select="@status"/>
					</xsl:with-param>
					<xsl:with-param name="encodinginfo">
						<xsl:if test="values/@type !='cdata'  and values/@type !='pattern'">
							<xsl:call-template name="valuesreport"/>
						</xsl:if>
						<xsl:if test="values/@type ='pattern'"> Use "<xsl:value-of select="values/@standard"/>" to format attribute value.</xsl:if>
					</xsl:with-param>
					<xsl:with-param name="alternateappnotes"> Missing @<xsl:value-of select="@name"/>
					</xsl:with-param>
					<xsl:with-param name="condition"><xsl:value-of select="@test"/></xsl:with-param>
				</xsl:call-template>
			</axsl:otherwise>
		</axsl:choose>
	</xsl:template>
	<xsl:template name="checkelements">
		<xsl:choose>
			<xsl:when test="@freq='single'">
				<xsl:call-template name="singlefreq"/>
			</xsl:when>
			<xsl:when test="@freq='repeated'">
				<axsl:choose>
					<axsl:when>
						<xsl:attribute name="test"><xsl:value-of select="@path"/></xsl:attribute>
						<axsl:for-each>
							<xsl:attribute name="select"><xsl:value-of select="@path"/></xsl:attribute>
							<xsl:call-template name="gettests"/>
<xsl:call-template name="getoptions"/>
							<xsl:call-template name="getattributes"/>
							<xsl:call-template name="getchildren"/>
						</axsl:for-each>
					</axsl:when>
					<axsl:otherwise>
						<xsl:call-template name="report">
							<xsl:with-param name="path">
								<xsl:choose>
						<xsl:when test="@context"><xsl:value-of select="@context"/></xsl:when>
						<xsl:otherwise><xsl:value-of select="@path"/></xsl:otherwise>
					</xsl:choose>

							</xsl:with-param>
							<xsl:with-param name="status">
								<xsl:value-of select="@status"/>
							</xsl:with-param>
							<xsl:with-param name="encodinginfo"/>
							<xsl:with-param name="alternateappnotes"> The repeatable element &lt;<xsl:choose>
						<xsl:when test="@context"><xsl:value-of select="@context"/></xsl:when>
						<xsl:otherwise><xsl:value-of select="@path"/></xsl:otherwise>
					</xsl:choose>
&gt; not been used in this document.
							</xsl:with-param>
						</xsl:call-template>
					</axsl:otherwise>
				</axsl:choose>
			</xsl:when>
		</xsl:choose>
	</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>
-->