<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
 <!ENTITY Egrave "&#200;">
 <!ENTITY egrave "&#232;">
 <!ENTITY agrave "&#224;">
 <!ENTITY ugrave "&#249;">
 <!ENTITY nbsp "&#160;">
 <!ENTITY copy "&#0169;">
 <!ENTITY laquo "&#0171;">
 <!ENTITY raquo "&#0187;">
]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
  <xsl:param name="currpage" />
  <xsl:param name="language" />
  <xsl:param name="date" />

<xsl:template match="/">
  <xsl:apply-templates select="*/application" />
  <xsl:apply-templates select="*/workexperiencelist" />
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="application">

  <a name="application"><xsl:text> </xsl:text></a>

  <xsl:choose>
    <xsl:when test="$language = 'it-IT'">

      <div class="post">
          <h2 class="title"> occupazione desiderata (oggi)</h2>
          <div class="entry"><xsl:text> </xsl:text>
             <xsl:call-template name="add-line-breaks"><xsl:with-param name="string" select="."/></xsl:call-template>
          </div>
          <div class="meta">
            <p class="byline">Aggiornato il <xsl:call-template name="render-date"><xsl:with-param name="date" select="$date"/></xsl:call-template>, Alessandro Polo</p>
            <p class="links"><a href="/curriculum/alessandro.polo.cv.it.html" class="more">versione stampa</a></p>
          </div>
        </div>

    </xsl:when>
    <xsl:otherwise>

      <div class="post">
          <h2 class="title"> application (today)</h2>
          <div class="entry"><xsl:text> </xsl:text>
             <xsl:call-template name="add-line-breaks"><xsl:with-param name="string" select="."/></xsl:call-template>
          </div>
          <div class="meta">
            <p class="byline">Updated on <xsl:call-template name="render-date"><xsl:with-param name="date" select="$date"/></xsl:call-template>, Alessandro Polo</p>
            <p class="links"><a href="/curriculum/alessandro.polo.cv.en.html" class="more">printer friendly</a></p>
          </div>
        </div>

    </xsl:otherwise>
   </xsl:choose>
  
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="workexperiencelist">

  <a name="experience"><xsl:text> </xsl:text></a>

  <xsl:choose>
    <xsl:when test="$language = 'it-IT'">

      <div class="post">
          <h2 class="title"> esperienze lavorative</h2>
          <div class="entry">
            <table class="wtable">
             <xsl:for-each select="workexperience">
               <tr>
                 <td class="tblfield">Periodo:</td>
                 <td class="tbldata">da <xsl:apply-templates select="period/from"/> a <xsl:apply-templates select="period/to"/></td>
               </tr>
               <tr>
                 <td class="tblfield">Posizione:</td>
                 <td class="tbldata"><strong><xsl:value-of select="position"/></strong></td>
               </tr>
               <tr>
                 <td class="tblfield">Settore:</td>
                 <td class="tbldata"><xsl:value-of select="sector"/></td>
               </tr>
               <tr>
                 <td class="tblfield">Attivit&#224;:</td>
                 <td class="tbldata"><xsl:call-template name="add-line-breaks"><xsl:with-param name="string" select="activities"/></xsl:call-template></td>
               </tr>
               <tr>
                 <td class="tblfield">Datore di Lavoro:</td>
                 <td class="tbldata"><xsl:call-template name="add-line-breaks"><xsl:with-param name="string" select="employer"/></xsl:call-template></td>
               </tr>
              <xsl:if test="position() &lt; last()">
               <tr>
                 <td colspan="2"><div class="separator"><xsl:text> </xsl:text></div></td>
               </tr>
              </xsl:if>
             </xsl:for-each>
            </table>
          </div>
          <div class="meta">
            <p class="byline">Aggiornato il <xsl:call-template name="render-date"><xsl:with-param name="date" select="$date"/></xsl:call-template>, Alessandro Polo</p>
            <p class="links"><a href="/curriculum/alessandro.polo.cv.it.html#work" class="more">versione stampa</a> <b>|</b> <a href="/curriculum/alessandro.polo.cv.it.pdf" class="comments">PDF format</a></p>
          </div>
        </div>

    </xsl:when>
    <xsl:otherwise>

        <div class="post">
          <h2 class="title"> work experience</h2>
          <div class="entry">
            <table class="wtable">
             <xsl:for-each select="workexperience">
               <tr>
                 <td class="tblfield">Date:</td>
                 <td class="tbldata">from <xsl:apply-templates select="period/from"/> to <xsl:apply-templates select="period/to"/></td>
               </tr>
               <tr>
                 <td class="tblfield">Position:</td>
                 <td class="tbldata"><strong><xsl:value-of select="position"/></strong></td>
               </tr>
               <tr>
                 <td class="tblfield">Sector:</td>
                 <td class="tbldata"><xsl:value-of select="sector"/></td>
               </tr>
               <tr>
                 <td class="tblfield">Activities:</td>
                 <td class="tbldata"><xsl:call-template name="add-line-breaks"><xsl:with-param name="string" select="activities"/></xsl:call-template></td>
               </tr>
               <tr>
                 <td class="tblfield">Employer:</td>
                 <td class="tbldata"><xsl:call-template name="add-line-breaks"><xsl:with-param name="string" select="employer"/></xsl:call-template></td>
               </tr>
              <xsl:if test="position() &lt; last()">
               <tr>
                 <td colspan="2"><div class="separator"><xsl:text> </xsl:text></div></td>
               </tr>
              </xsl:if>
             </xsl:for-each>
            </table>
          </div>
          <div class="meta">
            <p class="byline">Updated on <xsl:call-template name="render-date"><xsl:with-param name="date" select="$date"/></xsl:call-template>, Alessandro Polo</p>
            <p class="links"><a href="/curriculum/alessandro.polo.cv.en.html#work" class="more">printer friendly</a> <b>|</b> <a href="/curriculum/alessandro.polo.cv.en.pdf" class="comments">PDF format</a></p>
          </div>
        </div>
    </xsl:otherwise>
   </xsl:choose>
  
