<?xml version="1.0"?>

<!--
html.xsl

Copyright (c) 2000,2001,2002,2003,2004,2005,2006 Florent Villard <warly@laposte.net>
All rights reserved.

$Id: html.xsl,v 1.3 2006/05/27 08:29:13 warly Exp $
-->

<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>
  <xsl:output doctype-public="-//W3C//DTD HTML 4.0//EN"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="/">
    <html>
      <head>
	<title>
	  <xsl:apply-templates select="resume/header/name"/>'s Resume
	</title>
        <xsl:apply-templates select="resume/keywords" mode="header"/>
	<link href="index.css" type="text/css" rel="stylesheet"/>
	<style type="text/css">
      A:link { color:#000 }
      A:active { color:#000 }
      A:visited { color:#000 }
      #resume {
      position: absolute; 
      left: 50px; 
      top: 20px; 
      width: 700px;
      z-index: 1; 
       }
      #p2 {
      font-size: 10px;
      font-family: helvetica;
      font-style: normal;
      font-weight: bold;
      text-align: left;
      left: 100px; 
      top: 450px; 
      width: 400px;
      z-index: 1; 
      }
      #title {
      font-size: 20px;
      font-family: helvetica;
      font-style: normal;
      font-weight: bold;
      text-align: left;
      }
      #address {
      font-size: 10px;
      font-family: helvetica;
      font-style: normal;
      font-weight: normal;
      text-align: right;
      }
      #section {
      font-size: 14px;
      font-family: helvetica;
      font-style: normal;
      font-weight: bold;
      text-align: left;
      top: 100px; 
      }
      #para {
      font-size: 12px;
      font-family: helvetica;
      font-style: normal;
      font-weight: normal;
      text-align: left;
      left: 150px; 
      }
	</style>      
	</head>
      <body bgcolor="#ffffff">
	<div id="resume">
	<table>
	<xsl:apply-templates select="resume"/>
	</table>
	<br/>
	<p align="right"><font size="-2"><xsl:value-of select="resume/header/version"/></font></p>
      	</div>
	<script LANGUAGE="JavaScript" SRC="../../hit.js"></script>
	
