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" xmlns:dc="http://purl.org/dc/elements/1.1/"
4
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
5
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
6
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions"
7
    exclude-result-prefixes="xs" version="2.0">
8

    
9
    <xsl:param name="parentDatasourceId"/>
10
    <xsl:param name="namespacePrefix"/>
11

    
12
	<xsl:variable name="invalid" select="' ,-'" />
13
	<xsl:variable name="valid"   select="'___'" />
14
	
15
	<xsl:variable name="prefix" select="string('fct_________')" />
16
	<xsl:variable name="funderID" select="concat($prefix, '::FCT')" />
17
		
18
	<xsl:template match="/">
19
		<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
			xmlns:dri="http://www.driver-repository.eu/namespace/dri"
21
			xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
			xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
23
			
24
			<xsl:copy-of select=".//*[local-name()='header']"/>
25
			
26
			<metadata>
27
				<ROWS>
28
					<xsl:for-each select="//project">
29
						<xsl:call-template name="projectTemplate" />
30
					</xsl:for-each>
31
				</ROWS>
32
			</metadata>
33
			
34
		</record>
35
	</xsl:template>
36
	
37
	<xsl:template name="projectTemplate">
38
		
39
		<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  ./id)" />
40
		<xsl:variable name="projectAcronym" select="./reference"/>
41
        <xsl:variable name="tokens" select="tokenize(./reference,'/')"/>
42
        <xsl:variable name="callID" select="concat($tokens[1], '/', $tokens[last()])"/>		
43
		
44
		<ROW table="projects">
45
			<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
46
			<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
47
			<FIELD name="code"><xsl:value-of select="./id" /></FIELD>
48
			<FIELD name="call_identifier"> <xsl:value-of select="$callID"/></FIELD>
49
			<FIELD name="websiteurl"><xsl:value-of select="./refUri" /></FIELD>
50
			<FIELD name="acronym"><xsl:value-of select="./reference" /></FIELD>
51
			<FIELD name="title"><xsl:value-of select="./name" /></FIELD>
52
			<FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="./startDate" /></FIELD>
53
			<FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="./endDate" /></FIELD>
54
			<FIELD name="keywords"><xsl:for-each select="./classification/elem"><xsl:if test="position() &gt; 1">, </xsl:if><xsl:value-of select="."/></xsl:for-each></FIELD>
55
			<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId"/></FIELD>
56
			<FIELD name="contracttypeclass">UNKNOWN</FIELD>
57
			<FIELD name="contracttypescheme">fct:contractTypes</FIELD>
58
			<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
59
		</ROW>
60

    
61
		<!-- 
62
		<xsl:for-each select="./persons/elem">
63
			<xsl:if test="string-length(./name) &gt; 0 and string-length(./researcherId) &gt; 0">
64
				
65
				<xsl:variable name="orgId" select="concat($projectId, '::', translate(./organization, $invalid, $valid))" />
66
				<ROW table="organizations">
67
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD>
68
					<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD>
69
					<FIELD name="legalname"><xsl:value-of select="./organization" /></FIELD>
70
					<FIELD name="countryclass"><xsl:value-of select="./country" /></FIELD>
71
					<FIELD name="countryscheme">dnet:countries</FIELD>
72
					<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
73
					<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
74
					<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
75
				</ROW>
76
				<xsl:variable name="personId" select="concat($projectId, '::', ./researcherId)"/>
77
				<ROW table="persons">
78
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personId" /></FIELD>
79
					<FIELD name="id"><xsl:value-of select="$personId" /></FIELD>
80
					<FIELD name="firstname"><xsl:value-of select="./name" /></FIELD>
81
					<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
82
					<FIELD name="nationalityClass"><xsl:value-of select="./country" /></FIELD>
83
					<FIELD name="nationalityScheme">dnet:countries</FIELD>
84
					<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
85
					<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
86
					<FIELD name="optional1"><xsl:value-of select="./role" /></FIELD>
87
				</ROW>
88
				<ROW table="project_organization">
89
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($orgId, '@@', $projectId)" /></FIELD>
90
					<FIELD name="participantnumber" type="int"><xsl:value-of select="position()" /></FIELD>
91
					<FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../../startDate"/></FIELD>
92
					<FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../../endDate"/></FIELD>
93
					<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
94
					<FIELD name="resporganization"><xsl:value-of select="$orgId" /></FIELD>
95
					<FIELD name="contactperson"><xsl:value-of select="$personId" /></FIELD>
96
					<FIELD name="semanticclass">participant</FIELD>
97
				</ROW>
98
				<ROW table="identities">
99
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="./researcherId" /></FIELD>
100
					<FIELD name="pid"><xsl:value-of select="./researcherId" /></FIELD>
101
					<FIELD name="issuertypeclass">fct:researcher_ids</FIELD>
102
					<FIELD name="issuertypescheme">dnet:pid_types</FIELD>
103
				</ROW>
104
				<ROW table="personpids">
105
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat(./researcherId, '@@', $personId)" /></FIELD>
106
					<FIELD name="pid"><xsl:value-of select="./researcherId" /></FIELD>
107
					<FIELD name="person"><xsl:value-of select="$personId" /></FIELD>
108
				</ROW>
109
				<xsl:if test="string-length(normalize-space(./orcidId)) &gt; 0">
110
					<ROW table="identities">
111
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="./orcidId" /></FIELD>
112
						<FIELD name="pid"><xsl:value-of select="./orcidId" /></FIELD>
113
						<FIELD name="issuertypeclass">orcid</FIELD>
114
						<FIELD name="issuertypescheme">dnet:pid_types</FIELD>
115
					</ROW>
116
					<ROW table="personpids">
117
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat(./orcidId, '@@', $personId)" /></FIELD>
118
						<FIELD name="pid"><xsl:value-of select="./orcidId" /></FIELD>
119
						<FIELD name="person"><xsl:value-of select="$personId" /></FIELD>
120
					</ROW>
121
				</xsl:if>
122
			</xsl:if>
123
		</xsl:for-each>
124
		-->
125
					
126
		<xsl:for-each select="./funding">
127
			
128
			<xsl:variable name="fundingName" select="normalize-space(./program)" />
129
			<xsl:if test="string-length($fundingName) &gt; 0">
130
				<xsl:variable name="fundingId" select="concat($funderID,'::',$fundingName)" />
131
				<ROW table="project_fundingpath">
132
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@', $projectId)" /></FIELD>
133
					<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
134
					<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
135
					<FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../startDate" /></FIELD>
136
					<FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../endDate" /></FIELD> 
137
					<FIELD name="optional1"><xsl:value-of select="./amount" /></FIELD>
138
					<FIELD name="optional2"><xsl:value-of select="./dateAwarded" /></FIELD>
139
				</ROW>
140
			</xsl:if>
141
		</xsl:for-each>
142

    
143
	</xsl:template>
144
</xsl:stylesheet>
(7-7/16)