<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:europass="http://europass.cedefop.europa.eu/Europass/V1.0">
    <xsl:template match="//europass:learnerinfo">
        <Candidate xmlns="http://ns.hr-xml.org/2006-02-28" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" xsi:schemaLocation="http://ns.hr-xml.org/2006-02-28 http://ns.hr-xml.org/2_4/HR-XML-2_4/SEP/Candidate.xsd">
            <CandidateProfile>
                <xsl:element name="ProfileName">
                    <xsl:value-of select="docinfo/comment/text()"/> and xslt from EIfEL
                </xsl:element>
              </CandidateProfile>
            <Resume><StructuredXMLResume>
                <ContactInfo><PersonName><FormattedName>
                    <xsl:value-of select="identification/firstname/text()"/>    
                    <xsl:text disable-output-escaping="yes"> </xsl:text>
                    <xsl:value-of select="identification/lastname/text()"/>
                </FormattedName></PersonName>
                    <ContactMethod>
                        <PostalAddress>
                            <CountryCode>GB</CountryCode>
                            <DeliveryAddress>
                                <AddressLine>
                                    <xsl:value-of select="identification/contactinfo/address/text()"/>     
                                </AddressLine>
                            </DeliveryAddress>
                        </PostalAddress>
                    </ContactMethod>
                    <ContactMethod>
                        <Telephone>
                            <FormattedNumber>
                                <xsl:value-of select="identification/contactinfo/telephone/text()"/>     
                             </FormattedNumber>
                        </Telephone>
                    </ContactMethod>
                    <ContactMethod>
                        <InternetEmailAddress>
                            <xsl:value-of select="identification/contactinfo/email/text()"/>     
                        </InternetEmailAddress>
                    </ContactMethod>
                </ContactInfo>

                <Objective>
                    <xsl:value-of select="application/text()"/>     
                </Objective>
                
                <EmploymentHistory>
                    <xsl:for-each select="workexperiencelist/workexperience">
                    <EmployerOrg>
                        <EmployerOrgName>
                            <xsl:value-of select="employer/text()"/>     
                        </EmployerOrgName>
                        <PositionHistory>
                            <Title>
                                <xsl:value-of select="position/text()"/>     
                            </Title>
                            <OrgName>
                                <OrganizationName>
                                    <xsl:value-of select="employer/text()"/>     
                                </OrganizationName>
                            </OrgName>
                            <OrgIndustry primaryIndicator="true">
                                <IndustryDescription>
                                    <xsl:value-of select="sector/text()"/>     
                                </IndustryDescription>
                            </OrgIndustry>
                            <Description>
                                <xsl:value-of select="activities/text()"/>     
                            </Description>
                            <StartDate>
                                <AnyDate>
                                    <xsl:value-of select="period/from/year/text()"/>     
                                    <xsl:value-of select="substring(period/from/month/text(),2)"/>     
                                    <xsl:value-of select="substring(period/from/day/text(),3)"/>     
                                </AnyDate>
                            </StartDate>
                            <EndDate>
                                <AnyDate>
                                    <xsl:value-of select="period/to/year/text()"/>     
                                    <xsl:value-of select="substring(period/to/month/text(),2)"/>     
                                    <xsl:value-of select="substring(period/to/day/text(),3)"/>     
                                </AnyDate>
                            </EndDate>
                        </PositionHistory>
                    </EmployerOrg>
                    </xsl:for-each>     
                </EmploymentHistory>
                
                <EducationHistory>
                    <xsl:for-each select="educationlist/education">
                        <SchoolOrInstitution schoolType="">
                        <School>
                            <SchoolName>
                                <xsl:value-of select="organisation/text()"/>     
                            </SchoolName>
                        </School>
                        <Degree>
                            <DegreeName>
                                <xsl:value-of select="title/text()"/>     
                            </DegreeName>
                            <DatesOfAttendance>
                                <StartDate>
                                    <AnyDate>
                                        <xsl:value-of select="period/from/year/text()"/>     
                                        <xsl:value-of select="substring(period/from/month/text(),2)"/>     
                                        <xsl:value-of select="substring(period/from/day/text(),3)"/>
                                    </AnyDate>
                                </StartDate>
                                <EndDate>
                                    <AnyDate>
                                        <xsl:value-of select="period/to/year/text()"/>     
                                        <xsl:value-of select="substring(period/to/month/text(),2)"/>     
                                        <xsl:value-of select="substring(period/to/day/text(),3)"/>     
                                    </AnyDate>
                                </EndDate>
                            </DatesOfAttendance>
                        </Degree>
                    </SchoolOrInstitution>
                    </xsl:for-each>     
                </EducationHistory>
                
                <xsl:element name="Qualifications">
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">social</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='social']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Social.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">organisational</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='organisational']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Organisational.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">technical</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='technical']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Technical.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">computer</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='computer']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Computer.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">artistic</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='artistic']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Artistic.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">driving</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='driving']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Driving.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                    <xsl:element name="Competency">
                        <xsl:attribute name="name">other</xsl:attribute>
                        <xsl:attribute name="description">
                            <xsl:value-of select="skilllist/skill[@type='other']/text()"/>
                        </xsl:attribute>
                        <TaxonomyId id="http://profiles.eife-l.org/europass/Europass-Skills-Other.xml" description="Europass-CV-Skills" idOwner="Europass" />
                    </xsl:element>
                    
                </xsl:element>

                <ResumeAdditionalItems>
                    <ResumeAdditionalItem>
                        <Description>
                            <xsl:value-of select="misclist/misc[@type='additional']/text()"/>
                        </Description>
                    </ResumeAdditionalItem>
                </ResumeAdditionalItems>
                <SupportingMaterials>
                    <Link>
                    </Link>
                    <Description>
                        <xsl:value-of select="misclist/misc[@type='annexes']/text()"/>
                    </Description>
                </SupportingMaterials>  
                
            </StructuredXMLResume>
            
            </Resume>
        </Candidate>
    </xsl:template>
</xsl:stylesheet>
