<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:gzen="http://www.cs.cmu.edu/~gzen/schema">

<xsl:template match="/">
  <html>
    <head>
      <title>Resume: <xsl:value-of select="gzen:resume/gzen:personalInfo/gzen:name"/></title>
    </head>
    <body>
      <xsl:apply-templates select="gzen:resume"/>
      <hr width="100%" noshade="true"></hr>
      <font face="Arial" size="-2" color="#000000">
        <div>
          Source: <a href="http://www.cs.cmu.edu/~gzen/schema/resume.xsd">resume.xsd</a>, <a href="http://www.cs.cmu.edu/~gzen/resume.xml">resume.xml</a>, <a href="http://www.cs.cmu.edu/~gzen/resume.xsl">resume.xsl</a>.
          Other formats: <a href="http://www.cs.cmu.edu/~gzen/resume.doc">resume.doc (MS Word)</a>, <a href="http://www.cs.cmu.edu/~gzen/resume.pdf">resume.pdf (PDF)</a>.
        </div>
      </font>
    </body>
  </html>
</xsl:template>

<xsl:template match="gzen:resume">
  <xsl:apply-templates select="gzen:personalInfo"/>
  <xsl:apply-templates select="gzen:skills"/>
  <xsl:apply-templates select="gzen:education"/>
  <xsl:apply-templates select="gzen:projects"/>
  <xsl:apply-templates select="gzen:works"/>
  <xsl:apply-templates select="gzen:associations"/>
  <xsl:apply-templates select="gzen:awards"/>
  <xsl:apply-templates select="gzen:seminars"/>
</xsl:template>

<xsl:template match="gzen:personalInfo">
  <table width="100%" border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td width="50%" valign="top">
        <font face="Arial Black" size="+2" color="#000000">
          <div>
            <xsl:value-of select="gzen:name"/>
          </div>
        </font>
        <xsl:if test="gzen:distinction">
          <font face="Arial" size="-1" color="#000000">
            <div>
              <b><i><xsl:value-of select="gzen:distinction"/></i></b>
            </div>
          </font>
        </xsl:if>
      </td>
      <td width="22%" valign="top">
        <font face="Arial" size="-2" color="#000000">
          <div>
            <xsl:value-of select="gzen:address/gzen:street"/>
            <xsl:if test="gzen:address/gzen:line2">,
              <xsl:value-of select="gzen:address/gzen:line2"/>
            </xsl:if>
          </div>
          <div>
            <xsl:value-of select="gzen:address/gzen:city"/>, 
            <xsl:value-of select="gzen:address/gzen:state"/>
            <xsl:text> </xsl:text>
            <xsl:value-of select="gzen:address/gzen:zip"/><xsl:if test="gzen:address/gzen:plus4">-<xsl:value-of select="gzen:address/gzen:plus4"/></xsl:if>
          </div>
        </font>
      </td>
      <td width="28%" valign="top">
        <font face="Arial" size="-2" color="#000000">
          <xsl:if test="gzen:phone[@xsi:nil!='true']">
            <div>
              Phone: (<xsl:value-of select="gzen:phone/gzen:areaCode"/>) <xsl:value-of select="gzen:phone/gzen:exchange"/>-<xsl:value-of select="gzen:phone/gzen:local"/>
            </div>
          </xsl:if>
          <div>
            Email: <img src="{gzen:email}" alt="gzen[at]cs[.]cmu[.]edu"/> <!-- a href="mailto:{gzen:email}"><xsl:value-of select="gzen:email"/></a -->
          </div>
          <div>
            Web: <a href="{gzen:homepage}"><xsl:value-of select="gzen:homepage"/></a>
          </div>
        </font>
      </td>
    </tr>
  </table>
</xsl:template>

