<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:hr="http://ns.hr-xml.org/2007-04-15"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:europass="http://europass.cedefop.europa.eu/Europass/V1.2" 
 version="1.0"
 exclude-result-prefixes="xsl hr xsd">
  <!--
    This file is part of the HR-XML Europass CV application profile.
    Copyright © 2006-2008 - Marc Van Coillie <marc.van.coillie@eife-l.org>
    
    This software is distributed under opensource GNU LGPL License:
    
    HR-XML Europass CV application profile is free software; 
    you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    any later version.
    
    HR-XML Europass CV application profile is distributed in the hope that it  be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  -->
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" indent="yes"/>
  <xsl:template match="/">
    <xsl:processing-instruction name="xml-stylesheet">href="http://europass.cedefop.europa.eu/xml/cv_en_GB.xsl" type="text/xsl"</xsl:processing-instruction>
    <europass:learnerinfo 
     xmlns:europass="http://europass.cedefop.europa.eu/Europass/V1.2"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://europass.cedefop.europa.eu/Europass/V1.2 http://europass.cedefop.europa.eu/xml/EuropassSchema_V1.2.xsd">
      <xsl:attribute name="locale">
        <xsl:value-of select="translate(/hr:Candidate/@xml:lang, '-', '_')"/>
      </xsl:attribute>
      <docinfo>
<xsl:choose>
  <xsl:when test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:RevisionDate!=''">
  <issuedate>
  <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:RevisionDate"/>
  </issuedate>
  </xsl:when>
          <xsl:otherwise>
            <issuedate>notKnown</issuedate>
          </xsl:otherwise>
        </xsl:choose>
        <xsdversion>V1.2</xsdversion>
        <comment>Automatically generated Europass CV from HR-XML Europass CV AP v1.2.0 using EIfEL XSLT v1.2.0, please report any bug to marc.van.coillie@eife-l.org</comment>
      </docinfo>
      <prefs>
          <xsl:call-template name="prefs">
          </xsl:call-template>
        </prefs>
          
      <identification>
              <firstname>
                <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:PersonName/hr:GivenName"/>                
              </firstname>
              <lastname>
                <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:PersonName/hr:FamilyName"/>
              </lastname>
              
              <contactinfo>
                <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod/hr:PostalAddress">
                  <address>
                    <addressLine>
                      <xsl:value-of select="hr:DeliveryAddress/hr:AddressLine"/>
                    </addressLine>
                    <municipality>
                      <xsl:value-of select="hr:Municipality"/>
                    </municipality>
                    <postalCode>
                      <xsl:value-of select="hr:PostalCode"/> 
                    </postalCode>
                    <country>
                      <code><xsl:value-of select="hr:CountryCode"/></code>
                      <label><xsl:value-of select="hr:CountryCode"/></label>
                    </country>
<!--                    <xsl:call-template name="countryName">
                      <xsl:with-param name="code">
                        <xsl:value-of select="hr:CountryCode"/>
                      </xsl:with-param>
                    </xsl:call-template>
