<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="ISO-8859-1"/>


<!-- Handle the document element: set up the html page-->
<xsl:template match="cv">
  <html>
    <head><title>CV</title><link href="general.css" rel="stylesheet" type="text/css"/></head>
    <body><div id="content1">
      <xsl:apply-templates/>
    </div></body>
  </html>
</xsl:template>

<!-- took h2 as highest header because the xhtml2fo puts a page break
before each h1 -->
<xsl:template match="title">
  <center><h2><xsl:value-of select="."/></h2></center>
</xsl:template>

<!-- i opted for widths in %, since it will work for every possible
output format -->
<xsl:template match="personalData">
  <h3>Personal data</h3>
  <table bgcolor="#DDDDDD" border="1"><tr><td valign="top" width="50%">
   <table>
     <tr><td width="20%">Name:</td><td width="25%"><xsl:value-of select=".//lastName"/></td></tr>
     <tr><td width="20%">First name:</td><td width="25%"><xsl:value-of select=".//firstName"/></td></tr>
     <tr><td width="20%">Address:</td><td width="25%"><xsl:value-of select=".//address"/></td></tr>
     <tr><td width="20%">Phone:</td><td width="25%"><xsl:value-of select=".//phoneNumber"/></td></tr>
     <tr><td width="20%">Mobile:</td><td width="25%"><xsl:value-of select=".//gsmNumber"/></td></tr>
     <tr><td width="20%">Email:</td><td width="25%"><xsl:value-of select=".//eMail"/></td></tr>
   </table>
 </td><td valign="top" width="50%">
   <table>
     <tr><td width="20%">Place of birth:</td><td width="25%"><xsl:value-of select=".//placeOfBirth"/></td></tr>
     <tr><td width="20%">Date of birth:</td><td width="25%"><xsl:value-of select=".//dateOfBirth"/></td></tr>
     <tr><td width="20%">Nationality:</td><td width="25%"><xsl:value-of select=".//nationality"/></td></tr>
     <tr><td width="20%">Family Status:</td><td width="25%"><xsl:value-of select=".//familyStatus"/></td></tr>
     <tr><td width="20%">Gender:</td><td width="25%"><xsl:value-of select=".//gender"/></td></tr>
    </table>
 </td></tr></table>
</xsl:template>

<xsl:template match="education">
  <h3>Education</h3>
  <table bgcolor="#DDDDDD" border="1">
    <xsl:apply-templates/>
  </table>
</xsl:template>

<xsl:template match="study">
  <tr>
  <td valign="top" width="40%">
    <p><b><xsl:value-of select=".//level"/>: </b><xsl:value-of select=".//orientation"/></p>
    <p>School: <xsl:value-of select=".//school"/></p>
    <p>Period: <xsl:value-of select=".//start"/>-<xsl:value-of select=".//end"/></p>
    <xsl:apply-templates select="marks"/></td>
  <td valign="top" width="60%"><xsl:apply-templates select="thesis"/></td>
  </tr>
</xsl:template>

<!-- put marks in separate template, because it is not always present -->
<xsl:template match="marks">
  <p>Marks: <xsl:value-of select="."/></p>
</xsl:template>

<xsl:template match="thesis">
  <p><b>Thesis</b></p>
  <p>Title: <xsl:value-of select=".//title"/></p>
  <p>Field: <xsl:value-of select=".//field"/></p>
  <p>Promotor: <xsl:value-of select=".//promotor"/></p>
  <p>Marks: <xsl:value-of select=".//marks"/></p>
  <xsl:apply-templates select="publications"/> 
</xsl:template>

<xsl:template match="publications">
  <p><b>Publications</b></p>
  <xsl:apply-templates select="publication"/>
</xsl:template>


<xsl:template match="publication">
  <p><xsl:value-of select=".//authors"/>, <b><xsl:value-of
  select=".//title"/></b>, <xsl:value-of select=".//magazine"/>, 
  <xsl:value-of select=".//issue"/> p. <xsl:value-of select=".//page"/></p>
</xsl:template>

<xsl:template match="experienceCategory">
  <h3><xsl:value-of select="@name"/> knowledge</h3>
  <p><xsl:value-of select=".//description"/></p>
  <table bgcolor="#DDDDDD" border="1">
    <xsl:apply-templates select="subCategory"/>
  </table>
</xsl:template>

<xsl:template match="subCategory">
  <tr>
    <td width="20%"><b><xsl:value-of select="@name"/></b></td>
    <td width="80%"><xsl:apply-templates select=".//item"/></td>
  </tr>
</xsl:template>

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

<xsl:template match="jobs">
  <h3>Jobs</h3>
  <table bgcolor="#DDDDDD" border="1">
    <tr>
      <td width="20%"><center><b>Time, Company, Department, Role</b></center></td>
      <td width="30%"><center><b>Description</b></center></td>
      <td width="50%"><center><b>Tasks</b></center></td>
    </tr>
  <xsl:apply-templates select=".//job"/>
  </table>
</xsl:template>

<xsl:template match="job">
  <tr>
    <td width="20%" valign="top">
      <p><xsl:value-of select=".//start"/> - <xsl:value-of select=".//end"/></p>
      <p><xsl:value-of select=".//company"/></p>
      <p><xsl:value-of select=".//department"/></p>
      <p><xsl:value-of select=".//role"/></p></td>
    <td width="30%" valign="top"><xsl:value-of select=".//description"/></td>
    <td width="50%" valign="top"><xsl:apply-templates select=".//tasks"/>
                   <xsl:apply-templates select=".//publications"/></td>
  </tr>
</xsl:template>

<xsl:template match="tasks">
  <ul>
  <xsl:apply-templates select=".//task"/>
  </ul>
</xsl:template>

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

<xsl:template match="otherActivities">
  <h3>Other Activities</h3>
  <ul>
  <xsl:apply-templates select=".//activity"/>
  </ul>
</xsl:template>

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

<xsl:template match="references">
  <h3>References</h3>
  <ul>
  <xsl:apply-templates select=".//reference"/>
  </ul>
</xsl:template>

<xsl:template match="reference">
  <li><xsl:value-of select=".//name"/>; <xsl:value-of
  select=".//role"/>; <xsl:value-of select=".//company"/>; <xsl:value-of
  select=".//eMail"/>; <xsl:value-of select=".//phone"/>; <xsl:value-of select=".//extra"/>;</li>
</xsl:template>

</xsl:stylesheet>

