<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- Stylesheet created 19 October 2004 by Vikram Ahmed, ECU -->

<!-- Reference from stylesheet eadcust.xsl-->
<xsl:include href="eadcust.xsl"/>

<xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
<xsl:strip-space elements='*'/>

<!-- Parameter Variable declarations-->

<!-- Path of the file-->
<xsl:param name='basepath'>file:/c:/notetab/ead/</xsl:param>

<!-- Document name-->
<xsl:param name="docname">
 <xsl:value-of select="//archdesc/did/unitid"/>
</xsl:param>

<!-- Match Root Element -->

<xsl:template match="/">
 <xsl:element name="html">
  <xsl:element name="head">

<!-- Dublin Core Elements -->

    <xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Title</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/unittitle"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#title</xsl:text>
	</xsl:attribute>
    </xsl:element>

    <xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Creator</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/origination"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#creator</xsl:text>
	</xsl:attribute>
    </xsl:element>

   <xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Description</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/abstract[1]"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#description</xsl:text>
	</xsl:attribute>
    </xsl:element>

    <xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Description</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/abstract[2]"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#description</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/persname"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/corpname"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/subject"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/geogname"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/famname"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/genreform"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:for-each select="ead/archdesc/controlaccess/list/item/title"> 
<xsl:element name="META">
<xsl:attribute name="name">DC.Subject</xsl:attribute>
<xsl:attribute name="CONTENT">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:element>
<xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#subject</xsl:text>
	</xsl:attribute>
    </xsl:element>
</xsl:for-each>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Publisher</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/repository"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#publisher</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Date</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/unittitle/unitdate/@normal"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#date</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Identifier</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//eadheader/eadid/@publicid"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#identifier</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Language</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/langmaterial/language/@langcode"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#language</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Rights</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/descgrp/userestrict"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#rights</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Format.Medium</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/physdesc/genreform"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#format</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Format.Extent</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/physdesc/extent[1]"/><xsl:text> </xsl:text><xsl:value-of select="//archdesc/did/physdesc/extent[1]/@unit"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#format</xsl:text>
	</xsl:attribute>
    </xsl:element>

<xsl:element name="META">
      <xsl:attribute name="NAME">
        <xsl:text>DC.Format.Extent</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="CONTENT">
       	<xsl:value-of select="//archdesc/did/physdesc/extent[2]"/><xsl:text> </xsl:text><xsl:value-of select="//archdesc/did/physdesc/extent[2]/@unit"/>
      </xsl:attribute>	
    </xsl:element>
    <xsl:element name="LINK">
	<xsl:attribute name="REL">
    		<xsl:text>SCHEMA.dc</xsl:text>
 	</xsl:attribute>
	<xsl:attribute name="HREF">
		<xsl:text>http://purl.org/metadata/dublin_core_elements#format</xsl:text>
	</xsl:attribute>
    </xsl:element>

<!-- Font and color settings -->

<xsl:element name="style">
	<xsl:text>h1, h2, h3, h4, h5, h6</xsl:text>
		<xsl:text>{font-family: "Times New Roman", Arial, Helvetica, sans-serif; color:</xsl:text>
         <xsl:value-of select='$headcolor'/>
				<xsl:text>}</xsl:text>
			</xsl:element>
		</xsl:element>
		<xsl:element name="body">
			<xsl:attribute name="style">
				<xsl:text>background-color:</xsl:text><xsl:value-of select='$pcolor'/>
				<xsl:text>; margin-top:0.25in;margin-left:0.50in;margin-right:0.50in;margin-bottom:3.0in;</xsl:text>
				<xsl:text>font-family: "Times New Roman", Arial, Helvetica, sans-serif</xsl:text>
			</xsl:attribute>

<!-- Title Tag -->

<xsl:element name="title">
<xsl:value-of select="//titlepage/titleproper"/>
</xsl:element>

<!-- Heading, Table of Contents and Contact Information -->

<a name="top"></a>
<center>
<xsl:for-each select="ead/frontmatter/titlepage/titleproper">
	<xsl:element name="h2">
	<xsl:apply-templates/>
	</xsl:element>
</xsl:for-each>
</center>

<table width="100%">
<tr>
<td width="30%" valign="top">

<!-- Apply Table of Contents Template  -->
<xsl:apply-templates select="ead/archdesc" mode="toc"/>

<xsl:element name="br"/>

<!-- Create NCEAD statement and link-->

<xsl:element name="center">
<xsl:element name='a'>
<xsl:attribute name="target">
<xsl:text>_top</xsl:text>
</xsl:attribute>    	
<xsl:attribute name='href'>http://www.ncecho.org/ncead</xsl:attribute>
<xsl:element name="img">
		<xsl:attribute name="src">
			<xsl:text>seals/nceadseal.jpg</xsl:text>
		</xsl:attribute>
		<xsl:attribute name='border'>0</xsl:attribute>
	</xsl:element>
