Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
                exclude-result-prefixes="xs" version="2.0">
5

    
6
	<xsl:param name="parentDatasourceId"/>
7
	<xsl:param name="namespacePrefix"/>
8

    
9
	<xsl:variable name="invalid" select="' ,-'"/>
10
	<xsl:variable name="valid" select="'___'"/>
11

    
12
	<xsl:variable name="prefix" select="string('fct_________')"/>
13
	<xsl:variable name="funderID" select="concat($prefix, '::FCT')"/>
14

    
15
	<xsl:template match="/">
16
		<record>
17
			<xsl:copy-of select=".//*[local-name()='header']"/>
18
			<metadata>
19
				<ROWS>
20
					<xsl:for-each select="//project">
21
						<xsl:call-template name="projectTemplate"/>
22
					</xsl:for-each>
23
				</ROWS>
24
			</metadata>
25

    
26
		</record>
27
	</xsl:template>
28

    
29
	<xsl:template name="projectTemplate">
30

    
31
		<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  ./id)"/>
32
		<xsl:variable name="projectAcronym" select="./reference"/>
33
		<xsl:variable name="tokens" select="tokenize(./reference,'/')"/>
34
		<xsl:variable name="callID" select="concat($tokens[1], '/', $tokens[last()])"/>
35

    
36
		<ROW table="projects">
37
			<FIELD name="_dnet_resource_identifier_">
38
				<xsl:value-of select="$projectId"/>
39
			</FIELD>
40
			<FIELD name="id">
41
				<xsl:value-of select="$projectId"/>
42
			</FIELD>
43
			<FIELD name="code">
44
				<xsl:value-of select="./id"/>
45
			</FIELD>
46
			<FIELD name="call_identifier">
47
				<xsl:value-of select="$callID"/>
48
			</FIELD>
49
			<FIELD name="websiteurl">
50
				<xsl:value-of select="./refUri"/>
51
			</FIELD>
52
			<FIELD name="acronym">
53
				<xsl:value-of select="./reference"/>
54
			</FIELD>
55
			<FIELD name="title">
56
				<xsl:value-of select="./name"/>
57
			</FIELD>
58
			<FIELD name="startdate" type="date" format="dd/MM/yyyy">
59
				<xsl:value-of select="./startDate"/>
60
			</FIELD>
61
			<FIELD name="enddate" type="date" format="dd/MM/yyyy">
62
				<xsl:value-of select="./endDate"/>
63
			</FIELD>
64
			<FIELD name="keywords">
65
				<xsl:for-each select="./classification/elem">
66
					<xsl:if test="position() &gt; 1">,</xsl:if>
67
					<xsl:value-of select="."/>
68
				</xsl:for-each>
69
			</FIELD>
70
			<FIELD name="collectedfrom">
71
				<xsl:value-of select="$parentDatasourceId"/>
72
			</FIELD>
73
			<FIELD name="contracttypeclass">UNKNOWN</FIELD>
74
			<FIELD name="contracttypescheme">fct:contractTypes</FIELD>
75
			<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
76
			<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
77
			<xsl:if test="string-length(normalize-space(./oaMandate)) &gt; 0">
78
				<FIELD name="oa_mandate_for_publications" type="boolean">
79
					<xsl:value-of select="./oaMandate"/>
80
				</FIELD>
81
			</xsl:if>
82
		</ROW>
83

    
84
		<!--
85
		<xsl:for-each select="./persons/elem">
86
			<xsl:if test="string-length(./name) &gt; 0 and string-length(./researcherId) &gt; 0">
87

    
88
				<xsl:variable name="orgId" select="concat($projectId, '::', translate(./organization, $invalid, $valid))" />
89
				<ROW table="organizations">
90
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD>
91
					<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD>
92
					<FIELD name="legalname"><xsl:value-of select="./organization" /></FIELD>
93
					<FIELD name="countryclass"><xsl:value-of select="./country" /></FIELD>
94
					<FIELD name="countryscheme">dnet:countries</FIELD>
95
					<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
96
					<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
97
					<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
98
				</ROW>
99
				<xsl:variable name="personId" select="concat($projectId, '::', ./researcherId)"/>
100
				<ROW table="persons">
101
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personId" /></FIELD>
102
					<FIELD name="id"><xsl:value-of select="$personId" /></FIELD>
103
					<FIELD name="firstname"><xsl:value-of select="./name" /></FIELD>
104
					<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
105
					<FIELD name="nationalityClass"><xsl:value-of select="./country" /></FIELD>
