<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:apply-templates select="//resume"/>
</xsl:template>
<xsl:template match="resume">
<html>
<head>
<title>Scott Kirkwood's Résumé</title>
</head>
<style id="MyStyles">
.verbose
{
display:none;
color: darkblue;
}
</style>
<body>
<script language="jscript">
function ToggleVerbose()
{
if (document.styleSheets.MyStyles.rules(0).style.display == "none")
{
document.styleSheets.MyStyles.rules(0).style.display = "";
}
else
{
document.styleSheets.MyStyles.rules(0).style.display = "none";
}
}
function Collapse(item)
{
var aNode = item.parentElement.parentElement.parentElement;
var cChildren = aNode.all;
var bFoundMe = false;
for (var i = 0; cChildren.length != i; ++i)
{
if (!bFoundMe)
{
if (item.parentElement == cChildren[i])
{
bFoundMe = true;
}
}
else if ("DIV" == cChildren[i].tagName)
{
if (cChildren[i].style.display == "none")
{
cChildren[i].style.display = "";
}
else
{
cChildren[i].style.display = "none";
}
break;
}
}
}
</script>
<center><xsl:apply-templates select="/resume/name" /></center>
<xsl:apply-templates select="//category"/>
</body>
</html>
</xsl:template>
<xsl:template match="category">
<h2 align="center"><xsl:value-of select="title"/></h2>
<input type="CHECKBOX" onclick="ToggleVerbose()"/>Show the complete (long) version
<xsl:apply-templates select="group"/>
</xsl:template>
<xsl:template match="group">
<!--<li style="list-style-type: none;"> -->
<h3><div style="padding-left:20;background:LIGHTGREY;">
<input type="CHECKBOX" CHECKED="true" onClick="Collapse(this)"/>
<xsl:value-of select="title"/></div></h3>
<div>
<div style="margin-left:5pt"><xsl:value-of select="description"/></div>
<ul style="display:block;">
<xsl:apply-templates/>
</ul>
</div>
</xsl:template>
<xsl:template match="institution">
<div>
<xsl:if expr="is_verbose(this)">
<xsl:attribute name="class">verbose</xsl:attribute>
</xsl:if>
<li>
<div>
<b><xsl:value-of select="school" /></b> -
<xsl:eval>from_to_date_str(this)</xsl:eval><br/>
<b><i><xsl:value-of select="location" /></i></b><br/>
<xsl:choose>
<xsl:when match=".[degree]">
<xsl:value-of select="degree" />
</xsl:when>
<xsl:otherwise>
Did not complete program.
</xsl:otherwise>
</xsl:choose>
<xsl:if match=".[major!='']">
(<xsl:value-of select="major" />)
</xsl:if>
<br/>
<xsl:if match=".[comments!='']">
<xsl:value-of select="comments"/><br/>
</xsl:if>
</div>
</li>
<xsl:if test="context()[not(end())]"><hr/></xsl:if>
</div>
</xsl:template>
<xsl:template match="employer">
<div>
<xsl:if expr="is_verbose(this)">
<xsl:attribute name="class">verbose</xsl:attribute>
</xsl:if>
<li>
<b><xsl:value-of select="name"/></b>
- <xsl:eval>from_to_date_and_duration_str(this)</xsl:eval><br/>
<b><i><xsl:value-of select="location"/></i></b><br/>
<i><xsl:value-of select="jobName"/></i>
<xsl:apply-templates select="description"/>
</li>
<xsl:if test="context()[not(end())]"><hr/></xsl:if>
</div>
</xsl:template>
<xsl:template match="skill">
<div>
<xsl:if expr="is_verbose(this)">
<xsl:attribute name="class">verbose</xsl:attribute>
</xsl:if>
<li>
<b><xsl:value-of select="title"/></b>
- <xsl:eval>years_str(selectSingleNode("@years"))</xsl:eval><br/>
<xsl:apply-templates/>
</li>
<xsl:if test="context()[not(end())]"><hr/></xsl:if>
</div>
</xsl:template>
<xsl:template match="item">
<div>
<xsl:if expr="is_verbose(this)">
<xsl:attribute name="class">verbose</xsl:attribute>
</xsl:if>
<li>
<b><xsl:value-of select="title"/></b><br/>
<xsl:apply-templates/>
</li>
<xsl:if test="context()[not(end())]"><hr/></xsl:if>
</div>
</xsl:template>
<xsl:template match="description">
<xsl:apply-templates select="job_item"/>
</xsl:template>
<xsl:template match="job_item">
<span>
<xsl:if expr="is_verbose(this)">
<xsl:attribute name="class">verbose</xsl:attribute>
</xsl:if>
• <xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="p">
<xsl:copy><xsl:value-of/></xsl:copy>
</xsl:template>
<xsl:template match="em"><xsl:copy><xsl:value-of/></xsl:copy></xsl:template>
<xsl:template match="b"><xsl:copy><xsl:value-of/></xsl:copy></xsl:template>
<xsl:template match="q">“<xsl:copy><xsl:value-of/></xsl:copy>”</xsl:template>
<xsl:template match="p_print"><p><xsl:value-of/></p></xsl:template>
<xsl:template match="name">
<h1><xsl:value-of/></h1>
</xsl:template>
<xsl:template match="address">
<li>
<xsl:value-of select="@name"/>
<div>
<xsl:value-of select="street"/>
<xsl:value-of select="city/por"/>,
<xsl:value-of select="state/@stateCode"/>
<xsl:value-of select="zipcode"/>
<xsl:value-of select="country"/><br/>
<xsl:apply-templates select="phone" />
</div>
</li>
</xsl:template>
<xsl:template match="links">
<li>
<xsl:value-of select="title"/>
<div>
<xsl:apply-templates select="link" />
</div>
</li>
</xsl:template>
<xsl:template match="phone">
<b><xsl:value-of select="title"/>:</b>
<xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="years"><xsl:eval>years_str(this)</xsl:eval></xsl:template>
<xsl:template match="link">
<b><xsl:value-of select="title"/>:</b>
<xsl:choose>
<xsl:when match=".[@ref!='']">
<a><xsl:attribute name="href"><xsl:value-of select="@ref"/></xsl:attribute>
<xsl:value-of select="text()"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ol"> <ol><xsl:apply-templates/></ol> </xsl:template>
<xsl:template match="ul"> <Ul><xsl:apply-templates/></Ul> </xsl:template>
<xsl:template match="li"> <li><xsl:apply-templates/></li> </xsl:template>
<!-- this is required to get the en-comment tags to be expanded in def tags -->
<xsl:template match="text()"><xsl:value-of /></xsl:template>
<xsl:script><![CDATA[
function from_to_date_str(node)
{
var strFromTo = "";
if (node.selectSingleNode("dateStart/@month").text == "summer")
{
strFromTo += "Summers of ";
}
strFromTo += date_str(node.selectSingleNode("dateStart"));
strFromTo += " to ";
strFromTo += date_str(node.selectSingleNode("dateEnd"));
return strFromTo;
}
function from_to_date_and_duration_str(node)
{
var strFromTo = "";
strFromTo += from_to_date_str(node)
strFromTo += " (";
strFromTo += duration_str(node);
strFromTo += ")";
return strFromTo;
}
function duration_str(node)
{
var startDate = extract_date(node.selectSingleNode("dateStart"));
var endDate = extract_date(node.selectSingleNode("dateEnd"));
var nMonths = 0;
nMonths = endDate.getMonth() - startDate.getMonth();
nMonths += 12 * (endDate.getFullYear() - startDate.getFullYear());
var nYears = Math.floor(nMonths / 12);
var strRet = "";
nMonths -= nYears * 12;
if (nYears <= 0)
{
strRet = "";
}
else if (nYears == 1)
{
strRet = "1 year";
}
else if (nYears > 1)
{
strRet = nYears + " years";
}
if (nMonths > 0 && nYears > 0)
{
strRet += " and ";
}
if (nMonths == 1)
{
strRet = "a little more than " + strRet;
}
else if (nMonths == 6 && nYears > 0)
{
strRet = nYears + " and a half years";
}
else if (nMonths == 11 && nYears > 0)
{
strRet = "almost " + (nYears + 1) + " years";
}
else if (nMonths != 0)
{
strRet += nMonths + " months";
}
return strRet;
}
function extract_date(node)
{
var strYear = node.selectSingleNode("@year").text;
if (strYear == "Current")
return new Date();
var strMon = node.selectSingleNode("@month").text;
if (strMon == "")
{
strMon = "1";
}
else if (strMon == "summer")
{
strMon = "6";
}
return new Date(strYear, strMon, "1");
}
function date_str(yearMonth)
{
var strYear = yearMonth.selectSingleNode("@year").text;
if (strYear == "Current")
{
return "Current";
}
var strMon = month_as_str(yearMonth.selectSingleNode("@month").text);
if (strMon != "")
{
return strMon + " " + strYear;
}
return strYear;
}
function month_as_str(intMonth)
{
switch (intMonth)
{
case "1":
return "January";
break;
case "2":
return "February";
break;
case "3":
return "March";
break;
case "4":
return "April";
break;
case "5":
return "May";
break;
case "6":
return "June";
break;
case "7":
return "July";
break;
case "8":
return "August";
break;
case "9":
return "September";
break;
case "10":
return "October";
break;
case "11":
return "November";
break;
case "12":
return "December";
break;
}
return "";
}
function years_str(tag)
{
var tagText = tag.text;
retStr = "";
if (tagText.length == 4 || tagText.length == 5)
{
var yearNum = 0;
if (tagText.substring(0, 1) == "+")
{
retStr = "more than ";
yearNum = tagText.substring(1, 5);
}
else if (tagText.substring(0, 1) == "-")
{
retStr = "less than ";
yearNum = tagText.substring(1, 5);
}
else
{
yearNum = tagText.substring(0, 4);
}
var todayDate = new Date();
var years = todayDate.getFullYear() - yearNum;
if (years < 1)
{
years = 1;
}
retStr += years;
if (years == 1)
{
retStr += " year";
}
else
{
retStr += " years";
}
}
else
{
retStr = tagText;
if (tagText == "ongoing")
{
retStr = "ongoing";
}
else if (tagText == "1")
{
retStr += " year";
}
else
{
retStr += " years";
}
}
return retStr;
}
function even(e)
{
return absoluteChildNumber(e) % 2 == 0;
}
function is_verbose(node)
{
if (node.selectSingleNode("@verbose") &&
node.selectSingleNode("@verbose").text == "yes")
return true;
return false;
}
]]></xsl:script>