</xsl:element>
<xsl:for-each select="//filedesc/notestmt/note/p">
	<xsl:element name="h5">
	<xsl:apply-templates/>
	</xsl:element>
</xsl:for-each>
</xsl:element>
</td>
<td width="40%" valign="top" align="center">
<xsl:for-each select="ead/frontmatter/titlepage/publisher">
<xsl:element name='a'>
<xsl:attribute name="target">
<xsl:text>_top</xsl:text>
</xsl:attribute>    	
<xsl:attribute name='href'><xsl:value-of select='$website'/></xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:for-each>
<xsl:element name="br"/>
<xsl:for-each select="ead/frontmatter/titlepage/p">
	<xsl:apply-templates/>
</xsl:for-each>
</td>

<!-- Contact Information -->

<td width="30%" valign="top">
<xsl:for-each select="ead/frontmatter/titlepage/list/head">
	<xsl:element name="h3">
	<xsl:apply-templates/>
	</xsl:element>
</xsl:for-each>
<xsl:for-each select="ead/frontmatter/titlepage/list/item">
	<xsl:apply-templates/>
	<xsl:element name="br"/>
</xsl:for-each>
<xsl:for-each select="ead/frontmatter/titlepage/num">
<xsl:element name="h2">
<xsl:text>Collection Number </xsl:text><xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</td>
</tr>
</table>

<!-- Apply archdesc template -->

<xsl:apply-templates select="ead/archdesc"/>
</xsl:element>
</xsl:element>
</xsl:template>

<!-- Back to Top Link -->

<xsl:template name="back">
	<xsl:element name='h5'>
    	<xsl:element name="a">
    				<xsl:attribute name="style">
    					<xsl:text>text-decoration:none;color:</xsl:text>
    					<xsl:value-of select='$backcolor'/>
    				</xsl:attribute>
    				<xsl:attribute name="href">
    					<xsl:text>#top</xsl:text>
    	       </xsl:attribute>
    	<xsl:text>Back to Top</xsl:text>
    	    </xsl:element>
    </xsl:element> 
</xsl:template>

<!-- table of contents template -->
<xsl:template name="tocentry">
	<xsl:param name="headmargin">18</xsl:param>
	<div class="itemsign"><img><xsl:attribute name="src">./seals/block.gif</xsl:attribute></img><xsl:text> </xsl:text>	
	<xsl:element name="a">
			<xsl:attribute name="style">
				<xsl:text>text-decoration:none;color:</xsl:text><xsl:value-of select='$toccolor'/><xsl:text>;margin-left: </xsl:text>
					<xsl:value-of select="$headmargin"/>
				</xsl:attribute>
			<xsl:attribute name="href">
				<xsl:text>#</xsl:text>
				<xsl:choose>
					<xsl:when test='@id'>
						<xsl:value-of select='@id'/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="generate-id()"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:value-of select="head | did/unittitle"/><br />
		</xsl:element></div>
</xsl:template>

<xsl:template match='archdesc' mode="toc">
	<!-- <xsl:element name="hr"/> -->
	<xsl:for-each select="*[head]">
		<xsl:call-template name="tocentry">
		<xsl:with-param name="headmargin">5</xsl:with-param>
		</xsl:call-template>
		
<!-- matches child of did level element with head -->
		<xsl:for-each select="*[head] | 
		c01[ancestor::dsc/@type='in-depth']
														 [@level='fonds' or @level='series' or @level='subseries']">
			<xsl:call-template name="tocentry">
				
				<xsl:with-param name="headmargin">30</xsl:with-param>
			</xsl:call-template>
<!-- matches child of child of did level element with head -->
			<xsl:for-each select="*[head] | 
														c02[ancestor::dsc/@type='in-depth']
															 [@level='series' or @level='subseries']">
				<xsl:call-template name="tocentry">
					
					<xsl:with-param name="headmargin">54</xsl:with-param>
				</xsl:call-template>
<!-- matches child of child of did level element with head -->
			<xsl:for-each select="*[head] | 
													c03[ancestor::dsc/@type='in-depth']
														 [@level='series' or @level='subseries']">
				<xsl:call-template name="tocentry">
					
					<xsl:with-param name="headmargin">77</xsl:with-param>
				</xsl:call-template>
			</xsl:for-each>

			</xsl:for-each>
		</xsl:for-each>
	</xsl:for-each>

	
</xsl:template>

<!-- Reference from stylesheet eadsharedrev.xsl-->
<xsl:include href="eadsharedrev.xsl"/>

</xsl:stylesheet>