<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    indent-result="yes">

<xsl:param name="mode" select="$mode"/>

<xsl:template match="resume">
    <table width="100%">
	<tr valign="bottom">
	    <td width="40%"><h1><xsl:value-of
		select="name"/></h1>
		(formerly <xsl:value-of select="formerly"/>)
		</td>
	    <td width="60%">
		<table width="100%">
		    <tr>
			<td align="right"><xsl:value-of
			    select="address/street"/></td>
		    </tr>
		    <tr>
			<td align="right"><xsl:value-of
			    select="address/city"/>, <xsl:value-of
			    select="address/state"/>
			    <xsl:text>  </xsl:text><xsl:value-of
			    select="address/zip"/></td>
		    </tr>
		    <tr>
			<td align="right"><a><xsl:attribute
			    name="href">mailto:<xsl:value-of
			    select="email"/></xsl:attribute
				><xsl:value-of select="email"/></a>
			</td>
		    </tr>
		    <tr>
			<td align="right"><xsl:value-of
			    select="phone"/>
			</td>
		    </tr>
		</table>
	    </td>
	</tr>
    </table>

    <hr align="left"> </hr>

    <h2>Objective</h2>
    <dl><dd>
	<p><xsl:apply-templates select="objective"/></p>
    </dd></dl>

    <h2>Publications</h2>
    <dl><dd>
	<dl>
	<xsl:apply-templates select="publications/*"/>
	</dl>
    </dd></dl>

    <h2>Patents</h2>
    <dl><dd>
	<dl>
	<xsl:apply-templates select="patents/*"/>
	</dl>
    </dd></dl>

    <xsl:apply-templates select="knowledge"/>

    <h2>Work Experience</h2>
    <dl><dd><dl>
	<xsl:choose>
	    <xsl:when test="$mode='brief'">
		<xsl:apply-templates select="experience/job" mode="brief"/>
	    </xsl:when>
	    <xsl:otherwise>
		<xsl:apply-templates select="experience/job" mode="long"/>
	    </xsl:otherwise>
	</xsl:choose>
    </dl></dd></dl>

    <h2>Other Programming Activities</h2>
    <dl><dd><dl>
	<xsl:choose>
	    <xsl:when test="$mode='brief'">
		<xsl:apply-templates select="activities/job" mode="brief"/>
	    </xsl:when>
	    <xsl:otherwise>
		<xsl:apply-templates select="activities/job" mode="long"/>
	    </xsl:otherwise>
	</xsl:choose>
    </dl></dd></dl>
</xsl:template>

<xsl:template match="knowledge">
    <h2>Languages and such</h2>
    <dl><dd>
	<p><b>Use regularly:  </b>
	    <xsl:apply-templates
		select="regular/lang"/>.
	</p>
	<p><b>Use occasionally:  </b>
	    <xsl:apply-templates
		select="occasional/lang"/>.
	</p>
    </dd></dl>

    <h2>Operating Systems (and hardware)</h2>
    <dl><dd><p>
	<xsl:apply-templates
		select="operatingsystems/system"/>.
    </p></dd></dl>

    <h2>Concepts and Packages</h2>
    <dl>
	<dd><p><xsl:apply-templates select="concepts/concept"/>.</p></dd>
	<dd><p><xsl:apply-templates select="packages/package"/>.</p></dd>
    </dl>

    <h2>Computer Science &amp; Mathematics Education</h2>
    <dl>
	<dd><p><em>B.S. in Computational Mathematics from the
	Rochester Institute of Technology in Rochester, NY.</em></p></dd>
	<dd><p>Mathematics courses include:
		<xsl:apply-templates select="courses/math/subject"
	    />.</p></dd>
	<dd><p>Computer Science courses include:
		<xsl:apply-templates select="courses/computerscience/subject"
	    />.</p></dd>
    </dl>
</xsl:template>

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

<xsl:template match="lang|concept|package|subject">
    <xsl:if test="position()>1">
	<xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:if test="position()=last() and last() > 1">
	<xsl:text>and </xsl:text>
    </xsl:if>
    <xsl:value-of select="."/>
</xsl:template>

<xsl:template match="system">
    <xsl:if test="position()>1">
	<xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:if test="position()=last() and last() > 1">
	<xsl:text>and </xsl:text>
    </xsl:if>
    <xsl:value-of select="os"/>
    (<xsl:apply-templates select="arch"/>)</xsl:template
>

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

<xsl:template match="job" mode="brief">
    <xsl:if test="not(@optional='true')">
	<dt><b><xsl:value-of select="title"/></b></dt>
	<dd>
	    <xsl:apply-templates select="brief/p" mode="brief"/>
	    <xsl:apply-templates select="employer"/>
	    <xsl:apply-templates select="subjob" mode="brief"/>
	</dd>
    </xsl:if>
</xsl:template>

<xsl:template match="job" mode="long">
    <dt><b><xsl:value-of select="title"/></b></dt>
    <dd>
	<xsl:apply-templates select="desc/p" mode="long"/>
	<xsl:apply-templates select="employer"/>
	<xsl:apply-templates select="subjob" mode="long"/>
    </dd>
</xsl:template>

<xsl:template match="subjob" mode="brief">
    <xsl:if test="not(@optional='true')">
    <hr align="left"> </hr>
    <dl>
	<dt><b><xsl:value-of select="title"/></b></dt>
	<dd>
	    <xsl:apply-templates select="brief"/>
	</dd>
    </dl>
    </xsl:if>
    <xsl:if test="position()=last()">
	<hr align="left"> </hr>
    </xsl:if>
</xsl:template>

<xsl:template match="subjob" mode="long">
    <hr align="left"> </hr>
    <dl>
	<dt><b><xsl:value-of select="title"/></b></dt>
	<dd>
	    <xsl:apply-templates select="desc"/>
	</dd>
    </dl>
    <xsl:if test="position()=last()">
	<hr align="left"> </hr>
    </xsl:if>
</xsl:template>

<xsl:template match="p" mode="brief">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="p" mode="long">
    <xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>

<xsl:template match="ref">
    <a><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
    <xsl:value-of select="text"/></a>
</xsl:template>

<xsl:template match="filename">
    <code><xsl:value-of select="."/></code>
</xsl:template>

<xsl:template match="employer">
    <p><em>
        <xsl:if test="url">
            <a><xsl:attribute name="href"><xsl:value-of
                select="url"/></xsl:attribute><xsl:value-of select="name"/></a>,
        </xsl:if>
        <xsl:if test="not(url)">
            <xsl:value-of select="name"/>,
        </xsl:if>
	<xsl:value-of select="location"/>.  <xsl:value-of select="dates"/>.
    </em></p>
</xsl:template>

<xsl:template match="article">
    <dt>Article:</dt>
    <dd><b><xsl:value-of select="title"/>.  </b>
	<xsl:value-of select="authors"/>.
	<em><xsl:value-of select="magazine"/>
	(<xsl:value-of select="date"/>)</em>.
    </dd>
</xsl:template>

<xsl:template match="patent">
    <dt>Patent <xsl:value-of select="number"/>:</dt>
    <dd><b><xsl:value-of select="title"/>.  </b>
	<xsl:value-of select="inventors"/>.
	Issued <xsl:value-of select="date"/>.
    </dd>
</xsl:template>

</xsl:stylesheet>
