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="projectFundingAndNumber" select="normalize-space(//column[@name='project number'])"/>
10
	<xsl:variable name="fundingCode" select="normalize-space(substring-before($projectFundingAndNumber, '–'))"/>
11
	<xsl:variable name="projectNumber" select="normalize-space(substring-after($projectFundingAndNumber, '–'))"/>
12
	<xsl:variable name="projectID" select="concat($namespacePrefix, '::', concat($fundingCode, '_', $projectNumber))"/>
13
	<xsl:variable name="projectTitle" select="//column[@name='project title']"/>
14

    
15
	<xsl:template match="/">
16
		<record>
17
			<xsl:copy-of select=".//*[local-name()='header']"/>
18
			<metadata>
19
				<xsl:if test="string-length($projectTitle) &gt; 0 and
20
                      string-length($projectID) &gt; 0 and
21
                      //column[@name='status'] != 'canceled'">
22

    
23
					<xsl:variable name="projectCode" select="concat($fundingCode,' ', $projectNumber)"/>
24
					<xsl:variable name="startDate" select=".//column[@name='from']"/>
25
					<xsl:variable name="endDate" select=".//column[@name='till']"/>
26
					<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
27
					<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', fwf:getMd5(normalize-space(.//column[@name='research place and institute'])))"/>
28
					<xsl:variable name="fundingID">
29
						<xsl:choose>
30
							<xsl:when test="string-length($fundingCode) &gt; 0">
31
								<xsl:value-of select="concat($funderID, '::', $fundingCode)"/>
32
							</xsl:when>
33
							<xsl:otherwise>
34
								<xsl:value-of select="$funderID"/>
35
							</xsl:otherwise>
36
						</xsl:choose>
37
					</xsl:variable>
38

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

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

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

    
98
								<FIELD name="_dnet_resource_identifier_">
99
									<xsl:value-of select="$organizationId"/>
100
								</FIELD>
101
								<FIELD name="id">
102
									<xsl:value-of select="$organizationId"/>
103
								</FIELD>
104
								<FIELD name="legalname">
105
									<xsl:variable name="orgName" select="normalize-space(.//column[@name='research place and institute'])"/>
106
									<xsl:choose>
107
										<xsl:when test="string-length( $orgName) &gt; 255">
108
											<xsl:value-of select="substring($orgName,0,254)"/>
109
										</xsl:when>
110
										<xsl:otherwise>
111
											<xsl:value-of select="normalize-space($orgName)"/>
112
										</xsl:otherwise>
113
									</xsl:choose>
114
								</FIELD>
115
								<FIELD name="collectedfrom">
116
									<xsl:value-of select="$parentDatasourceId"/>
117
								</FIELD>
118
								<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
119
								<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
120
							</ROW>
121
						</xsl:if>
122
						<xsl:if test="string-length($organizationId) &gt; 0">
123
							<ROW table="project_organization">
124
								<FIELD name="_dnet_resource_identifier_">
125
									<xsl:value-of select='concat($projectID, "@@", $organizationId)'/>
126
								</FIELD>
127
								<FIELD name="project">
128
									<xsl:value-of select="$projectID"/>
129
								</FIELD>
130
								<FIELD name="resporganization">
131
									<xsl:value-of select="$organizationId"/>
132
								</FIELD>
133
								<FIELD name="semanticclass">participant</FIELD>
134
								<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
135
							</ROW>
136
						</xsl:if>
137
					</ROWS>
138
				</xsl:if>
139
			</metadata>
140
		</record>
141
	</xsl:template>
142
</xsl:stylesheet>
(13-13/31)