</xsl:template>




<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template name="render-date">
   <xsl:param name="date" />

   <xsl:if test="not (substring($date, 9, 1) = '0')">
    <xsl:value-of select="substring($date, 9, 1)" />
   </xsl:if>
   <xsl:value-of select="substring($date, 10, 1)" />
   <xsl:text> </xsl:text>

  <xsl:choose>
    <xsl:when test="$language = 'it-IT'">
      <xsl:choose>
        <xsl:when test="substring($date, 6, 2) = '01'">Gennaio</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '02'">Febbraio</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '03'">Marzo</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '04'">Aprile</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '05'">Maggio</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '06'">Giugno</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '07'">Luglio</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '08'">Agosto</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '09'">Settembre</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '10'">Ottobre</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '11'">Novembre</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '12'">Dicembre</xsl:when>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:choose>
        <xsl:when test="substring($date, 6, 2) = '01'">January</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '02'">February</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '03'">March</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '04'">April</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '05'">May</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '06'">June</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '07'">July</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '08'">August</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '09'">September</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '10'">October</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '11'">November</xsl:when>
        <xsl:when test="substring($date, 6, 2) = '12'">December</xsl:when>
      </xsl:choose>
    </xsl:otherwise>
   </xsl:choose>

   <xsl:text> </xsl:text>
   <xsl:value-of select="substring($date, 1, 4)" />

</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<xsl:template name="add-line-breaks">
   <xsl:param name="string" />

   <xsl:choose>
      <xsl:when test="contains($string, '&#xD;')">
         <xsl:value-of select="substring-before($string, '&#xD;')" />
         <br />
         <xsl:call-template name="add-line-breaks">
            <xsl:with-param name="string"
                            select="substring-after($string, '&#xD;')" />
         </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
         <xsl:value-of select="$string" />
      </xsl:otherwise>
   </xsl:choose>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="period/from | period/to">

  <xsl:choose>
    <xsl:when test="year and not(year='')">
      <xsl:value-of select="year"/>
      <xsl:if test="month and not(month='')">-<xsl:value-of select="month"/>
      <xsl:if test="day and not(day='')">-<xsl:value-of select="day"/></xsl:if>
      </xsl:if>
    </xsl:when>
    <xsl:otherwise>
      <xsl:choose>
        <xsl:when test="$language='it-IT'">
          Attualmente Attivo
        </xsl:when>
        <xsl:otherwise>
          Currently Active (not completed jet)
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>

</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="anchor">
  <a name="{.}">&nbsp;<xsl:text> </xsl:text></a>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="para">

  <xsl:element name="p">
    <xsl:for-each select="@*">
      <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
    </xsl:for-each>
    <xsl:apply-templates/>
  </xsl:element>

</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="unorderedlist">
  <ul>
    <xsl:for-each select="listitem">
       <li><xsl:apply-templates /></li>
    </xsl:for-each>
  </ul>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

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

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="@*|a|img|br|i" priority="-1">
  <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="text()">
  <xsl:value-of select="."/>
<!--      <xsl:value-of select="normalize-space()"/>    -->
</xsl:template>

<!--

<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
  <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
</xsl:template>

<xsl:template match="@*|node()" priority="-1">
  <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>
-->


</xsl:stylesheet>