106
					<FIELD name="nationalityScheme">dnet:countries</FIELD>
107
					<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
108
					<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
109
					<FIELD name="optional1"><xsl:value-of select="./role" /></FIELD>
110
				</ROW>
111
				<ROW table="project_organization">
112
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($orgId, '@@', $projectId)" /></FIELD>
113
					<FIELD name="participantnumber" type="int"><xsl:value-of select="position()" /></FIELD>
114
					<FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../../startDate"/></FIELD>
115
					<FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../../endDate"/></FIELD>
116
					<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
117
					<FIELD name="resporganization"><xsl:value-of select="$orgId" /></FIELD>
118
					<FIELD name="contactperson"><xsl:value-of select="$personId" /></FIELD>
119
					<FIELD name="semanticclass">participant</FIELD>
120
				</ROW>
121
				<ROW table="identities">
122
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="./researcherId" /></FIELD>
123
					<FIELD name="pid"><xsl:value-of select="./researcherId" /></FIELD>
124
					<FIELD name="issuertypeclass">fct:researcher_ids</FIELD>
125
					<FIELD name="issuertypescheme">dnet:pid_types</FIELD>
126
				</ROW>
127
				<ROW table="personpids">
128
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat(./researcherId, '@@', $personId)" /></FIELD>
129
					<FIELD name="pid"><xsl:value-of select="./researcherId" /></FIELD>
130
					<FIELD name="person"><xsl:value-of select="$personId" /></FIELD>
131
				</ROW>
132
				<xsl:if test="string-length(normalize-space(./orcidId)) &gt; 0">
133
					<ROW table="identities">
134
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="./orcidId" /></FIELD>
135
						<FIELD name="pid"><xsl:value-of select="./orcidId" /></FIELD>
136
						<FIELD name="issuertypeclass">orcid</FIELD>
137
						<FIELD name="issuertypescheme">dnet:pid_types</FIELD>
138
					</ROW>
139
					<ROW table="personpids">
140
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat(./orcidId, '@@', $personId)" /></FIELD>
141
						<FIELD name="pid"><xsl:value-of select="./orcidId" /></FIELD>
142
						<FIELD name="person"><xsl:value-of select="$personId" /></FIELD>
143
					</ROW>
144
				</xsl:if>
145
			</xsl:if>
146
		</xsl:for-each>
147
		-->
148

    
149
		<xsl:for-each select="./funding">
150
			<xsl:variable name="p1" select="normalize-space(./program)"/>
151
			<xsl:variable name="p2" select="normalize-space(./program2)"/>
152

    
153
			<xsl:variable name="tmpFundingId">
154
				<xsl:choose>
155
					<xsl:when test="string-length($p1) &gt; 0 and string-length($p2) &gt; 0">
156
						<xsl:value-of select="concat($funderID, '::', $p1, '::', $p2)"/>
157
					</xsl:when>
158
					<xsl:when test="string-length($p1) &gt; 0">
159
						<xsl:value-of select="concat($funderID, '::', $p1)"/>
160
					</xsl:when>
161
					<xsl:otherwise></xsl:otherwise>
162
				</xsl:choose>
163
			</xsl:variable>
164

    
165
			<xsl:variable name="fundingId" select="normalize-space($tmpFundingId)"/>
166

    
167
			<xsl:if test="string-length($fundingId) &gt; 0">
168
				<ROW table="project_fundingpath">
169
					<FIELD name="_dnet_resource_identifier_">
170
						<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
171
					</FIELD>
172
					<FIELD name="funding">
173
						<xsl:value-of select="$fundingId"/>
174
					</FIELD>
175
					<FIELD name="project">
176
						<xsl:value-of select="$projectId"/>
177
					</FIELD>
178
					<FIELD name="startdate" type="date" format="dd/MM/yyyy">
179
						<xsl:value-of select="../startDate"/>
180
					</FIELD>
181
					<FIELD name="enddate" type="date" format="dd/MM/yyyy">
182
						<xsl:value-of select="../endDate"/>
183
					</FIELD>
184
					<FIELD name="optional1">
185
						<xsl:value-of select="./amount"/>
186
					</FIELD>
187
					<FIELD name="optional2">
188
						<xsl:value-of select="./dateAwarded"/>
189
					</FIELD>
190
				</ROW>
191
			</xsl:if>
192
		</xsl:for-each>
193

    
194
	</xsl:template>
195
</xsl:stylesheet>
(12-12/31)