<?xml version="1.0" encoding="utf-8"?>
<!-- Note that this stylesheet relies on the XMLDocument and XSLDocument properties and thus
     only works when browsing XML -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="html" version="4.0" encoding="utf-8"/>

<xsl:template match="/">
	<HTML>
		<head>
			<title>Resume of <xsl:value-of select="Resume/ResumeBody/PersonalData/Name" /></title>

			<xsl:if test="$format='web'">
				<base target="_top" />

				<style type="text/css">
					<xsl:comment>
						a:active {  text-decoration: none; color: #000066}
						a:link {  text-decoration: none; color: #000066}
						a:visited {  text-decoration: none; color: #000066}
						a:hover { text-decoration: underline; color: #0000FF}
					</xsl:comment>
				</style>
			</xsl:if>
		</head>
		<BODY>
			<font face="Georgia, Times New Roman, Times, serif">
			<xsl:apply-templates select="*"/>
			</font>
		</BODY>
	</HTML>
</xsl:template>

<xsl:template match="Resume">
      <xsl:apply-templates select="ResumeBody"/>
      <xsl:apply-templates select="ResumeProlog/RevisionDate"/>
</xsl:template>

<xsl:template match="ResumeProlog/RevisionDate">
	<font size="1pt" color="#CCCCCC">
      <p align="right">Generated from file modified on <xsl:value-of select="Date/Month"/>/<xsl:value-of select="Date/Day"/>/<xsl:value-of select="Date/Year"/></p>
	</font>
</xsl:template>

<xsl:template match="ResumeBody">
      <xsl:apply-templates select="PersonalData"/>
      <xsl:apply-templates select="ResumeSection"/>
</xsl:template>

<xsl:template match="PersonalData">
      <h3 align="center"><b><xsl:value-of select="Name"/></b></h3>
      <div align="center">
        <xsl:apply-templates select="Address"/> <br />
        <xsl:apply-templates select="Voice"/>, 
        <xsl:apply-templates select="Email"/> <br />
      </div>
</xsl:template>

<xsl:template match="Name">
	<xsl:value-of select="First"/>
	<xsl:value-of select="Middle"/>
	<xsl:value-of select="Last"/>
</xsl:template>

<xsl:template match="Address"><xsl:value-of select="AddressLine"/>, <xsl:value-of select="City"/>, <xsl:value-of select="State"/><xsl:text> </xsl:text><xsl:value-of select="PostalCode"/></xsl:template>

<xsl:template match="Voice">phone: (<xsl:value-of select="AreaCode"/>) <xsl:value-of select="TelNumber"/></xsl:template>

<xsl:template match="Email"><xsl:choose>
	<xsl:when test="$format='web'">e-mail: <a><xsl:attribute name="href">mailto:<xsl:value-of select="." /></xsl:attribute><xsl:value-of select="." /></a></xsl:when>
	<xsl:when test="$format='word'">e-mail: <xsl:value-of select="." /></xsl:when>
</xsl:choose></xsl:template>

<xsl:template match="ResumeSection">
    <h3 align="left">
		<b><xsl:value-of select="SectionTitle"/></b>
	</h3>
    <xsl:apply-templates select="SubTitle"/>
    <xsl:apply-templates select="SecBody"/>
</xsl:template>

<xsl:template match="ResumeSection/SubTitle">
	<b><xsl:value-of select="."/></b>
</xsl:template>

<xsl:template match="ResumeSection[@SecType = 'QualifSummary']/SecBody">
	<b>
	      <xsl:for-each select="p">
			<xsl:value-of select="." />
			<br />
	      </xsl:for-each>
	</b>
</xsl:template>

<xsl:template match="ResumeSection[@SecType = 'Experience']">
	<xsl:apply-templates select="SectionTitle"/>
    <xsl:apply-templates select="SecBody"/>
</xsl:template>

<xsl:template match="ResumeSection[@SecType = 'Experience']/SectionTitle">
	<table border="0" width="95%" cellspacing="0" cellpadding="0" height="25">
  	<tr> 
    	<td width="20%" valign="top" height="25">
			<b><xsl:apply-templates select="StartDate/Date"/> - <xsl:apply-templates select="EndDate/Date | EndDate/CurrentPosition"/></b>
		</td>
    	<td width="3%"></td>
    	<td width="80%" valign="top" height="25">
			<b><xsl:value-of select="JobTitle"/></b> -- 
			<xsl:choose>
				<xsl:when test="$format='web' and Website"><a><xsl:attribute name="href"><xsl:value-of select="Website"/></xsl:attribute><xsl:value-of select="EmployerName"/></a>, </xsl:when>
				<xsl:when test="$format='word' or not(Website)"><xsl:value-of select="EmployerName"/>, </xsl:when>
			</xsl:choose>
			<xsl:value-of select="Address/City"/>, <xsl:value-of select="Address/State"/>
		</td>
  	</tr>
	</table>
</xsl:template>

<xsl:template match="SecBody">
      <xsl:apply-templates select="*"/>
</xsl:template>

<xsl:template match="ResumeSection[@SecType = 'Experience']/SecBody">
	<ul>
	      <xsl:apply-templates select="*"/>
	</ul>
</xsl:template>

<xsl:template match="Date"><xsl:value-of select="Month"/>/<xsl:value-of select="Year"/></xsl:template>
<xsl:template match="CurrentPosition">present</xsl:template>

<xsl:template match="p">
    <xsl:copy>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ResumeSection[@SecType = 'Experience']/SecBody/p">
<xsl:choose>
	<xsl:when test="@details=$ignore_detail"></xsl:when>
	<xsl:otherwise>
		<li>
			  <xsl:apply-templates select="node()"/>
		</li>
	</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="Emph"><B><xsl:value-of select="." /></B></xsl:template>
<xsl:template match="CertificationQualif"><B><xsl:value-of select="." /></B></xsl:template>
<xsl:template match="EducationQualif"><B><xsl:value-of select="." /></B></xsl:template>


</xsl:stylesheet>



