<?xml version="1.0" encoding="UTF-8"?>
<!--Raymond Yee (yee@uclink.berkeley.edu) , Interactive University, University of California, Berkeley 2002-02-19 -->
<!--&nbsp; trick from http://www.mycgiserver.com/~~lisali/papers/paper.htm -->
<!DOCTYPE stylesheet [ 
    <!ENTITY nbsp "<xsl:text disable-output-escaping=&#34;yes&#34; 
    xmlns:xsl= &#34;http://www.w3.org/1999/XSL/Transform &#34;
    >&amp;nbsp;</xsl:text>"> <!-- white space in XSL -->
    ]>    
    
<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 hint from http://www.objectsbydesign.com/projects/xslt/xhtml.html#faq1 to generate XHTML -->

	<xsl:output method="xml" indent="yes"   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />


	<!-- root template -->
	<xsl:template match="ArchObj">
	      <html><body>
	      <!--take care of DescMD and overall metadata -->
	      Label:  <xsl:value-of select="@LABEL"></xsl:value-of> <br />
	      Type: <xsl:value-of select="@TYPE"></xsl:value-of> <br />
	      Object ID:  <xsl:value-of select="@OBJID"></xsl:value-of> <br />
	      <!--handle DescMD -->
	      <xsl:apply-templates select="DescMD"></xsl:apply-templates>
	      <!--handle StructMap -->
	      <xsl:apply-templates select="StructMap"></xsl:apply-templates>
		</body></html>
	</xsl:template>
	
	<!--DescMD  (select out only DmdRefs which are URLs)-->
	<xsl:template match="DescMD">
		<xsl:apply-templates select="DMDRef[@LOCTYPE='URL']"></xsl:apply-templates>
	</xsl:template>
	
	<!--DMDRef (assuming LOCTYPE are URLs)-->
	<xsl:template match="DMDRef">
	       <a><xsl:attribute name="href"><xsl:value-of select="normalize-space(.)"></xsl:value-of></xsl:attribute><xsl:value-of select="@DMDTYPE"></xsl:value-of></a><br />
	</xsl:template>
	
	<!--StructMap -->
	<xsl:template match="StructMap">
		<ol>
			<xsl:apply-templates select="div"></xsl:apply-templates>
		</ol>
	</xsl:template>
	
	<!--div -->
	<xsl:template match="div">
		<li>
			<xsl:value-of select="@LABEL"></xsl:value-of> <br />
	 		<xsl:value-of select="@TYPE"></xsl:value-of> <br /><br />
	 		<!-- deal with any files under this div -->
	 		<xsl:apply-templates select="fptr"></xsl:apply-templates>
	 		<!-- recursively deal with div -->
	 		<ol><xsl:apply-templates select="div"></xsl:apply-templates></ol>
	 	</li>
	</xsl:template>
	
	<!--fptr-->
	<xsl:template match="fptr">
		<!--get info for associated file -->
		<xsl:apply-templates select="id(@FILEID)" mode="info"></xsl:apply-templates>
		<br />
	</xsl:template>
	
	<!--file mode=info -->
	<xsl:template match="File" mode="info">
		<xsl:value-of select="@MIMETYPE"></xsl:value-of>&nbsp;
		<!--handle the admin data -->
		<xsl:apply-templates select="id(@ADMID)" mode="info"></xsl:apply-templates>
		<xsl:apply-templates select="FLocat"></xsl:apply-templates><br />
	</xsl:template>
	
	<!--admin metadata (info mode) -->
	<xsl:template match="AdminMD" mode="info">
		<!--deal with Rights -->
		<xsl:apply-templates select="Rights"></xsl:apply-templates>
		<!--deal with Source info -->
		<xsl:apply-templates select="Source"></xsl:apply-templates>
	</xsl:template>
	
	<!-- Flocat -->
	<xsl:template match="FLocat"><a><xsl:attribute name="href"><xsl:value-of select="normalize-space(.)"></xsl:value-of></xsl:attribute><xsl:value-of select="."></xsl:value-of></a></xsl:template>
	
	<!--Rights -->
	<xsl:template match="Rights">Owner: &nbsp;<xsl:value-of select="Owner"></xsl:value-of><br /></xsl:template>
	
	<!--Source-->
	<xsl:template match="Source">Source:&nbsp;<xsl:value-of select="@SOURCEID"></xsl:value-of><br /></xsl:template>
</xsl:stylesheet>

