Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions">
3

    
4
    <xsl:param name="parentDatasourceId"/>
5
    <xsl:param name="namespacePrefix"/>
6

    
7
    <xsl:variable name="dateFormat" select="string('mm-DD-yyyy')"/>
8
    <xsl:variable name="funderID" select="concat($namespacePrefix, '::CONICYT')"/>
9
    <xsl:variable name="fundingId">
10
        <xsl:value-of select="concat($funderID,'::',.//column[@name='FUNDER STREAM LEVEL I'],'::',.//column[@name='FUNDER STREAM LEVEL II'])"/>
11
    </xsl:variable>
12

    
13

    
14
    <xsl:template match="/">
15
        <record>
16

    
17
            <xsl:copy-of select=".//*[local-name()='header']"/>
18

    
19
            <metadata>
20
                <ROWS>
21
                    <xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='PROJECT IDENTIFIER']))"/>
22
                    <xsl:variable name="startDate" select="replace(.//column[@name='START DATE'],'/','-')"/>
23

    
24
                    <xsl:variable name="endDate" select="replace(.//column[@name='END DATE'],'/','-')"/>
25

    
26
                    <ROW table="projects">
27

    
28
                        <FIELD name="_dnet_resource_identifier_">
29
                            <xsl:value-of select="$projectId"/>
30
                        </FIELD>
31
                        <FIELD name="id">
32
                            <xsl:value-of select="$projectId"/>
33
                        </FIELD>
34
                        <FIELD name="code">
35
                            <xsl:value-of select=".//column[@name='PROJECT IDENTIFIER']"/>
36
                        </FIELD>
37
                        <FIELD name="title">
38
                            <xsl:value-of select=".//column[@name='PROJECT TITLE']"/>
39
                        </FIELD>
40
                        <FIELD name="startdate" type="date" format="{$dateFormat}">
41
                            <xsl:value-of select="$startDate"/>
42
                        </FIELD>
43

    
44
                        <FIELD name="enddate" type="date" format="{$dateFormat}">
45
                            <xsl:value-of select="$endDate"/>
46
                        </FIELD>
47
                        <FIELD name="websiteurl">
48
                            <xsl:value-of select=".//column[@name='URL DE INFORME FINAL']"/>
49
                        </FIELD>
50

    
51
                        <FIELD name="contactfullname">
52
                            <xsl:choose>
53
                                <xsl:when test=".//column[@name='DIRECTOR Nombre'] = ''">
54

    
55
                                    <xsl:value-of select="concat(.//column[@name='DIRECTOR Apellido1'],' ' ,.//column[@name='DIRECTOR Apellido2'])"/>
56
                                </xsl:when>
57
                                <xsl:otherwise>
58
                                    <xsl:choose>
59
                                        <xsl:when test=".//column[@name='DIRECTOR Apellido1']=''">
60
                                            <xsl:value-of select=".//column[@name='DIRECTOR Nombre']"/>
61
                                        </xsl:when>
62
                                        <xsl:otherwise>
63
                                            <xsl:value-of select="concat(normalize-space(concat(.//column[@name='DIRECTOR Apellido1'],' ' ,.//column[@name='DIRECTOR Apellido2'])),', ',.//column[@name='DIRECTOR Nombre'])"/>
64
                                        </xsl:otherwise>
65
                                    </xsl:choose>
66

    
67
                                </xsl:otherwise>
68
                            </xsl:choose>
69

    
70
                        </FIELD>
71

    
72
                        <FIELD name="collectedfrom">
73
                            <xsl:value-of select="$parentDatasourceId"/>
74
                        </FIELD>
75
                        <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
76
                        <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
77

    
78

    
79
                        <FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
80
                    </ROW>
81

    
82

    
83

    
84
                    <xsl:for-each select="tokenize(.//column[@name='PARTICIPANT INSTITUTIONS2'],';')">
85
                        <xsl:variable name="organizationId" select="concat($namespacePrefix,'::',utils:md5(normalize-space(.)))"/>
86
                        <ROW table = "organizations">
87
                            <FIELD name="_dnet_resource_identifier_">
88
                                <xsl:value-of select="$organizationId"/>
89
                            </FIELD>
90
                            <FIELD name="id">
91
                                <xsl:value-of select="$organizationId"/>
92
                            </FIELD>
93
                            <FIELD name="legalshortname">
94
                                <xsl:value-of select="normalize-space(.)"/>
95
                            </FIELD>
96
                            <FIELD name="collectedfrom">
97
                                <xsl:value-of select="$parentDatasourceId"/>
98
                            </FIELD>
99
                            <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
100
                            <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
101
                        </ROW>
102
                        <ROW table="project_organization">
103
                            <FIELD name="_dnet_resource_identifier_">
104
                                <xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
105
                            </FIELD>
106
                            <FIELD name="project">
107
                                <xsl:value-of select="$projectId"/>
108
                            </FIELD>
109
                            <FIELD name="resporganization">
110
                                <xsl:value-of select="$organizationId"/>
111
                            </FIELD>
112

    
113

    
114

    
115
                            <FIELD name="semanticclass">participant</FIELD>
116
                            <FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
117
                        </ROW>
118
                    </xsl:for-each>
119

    
120
                    <ROW table="project_fundingpath">
121
                        <FIELD name="_dnet_resource_identifier_">
122
                            <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
123
                        </FIELD>
124
                        <FIELD name="funding">
125
                            <xsl:value-of select="$fundingId"/>
126
                        </FIELD>
127
                        <FIELD name="project">
128
                            <xsl:value-of select="$projectId"/>
129
                        </FIELD>
130
                        <FIELD name="startdate" type="date" format="{$dateFormat}">
131
                            <xsl:value-of select="$startDate"/>
132
                        </FIELD>
133

    
134
                        <FIELD name="enddate" type="date" format="{$dateFormat}">
135
                            <xsl:value-of select="$endDate"/>
136
                        </FIELD>
137
                    </ROW>
138
                </ROWS>
139
            </metadata>
140
        </record>
141
    </xsl:template>
142
</xsl:stylesheet>
(3-3/30)