-->                    
                  </address>
                </xsl:for-each>
                
                <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:Telephone]">
                  <telephone>
                    <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod/hr:Telephone/hr:FormattedNumber"/>
                  </telephone>
                </xsl:if>
                
                <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:Fax]">
                  <fax>
                    <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod/hr:Fax/hr:FormattedNumber"/>
                  </fax>
                </xsl:if>

                <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:Mobile]">
                  <mobile>
                    <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod/hr:Mobile/hr:FormattedNumber"/>
                  </mobile>
                </xsl:if>
                
                <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:InternetEmailAddress]">
                  <email>
                    <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod/hr:InternetEmailAddress"/>
                  </email>
                </xsl:if>
              </contactinfo>
              
              <demographics>
                <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:DateOfBirth">
                  <birthdate>
                        <xsl:value-of select="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:DateOfBirth"/>
                  </birthdate>
                </xsl:if>
                
                 <xsl:choose>
                   <xsl:when test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:GenderCode = 1">
                     <gender>M</gender>
                   </xsl:when>
                   <xsl:when test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:GenderCode = 2">
                     <gender>F</gender>
                   </xsl:when>
                   <xsl:when test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:GenderCode = 3">
                     <gender>NA</gender>
                   </xsl:when>
                  </xsl:choose>
                                  
                <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:DemographicDescriptors/hr:Nationality">
                  <nationality>
                    <code>
                      <xsl:value-of select="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:DemographicDescriptors/hr:Nationality"/>
                    </code>
                    <label>
                      <xsl:value-of select="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:DemographicDescriptors/hr:Nationality"/>
                    </label>
                  </nationality>
                </xsl:if>
              </demographics>

        <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:SupportingMaterials/hr:Description!=''">
            <xsl:element name="photo">
              <xsl:attribute name="type"><xsl:value-of select="translate(/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:SupportingMaterials/hr:AttachmentReference/attribute::mimeType, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/></xsl:attribute>
              <xsl:value-of select="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:SupportingMaterials/hr:Description"/>
            </xsl:element>
        </xsl:if>
        
      
      </identification>
              
      <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Objective">
              <application>
                <xsl:value-of select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Objective"/>
              </application>
            </xsl:if>
            
      <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EmploymentHistory/hr:EmployerOrg">
              <workexperiencelist>
                <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EmploymentHistory/hr:EmployerOrg">
                  <workexperience>
                    <period>
                      <from>
                        <xsl:for-each select="hr:PositionHistory/hr:StartDate/hr:AnyDate">
                          <xsl:call-template name="transform-date">
                            <xsl:with-param name="node">
                              <xsl:copy-of select="."/>
                            </xsl:with-param>
                          </xsl:call-template>
                        </xsl:for-each>
                      </from>
                      <to>
                        <xsl:for-each select="hr:PositionHistory/hr:EndDate/hr:AnyDate">
                          <xsl:call-template name="transform-date">
                            <xsl:with-param name="node">
                              <xsl:copy-of select="."/>
                            </xsl:with-param>
                          </xsl:call-template>
                        </xsl:for-each>
                      </to>
                    </period>
                    <position><xsl:value-of select="hr:PositionHistory/hr:Title"/></position>
                    <activities><xsl:value-of select="hr:PositionHistory/hr:Description"/></activities>
                    <employer><xsl:value-of select="hr:EmployerOrgName"/></employer>
                    <sector><xsl:value-of select="hr:PositionHistory[1]/hr:OrgIndustry[1]/hr:IndustryDescription"/></sector>
                  </workexperience>
                </xsl:for-each>
              </workexperiencelist>
            </xsl:if>
            
      <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EducationHistory/hr:SchoolOrInstitution">
              <educationlist>
                <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EducationHistory/hr:SchoolOrInstitution">
                  <education>
                    <period>
                      <from>
                        <xsl:for-each select="hr:Degree/hr:DatesOfAttendance/hr:StartDate/hr:AnyDate">
                          <xsl:call-template name="transform-date">
                            <xsl:with-param name="node">
                              <xsl:copy-of select="."/>
                            </xsl:with-param>
                          </xsl:call-template>
                          </xsl:for-each>
                      </from>
                      <to>
                        <xsl:for-each select="hr:Degree/hr:DatesOfAttendance/hr:EndDate/hr:AnyDate">
                          <xsl:call-template name="transform-date">
                            <xsl:with-param name="node">
                              <xsl:copy-of select="."/>
                            </xsl:with-param>
                          </xsl:call-template>
                        </xsl:for-each>
                      </to>
                    </period>
                    <title>
                      <xsl:value-of select="hr:Degree/hr:DegreeName"/>
                    </title>
                    <skills>
                      <xsl:value-of select="hr:Degree/hr:Comments"/>
                    </skills>
                    <organisation>
                      <xsl:value-of select="hr:School/hr:SchoolName"/>
                    </organisation>
                    <level>
                      <xsl:value-of select="hr:Degree/hr:DegreeClassification/hr:Description"/>
                    </level>
                  </education>
                </xsl:for-each>
              </educationlist>
            </xsl:if>
            
            <languagelist>
              <xsl:for-each select="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:DemographicDescriptors/hr:PrimaryLanguage">
                <language type="mother">
                  <code>
                    <xsl:value-of select="."/>
                  </code>
                  <label>
                    <xsl:value-of select="."/>
                  </label>
                </language>
              </xsl:for-each>
            
              <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Qualifications/hr:Competency[@description='CEF']/hr:Competency">
                <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Qualifications/hr:Competency[@description='CEF']/hr:Competency">
                  <language type="foreign">
                    <code>
                      <xsl:value-of select="@name"/>
                      <!-- <xsl:value-of select="hr:CompetencyId/@id"/>  -->
                    </code>
                    <label>
                      <xsl:value-of select="@description"/>
                    </label>
                    <level>
                      <listening>
                        <xsl:value-of select="translate(hr:Competency[@name='CEF-Understanding-Listening']/hr:CompetencyEvidence/hr:StringValue, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
                      </listening>
                      <reading>
                        <xsl:value-of select="translate(hr:Competency[@name='CEF-Understanding-Reading']/hr:CompetencyEvidence/hr:StringValue, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
                      </reading>
                      <spokeninteraction>
                        <xsl:value-of select="translate(hr:Competency[@name='CEF-Speaking-SpokenInteraction']/hr:CompetencyEvidence/hr:StringValue, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
                      </spokeninteraction>
                      <spokenproduction>
                        <xsl:value-of select="translate(hr:Competency[@name='CEF-Speaking-SpokenProduction']/hr:CompetencyEvidence/hr:StringValue, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
                      </spokenproduction>
                      <writing>
                        <xsl:value-of select="translate(hr:Competency[@name='CEF-Writing']/hr:CompetencyEvidence/hr:StringValue, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
                      </writing>
                    </level>
                  </language>
                </xsl:for-each>
              </xsl:if>
            </languagelist>
            
            <skilllist>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">social</xsl:with-param>
                <xsl:with-param name="title">__(Social skills and competences)</xsl:with-param>
              </xsl:call-template>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">organisational</xsl:with-param>
                <xsl:with-param name="title">__(Organisational skills and competences)</xsl:with-param>
              </xsl:call-template>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">technical</xsl:with-param>
                <xsl:with-param name="title">__(Technical skills and competences)</xsl:with-param>
              </xsl:call-template>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">computer</xsl:with-param>
                <xsl:with-param name="title">__(Computer skills and competences)</xsl:with-param>
              </xsl:call-template>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">artistic</xsl:with-param>
                <xsl:with-param name="title">__(Artistic skills and competences)</xsl:with-param>
              </xsl:call-template>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">other</xsl:with-param>
                <xsl:with-param name="title">__(Other skills and competences)</xsl:with-param>
              </xsl:call-template>
              <xsl:call-template name="competencySection">
                <xsl:with-param name="name">driving</xsl:with-param>
                <xsl:with-param name="title">__(Driving licence(s))</xsl:with-param>
              </xsl:call-template>
            </skilllist>
              
            <misclist>
              <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ResumeAdditionalItems/hr:ResumeAdditionalItem">
                <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ResumeAdditionalItems/hr:ResumeAdditionalItem">
                  <misc type="additional">
                    <xsl:value-of select="hr:Description"/>
                  </misc>
                </xsl:for-each>
              </xsl:if>
              
              <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:SupportingMaterials">
                <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:SupportingMaterials">
                  <misc type="annexes">
                    <xsl:value-of select="hr:Description"/>
                    <xsl:value-of select="hr:AttachmentReference"/>
                  </misc>
                </xsl:for-each>
              </xsl:if>
            </misclist>
          
    </europass:learnerinfo>
  </xsl:template>
  

  <xsl:template name="countryName">
    <xsl:param name="code"/>
    <xsl:variable name="value">
      <xsl:value-of select="translate($code, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
    </xsl:variable>
    <xsl:value-of select="$value"/>
  </xsl:template>
  
  <xsl:template name="competencySection">
    <xsl:param name="name"/>
    <xsl:param name="title"/>
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Qualifications/hr:Competency/hr:Competency[@name=$name]">
      <skill>
		<xsl:attribute name="type">
			<xsl:value-of select="$name"/>
		</xsl:attribute>
        <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Qualifications/hr:Competency/hr:Competency[@name=$name]">
          <xsl:value-of select="@description"/>
        </xsl:for-each>
      </skill>
    </xsl:if>
  </xsl:template>

  <xsl:template name="transform-date">
    <xsl:param name="node"/>
    <xsl:variable name="year">
      <xsl:value-of select="substring-before($node,'-')"/>
    </xsl:variable>
    <xsl:variable name="month">
      <xsl:value-of select="substring-before(substring-after($node,'-'),'-')"/>
    </xsl:variable>
    <xsl:variable name="day">
      <xsl:value-of select="substring-after(substring-after($node,'-'),'-')"/>
    </xsl:variable>
    <year><xsl:value-of select="$year"/></year>
    <month>--<xsl:value-of select="$month"/></month>
    <day>---<xsl:value-of select="$day"/></day>
  </xsl:template>

  <xsl:template name="prefs">
    <field name="step1.firstName" before="step1.lastName"/>
    <field name="step1.address" keep="true"/>
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:Telephone]">
      <field name="step1.telephone" keep="true"/>
     </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:Mobile]">
      <field name="step1.mobile" keep="true"/>
    </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:Fax]">
      <field name="step1.fax" keep="true"/>
    </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:ContactInfo/hr:ContactMethod[hr:InternetEmailAddress]">
      <field name="step1.email" keep="true"/>
    </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:DemographicDescriptors/hr:Nationality">
      <field name="step1.nationality" keep="true"/>
    </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:DateOfBirth">
      <field name="step1.birthDate" keep="true" format=""/>
    </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:BiologicalDescriptors/hr:GenderCode">
      <field name="step1.gender" keep="true"/>
    </xsl:if> 
    <xsl:if test="/hr:Candidate/hr:CandidateProfile/hr:PersonalData/hr:PersonDescriptors/hr:SupportingMaterials/hr:Description!=''">
      <field name="step1.photo" keep="true"/>
    </xsl:if> 
    <field name="step1.application" keep="true"/>

    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EmploymentHistory/hr:EmployerOrg">
      <field name="step3List" keep="true" before="step4List"/>
      <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EmploymentHistory/hr:EmployerOrg">
        <field>
          <xsl:attribute name="name">step3List[<xsl:value-of select="count(preceding::hr:EmployerOrg)"/>].period</xsl:attribute>
          <xsl:attribute name="format">/numeric/long</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step3List[<xsl:value-of select="count(preceding::hr:EmployerOrg)"/>].position</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step3List[<xsl:value-of select="count(preceding::hr:EmployerOrg)"/>].activities</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step3List[<xsl:value-of select="count(preceding::hr:EmployerOrg)"/>].employer</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step3List[<xsl:value-of select="count(preceding::hr:EmployerOrg)"/>].sector</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
      </xsl:for-each>
    </xsl:if>
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EducationHistory/hr:SchoolOrInstitution">
      <field name="step4List" keep="true"/>
      <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:EducationHistory/hr:SchoolOrInstitution">
        <!-- 
          <xsl:value-of select="count(preceding::hr:SchoolOrInstitution)"/>
          <field name="step4List[1].period" format="/numeric/long"/>
        -->
        <field>
        <xsl:attribute name="name">step4List[<xsl:value-of select="count(preceding::hr:SchoolOrInstitution)"/>].period</xsl:attribute>
          <xsl:attribute name="format">/numeric/long</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step4List[<xsl:value-of select="count(preceding::hr:SchoolOrInstitution)"/>].title</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step4List[<xsl:value-of select="count(preceding::hr:SchoolOrInstitution)"/>].skills</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step4List[<xsl:value-of select="count(preceding::hr:SchoolOrInstitution)"/>].organisation</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
        <field>
          <xsl:attribute name="name">step4List[<xsl:value-of select="count(preceding::hr:SchoolOrInstitution)"/>].level</xsl:attribute>
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
      </xsl:for-each>
    </xsl:if>  
    <field name="step5.motherLanguages" keep="true"/>
    <field name="step5.foreignLanguageList" keep="true"/>
    <xsl:if test="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Qualifications/hr:Competency[@description='CEF']/hr:Competency">
      <xsl:for-each select="/hr:Candidate/hr:Resume/hr:StructuredXMLResume/hr:Qualifications/hr:Competency[@description='CEF']/hr:Competency">
        <field>
          <xsl:attribute name="name">step5.foreignLanguageList[<xsl:value-of select="position()-1"/>]</xsl:attribute>
<!-- <xsl:attribute name="name">step5.foreignLanguageList[<xsl:value-of select="count(preceding::hr:Competency[@description='CEF']/hr:Competency)"/>]</xsl:attribute>
-->          
          <xsl:attribute name="keep">true</xsl:attribute>
        </field>
      </xsl:for-each>
    </xsl:if>          
    <field name="step6.socialSkills" keep="true"/>
    <field name="step6.organisationalSkills" keep="true"/>
    <field name="step6.technicalSkills" keep="true"/>
    <field name="step6.computerSkills" keep="true"/>
    <field name="step6.artisticSkills" keep="true"/>
    <field name="step6.otherSkills" keep="true"/>
    <field name="step6.drivingLicences" keep="true"/>
    <field name="step7.additionalInfo" keep="true"/>
    <field name="step7.annexes" keep="true"/>
    <field name="grid" keep="false"/>
  </xsl:template>
  
</xsl:stylesheet>
