Project

General

Profile

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

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

    
7
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::FWF')"/>
8

    
9
	<xsl:variable name="fundingCode" select="normalize-space(substring-before(.//column[@name='project number'],' –'))"/>
10
	<xsl:variable name="projectNumber" select="normalize-space(substring-after(.//column[@name='project number'],' – '))"/>
11
	<xsl:variable name="fundingID">
12
		<xsl:choose>
13
			<xsl:when test="string-length($fundingCode) &gt; 0">
14
				<xsl:value-of select="concat($funderID, '::', $fundingCode)"/>
15
			</xsl:when>
16
			<xsl:otherwise>
17
				<xsl:value-of select="$funderID"/>
18
			</xsl:otherwise>
19
		</xsl:choose>
20
	</xsl:variable>
21

    
22

    
23
	<xsl:variable name="projectID" select="concat($namespacePrefix, '::', concat($fundingCode,'_',$projectNumber))"/>
24
	<xsl:variable name="projectCode" select="concat($fundingCode,' ',$projectNumber)"/>
25

    
26
	<xsl:variable name="projectTitle" select=".//column[@name='project title']"/>
27

    
28
	<xsl:variable name="startDate" select=".//column[@name='from']"/>
29
	<xsl:variable name="endDate" select=".//column[@name='till']"/>
30
	<xsl:variable name="personId" select="concat($namespacePrefix,translate(normalize-space(.//column[@name='project lead']),' ','_'))"/>
31
	<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
32
	<xsl:variable name="organizationId" select="concat($namespacePrefix,fwf:getMd5(.//column[@name='research place and institute']))"/>
33
	<xsl:template match="/">
34
		<xsl:if test="string-length($projectTitle) &gt; 0 and
35
                      string-length($projectID) &gt; 0">
36
			<record>
37

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

    
40
				<metadata>
41

    
42
					<ROWS>
43

    
44
						<ROW table="projects">
45
							<FIELD name="_dnet_resource_identifier_">
46
								<xsl:value-of select="$projectID"/>
47
							</FIELD>
48
							<FIELD name="id">
49
								<xsl:value-of select="$projectID"/>
50
							</FIELD>
51
							<FIELD name="code">
52
								<xsl:value-of select="$projectCode"/>
53
							</FIELD>
54
							<FIELD name="startdate" type="date" format="{$dateFormat}">
55
								<xsl:value-of select="$startDate"/>
56
							</FIELD>
57
							<FIELD name="enddate" type="date" format="{$dateFormat}">
58
								<xsl:value-of select="$endDate"/>
59
							</FIELD>
60
							<FIELD name="title">
61
								<xsl:value-of select="$projectTitle"/>
62
							</FIELD>
63
							<FIELD name="keywords">
64
								<xsl:value-of select=".//column[@name='keywords']"/>
65
							</FIELD>
66
							<FIELD name="optional1">
67
								<xsl:variable name="grantAmount" select=".//column[@name='grants awarded']"/>
68
								<xsl:variable name="tmp" select="substring(normalize-space($grantAmount),1,1)"/>
69
								<xsl:value-of select="concat($tmp,' ',substring-after($grantAmount,$tmp))"/>
70
							</FIELD>
71

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

    
81
								<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>
82
							</FIELD>
83
							<FIELD name="funding">
84
								<xsl:value-of select="$fundingID"/>
85
							</FIELD>
86
							<FIELD name="project">
87
								<xsl:value-of select="$projectID"/>
88
							</FIELD>
89
							<FIELD name="startdate" type="date" format="{$dateFormat}">
90
								<xsl:value-of select="$startDate"/>
91
							</FIELD>
92
							<FIELD name="enddate" type="date" format="{$dateFormat}">
93
								<xsl:value-of select="$endDate"/>
94
							</FIELD>
95
						</ROW>
96
						<xsl:if test="string-length($organizationId) &gt; 0">
97
							<ROW table="organizations">
98

    
99
								<FIELD name="_dnet_resource_identifier_">
100
									<xsl:value-of select="$organizationId"/>
101
								</FIELD>
102
								<FIELD name="id">
103
									<xsl:value-of select="$organizationId"/>
104
								</FIELD>
105
								<FIELD name="legalname">
106
									<xsl:variable name="orgName" select="normalize-space(.//column[@name='research place and institute'])"/>
107
									<xsl:choose>
108
										<xsl:when test="string-length( $orgName) &gt; 255">
109
											<xsl:value-of select="substring($orgName,0,254)"/>
110
										</xsl:when>
111
										<xsl:otherwise>
112
											<xsl:value-of select="normalize-space($orgName)"/>
113
										</xsl:otherwise>
114
									</xsl:choose>
115

    
116

    
117
								</FIELD>
118
								<FIELD name="collectedfrom">
119
									<xsl:value-of select="$parentDatasourceId"/>
120
								</FIELD>
121
								<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
122
								<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
123
							</ROW>
124
						</xsl:if>
125
						<xsl:if test="string-length($personId) &gt; 0">
126
							<ROW table="persons">
127
								<FIELD name="_dnet_resource_identifier_">
128
									<xsl:value-of select="$personId"/>
129
								</FIELD>
130
								<FIELD name="id">
131
									<xsl:value-of select="$personId"/>
132
								</FIELD>
133
								<FIELD name="firstname">
134
									<xsl:value-of select="fwf:getName(.//column[@name='project lead'],true())"/>
135
								</FIELD>
136
								<FIELD name="secondnames">
137
									<xsl:value-of select="fwf:getName(.//column[@name='project lead'],false())"/>
138
								</FIELD>
139
								<FIELD name="collectedfrom">
140
									<xsl:value-of select="$parentDatasourceId"/>
141
								</FIELD>
142
								<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
143
								<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
144
							</ROW>
145
						</xsl:if>
146

    
147
						<xsl:if test="string-length($organizationId) &gt; 0">
148
							<ROW table="project_organization">
149
								<FIELD name="_dnet_resource_identifier_">
150
									<xsl:value-of select='concat($projectID, "@@", $organizationId)'/>
151
								</FIELD>
152
								<FIELD name="project">
153
									<xsl:value-of select="$projectID"/>
154
								</FIELD>
155
								<FIELD name="resporganization">
156
									<xsl:value-of select="$organizationId"/>
157
								</FIELD>
158
								<FIELD name="contactperson">
159
									<xsl:value-of select="$personId"/>
160
								</FIELD>
161
								<FIELD name="semanticclass">participant</FIELD>
162
								<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
163
							</ROW>
164
						</xsl:if>
165

    
166
					</ROWS>
167
				</metadata>
168
			</record>
169
		</xsl:if>
170
	</xsl:template>
171
</xsl:stylesheet>
(9-9/25)