<xsl:template match="gzen:summary">
  <div style="margin-top: 12px; text-align: justify">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Summary</b>
      <hr width="100%" noshade="true"></hr>
      <xsl:value-of select="."/>
    </font>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:skills">
  <div style="margin-top: 12px; text-align: justify">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Technical Skills</b>
      <hr width="100%" noshade="true"></hr>
      <xsl:for-each select="gzen:skill">
        <xsl:value-of select="."/>
        <xsl:choose>
          <xsl:when test="position()!=last()">, </xsl:when>
          <xsl:otherwise>.</xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </font>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:projects">
  <div style="margin-top: 12px">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Related Projects</b>
    </font>
    <hr width="100%" noshade="true"></hr>
    <xsl:for-each select="gzen:project">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="60%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <b><xsl:value-of select="@organization"/></b>
            </font>
          </td>
          <td width="40%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <xsl:value-of select="@timeframe"/>
            </font>
          </td>
        </tr>
      </table>
      <font face="Arial" size="-1" color="#000000">
        <div style="text-align: justify">
          <b><xsl:value-of select="@title"/>. </b>
          <xsl:value-of select="gzen:concept"/>
        </div>
        <xsl:if test="position()!=last()">
          <div>
            <p></p>
          </div>
        </xsl:if>
      </font>
    </xsl:for-each>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:works">
  <div style="margin-top: 12px">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Work Experience</b>
    </font>
    <hr width="100%" noshade="true"></hr>
    <xsl:for-each select="gzen:work">
      <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
          <td width="22%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <xsl:value-of select="gzen:start/gzen:month"/>/<xsl:value-of select="gzen:start/gzen:year"/>
              -
              <xsl:choose>
                <xsl:when test="gzen:end[@xsi:nil='true']">
                  present
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="gzen:end/gzen:month"/>/<xsl:value-of select="gzen:end/gzen:year"/>
                </xsl:otherwise>
              </xsl:choose>
            </font>
          </td>
          <td width="58%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <b><xsl:value-of select="gzen:employer"/></b>
            </font>
          </td>
          <td width="25%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <xsl:value-of select="gzen:location"/>
            </font>
          </td>
        </tr>
      </table>
      <font face="Arial" size="-1" color="#000000">
        <b><xsl:value-of select="gzen:position"/></b>
        <dl style="margin-top: 0px; margin-bottom: 0px">
          <xsl:for-each select="gzen:duties/gzen:duty">
            <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="@desc"/></li>
            <ul style="margin-top: 0px; margin-bottom: 0px">
              <xsl:for-each select="gzen:task">
                <xsl:choose>
                  <xsl:when test="gzen:concept">
                    <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="gzen:concept"/></li>
                    <ul style="margin-top: 0px; margin-bottom: 0px">
                      <xsl:for-each select="gzen:elaboration">
                        <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="."/></li>
                      </xsl:for-each>
                    </ul>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:for-each select="gzen:elaboration">
                      <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="."/></li>
                    </xsl:for-each>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:for-each>
            </ul>
          </xsl:for-each>
        </dl>
        <xsl:if test="position()!=last()">
          <div>
            <p></p>
          </div>
        </xsl:if>
      </font>
    </xsl:for-each>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:education">
  <div style="margin-top: 6px">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Education</b>
    </font>
    <hr width="100%" noshade="true"></hr>
    <xsl:for-each select="gzen:program">
      <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
          <td width="30%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <xsl:value-of select="gzen:start"/>
              -
              <xsl:choose>
                <xsl:when test="gzen:end[@xsi:nil='true']">
                  present
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="gzen:end"/>
                </xsl:otherwise>
              </xsl:choose>
            </font>
          </td>
          <td width="50%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <b><xsl:value-of select="gzen:school"/></b>
            </font>
          </td>
          <td width="20%" valign="top">
            <font face="Arial" size="-1" color="#000000">
              <xsl:value-of select="gzen:location"/>
            </font>
          </td>
        </tr>
      </table>
      <font face="Arial" size="-1" color="#000000">
        <xsl:for-each select="gzen:degree">
          <b><xsl:value-of select="@type"/><xsl:choose><xsl:when test="gzen:major[@xsi:nil='true']"></xsl:when><xsl:otherwise> in <xsl:value-of select="gzen:major"/></xsl:otherwise></xsl:choose></b>
        </xsl:for-each>
        <!-- ul style="margin-top: 0px; margin-bottom: 0px" -->
        <xsl:if test="gzen:honors">
          (<xsl:for-each select="gzen:honors/gzen:honor">
              <!-- li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="."/></li -->
              <xsl:value-of select="."/>
              <xsl:if test="position()!=last()">, </xsl:if>
          </xsl:for-each>)
        </xsl:if>
        <!-- /ul -->
      </font>
    </xsl:for-each>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:associations">
  <div style="margin-top: 12px">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Professional Memberships</b>
      <hr width="100%" noshade="true"></hr>
      <dl style="margin-top: 0px; margin-bottom: 0px">
        <xsl:for-each select="gzen:association">
          <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="@name"/></li>
          <ul style="margin-top: 0px; margin-bottom: 0px">
            <xsl:if test="gzen:membershipDetails">
              <xsl:for-each select="gzen:membershipDetails/gzen:membershipDetail">
                <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="."/></li>
              </xsl:for-each>
            </xsl:if>
          </ul>
        </xsl:for-each>
      </dl>
    </font>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:awards">
  <div style="margin-top: 12px">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Awards and Recognition</b>
      <hr width="100%" noshade="true"></hr>
      <dl style="margin-top: 0px; margin-bottom: 0px">
        <xsl:for-each select="gzen:award">
          <li style="margin-top: 0px; margin-bottom: 0px"><xsl:value-of select="."/></li>
        </xsl:for-each>
      </dl>
    </font>
  </span>
  </div>
</xsl:template>

<xsl:template match="gzen:seminars">
  <div style="margin-top: 12px">
  <span style="margin-top: 0px">
    <font face="Arial" size="-1" color="#000000">
      <b>Seminars Attended</b>
    <hr width="100%" noshade="true"></hr>
      <xsl:for-each select="gzen:seminar">
        <div style="text-align: left">
          <xsl:value-of select="."/>
        </div>
      </xsl:for-each>
    </font>
  </span>
  </div>
</xsl:template>

</xsl:stylesheet>