<script LANGUAGE="JavaScript"> 
<xsl:text>&lt;!-- 
hit('warly','resume','html-en'); 
//--&gt;</xsl:text>
</script></body>
    </html>
  </xsl:template>

  <xsl:template match="keywords"/>

  <xsl:template match="keywords" mode="header">
    <meta name="keywords">
      <xsl:attribute name="content">
	<xsl:apply-templates select="keyword"/>
      </xsl:attribute>
    </meta>
  </xsl:template>

  <xsl:template match="keyword">
    <xsl:value-of select="."/>
    <xsl:if test="position() != last()">
      <xsl:text>, </xsl:text>
    </xsl:if>
  </xsl:template>

  <!-- The "docpath" is used on my website.  Just ignore it.  -->
  <xsl:template match="docpath">
    <div class="navbar">
      <xsl:apply-templates select="head"/>
      <xsl:apply-templates select="node"/>
      <xsl:apply-templates select="tail"/>
    </div>
  </xsl:template>

  <xsl:template name="pathItem">
    <xsl:param name="style">unknown</xsl:param>
    <span class="{$style}">
      <a>
        <xsl:attribute name="href">
          <xsl:value-of select="uri"/>
        </xsl:attribute>
        <xsl:value-of select="label"/>
      </a>
      <xsl:text> > </xsl:text>
    </span>
  </xsl:template>

  <xsl:template match="head">
    <xsl:call-template name="pathItem">
      <xsl:with-param name="style">navHome</xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="node">
    <xsl:call-template name="pathItem">
      <xsl:with-param name="style">navItem</xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="tail">
    <span class="navTerminal">
      <xsl:value-of select="."/>
    </span>
  </xsl:template>

  <!-- Output your name and the word "Resume" with acute accents. -->
  <xsl:template match="header">
    <div id="title"><xsl:apply-templates select="name"/>
    <hr/>
    </div>
      
    <div id="address">
      <xsl:apply-templates select="name"/>,
      <xsl:value-of select="address/street"/>, <xsl:value-of select="address/zip"/> <xsl:value-of select="address/city"/>, <xsl:value-of select="address/state"/>. <xsl:value-of select="contact/phone"/>, 
	<a><xsl:attribute name="href"><xsl:text>mailto:</xsl:text><xsl:value-of select="contact/email"/></xsl:attribute><xsl:value-of select="contact/email"/></a>, 
	<a><xsl:attribute name="href"><xsl:value-of select="contact/url"/></xsl:attribute><xsl:value-of select="contact/url"/></a>
	</div>
	<br/>
	<br/>
  </xsl:template>

  <xsl:template match="history">
	<tr>
    <td valign="top"><div id="section">Employment History</div></td>
	<td valign="top">
	<div id="para">
	<table>
    <xsl:apply-templates select="job"/>
	</table>
	</div>
	<br/>
	</td>
	</tr>
  </xsl:template>

  <xsl:template match="job">
    <tr>
      <td><i><span class="jobTitle">
        <xsl:value-of select="jobtitle"/>
      </span></i></td>
      <td align="right"><b>
      <xsl:value-of select="employer"/>
      <br/><xsl:apply-templates select="period"/>
      </b></td>
	</tr>	
	<tr>
	<td colspan="2">
	<xsl:apply-templates select="location"/>
    <xsl:text>. </xsl:text>
    <xsl:apply-templates select="description"/>
	<br/>
	</td> 
	</tr>
  </xsl:template>
		
  <xsl:template match="period">
    <xsl:apply-templates select="from"/>-<xsl:apply-templates select="to"/>
  </xsl:template>

  <xsl:template match="date">
    <xsl:value-of select="month"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="year"/>
  </xsl:template>

  <xsl:template match="present">Present</xsl:template>

  <!-- Degrees and stuff -->
  <xsl:template match="academics">
    <tr>
	<td valign="top"><div id="section">Academics</div></td>
        <td valign="top"><div id="para"><xsl:apply-templates select="degrees"/></div></td>
    </tr>
  </xsl:template>

  <xsl:template match="degrees">
    <xsl:apply-templates select="degree"/>
    <xsl:apply-templates select="note"/>
  </xsl:template>

  <xsl:template match="note">
      <li><small>
      <xsl:apply-templates/>
      </small></li>
  </xsl:template>

  <xsl:template match="degree">
    <li>
      <acronym>
        <xsl:value-of select="level"/>
      </acronym>
      <xsl:text> in </xsl:text>
      <xsl:value-of select="subject"/>
      <xsl:text>, </xsl:text>
      <xsl:apply-templates select="date"/>
      <xsl:text>, </xsl:text>
      <xsl:value-of select="institution"/>
      <xsl:text>.</xsl:text>     
      <xsl:apply-templates select="annotation"/>
    </li>
  </xsl:template>

  <!-- Format the open-ended skills -->
  <xsl:template match="skillarea">
    <tr>
	<td valign="top"><div id="section"><xsl:value-of select="title"/></div></td>
	<td valign="top"><div id="para"> 
	<table>
   	<xsl:apply-templates select="skillset"/>
	</table>
	</div>
	</td>
	</tr>
  </xsl:template>

  <xsl:template match="skillset">
	<tr>
    	<td><b><xsl:apply-templates select="title"/></b></td>
    	<td><xsl:apply-templates select="skills"/></td>
	</tr>
  </xsl:template>

  <xsl:template match="skillset/title">
    <b><xsl:value-of select="."/></b>
  </xsl:template>

  <xsl:template match="skills">
     <xsl:for-each select="skill">
      <xsl:value-of select="normalize-space(.)"/>
      <xsl:if test="not(position()=last())"><xsl:text>. </xsl:text></xsl:if>
     </xsl:for-each>
   </xsl:template>

  <!-- Format publications -->
  <xsl:template match="pubs">
    <h2>Publications</h2>
    <ul>
      <xsl:apply-templates select="pub"/>
    </ul>
  </xsl:template>

  <xsl:template match="pub">
    <li>
      <xsl:apply-templates/>
    </li>
  </xsl:template>

  <!-- Format the misc info -->
  <xsl:template match="misc">
	<tr>
    <td valign="top"><div id="section">Miscellany</div></td>
    <td valign="top"><div id="para"><xsl:apply-templates/>
	</div>
	</td>
	</tr>
  </xsl:template>

  <!-- Format the legalese -->
  <xsl:template match="copyright">
    <address>
      Copyright 
      <xsl:text disable-output-escaping="yes">&amp;copy; </xsl:text>
      <xsl:value-of select="year"/> by
      <xsl:apply-templates select="name"/>.
      <xsl:value-of select="legalnotice"/>
    </address>
  </xsl:template>

  <!-- Put a space between first and last name -->
  <xsl:template match="name">
    <xsl:value-of select="firstname"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="surname"/>
  </xsl:template>

  <xsl:template match="para">
      <xsl:apply-templates/>
    <br/>
  </xsl:template>

  <xsl:template match="emphasis">
    <strong><xsl:value-of select="."/></strong>
  </xsl:template>

  <!-- url -> monospace along with href -->
  <xsl:template match="url">
    <code>
      <a>
        <xsl:attribute name="href">
          <xsl:value-of select="."/>
	</xsl:attribute>
        <xsl:value-of select="."/>
      </a>
    </code>
  </xsl:template>

  <!-- citation -> cite -->
  <xsl:template match="citation">
    <cite><xsl:value-of select="."/></cite>
  </xsl:template>

</xsl:stylesheet>
