Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
3
                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions" version="1.0">
4

    
5
	<xsl:param name="parentDatasourceId" />
6
	<xsl:param name="funderAcronym" />
7

    
8
	<xsl:template name="formatDate">
9
		<xsl:param name="datename" />
10
		<xsl:param name="datevalue" />
11
		<xsl:choose>
12
			<xsl:when test="string-length($datevalue) = 4 and $datename = 'startdate'">
13
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd"><xsl:value-of select="concat($datevalue, '-01-01')" /></FIELD>
14
			</xsl:when>
15
			<xsl:when test="string-length($datevalue) = 4 and $datename = 'enddate'">
16
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd"><xsl:value-of select="concat($datevalue, '-12-31')" /></FIELD>
17
			</xsl:when>
18
			<xsl:when test="string-length($datevalue) = 10">
19
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd"><xsl:value-of select="$datevalue" /></FIELD>
20
			</xsl:when>
21
		</xsl:choose>
22
	</xsl:template>
23

    
24
	<xsl:variable name="namespacePrefix" select="string('irb_hr______')" />
25

    
26
	<xsl:template match="/">
27
		<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
28
		        xmlns:dri="http://www.driver-repository.eu/namespace/dri"
29
		        xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
30
		        xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
31
			<xsl:if test="contains(//column[@name='FUNDER_NAME'], $funderAcronym)">
32

    
33
				<xsl:variable name="fundingId" select="normalize-space(concat($namespacePrefix, '::', $funderAcronym))" />
34
				<xsl:copy-of select=".//*[local-name()='header']"/>
35
				<metadata>
36
					<ROWS>
37
						<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'PROJECT_IDENTIFIER']))"/>
38
						<xsl:variable name="projectTitle">
39
								<xsl:choose>
40
										<xsl:when test="//column[@name = 'PROJECT_TITLE'] != ''"><xsl:value-of select="//column[@name = 'PROJECT_TITLE']" /></xsl:when>
41
										<xsl:otherwise><xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']" /></xsl:otherwise>
42
								</xsl:choose>
43
						</xsl:variable>
44

    
45
						<ROW table="projects">
46
							<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
47
							<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
48
							<FIELD name="code"><xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']" /></FIELD>
49
							<FIELD name="title"><xsl:value-of select="$projectTitle" /></FIELD>
50
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
51
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
52
							<FIELD name="collectedfrom">
53
								<xsl:value-of select="$parentDatasourceId"/>
54
							</FIELD>
55
							<xsl:call-template name="formatDate">
56
								<xsl:with-param name="datename">startdate</xsl:with-param>
57
								<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
58
							</xsl:call-template>
59
							<xsl:call-template name="formatDate">
60
								<xsl:with-param name="datename">enddate</xsl:with-param>
61
								<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
62
							</xsl:call-template>
63
						</ROW>
64
						<xsl:if test="string-length(normalize-space(//column[@name = 'ORGANIZATION_INVOLVED'])) &gt; 0">
65
							<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))" />
66
							<ROW table="organizations">
67
								<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$organizationId" /></FIELD>
68
								<FIELD name="id"><xsl:value-of select="$organizationId" /></FIELD>
69
								<FIELD name="legalname"><xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']" /></FIELD>
70
								<FIELD name="countryclass">HR</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
							<ROW table="project_organization">
77
								<FIELD name="_dnet_resource_identifier_"><xsl:value-of select='concat($projectId, "@@", $organizationId)' /></FIELD>
78
								<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
79
								<FIELD name="resporganization"><xsl:value-of select="$organizationId" /></FIELD>
80
								<FIELD name="participantnumber" type="int">1</FIELD>
81
								<FIELD name="semanticclass">coordinator</FIELD>
82
								<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
83
							</ROW>
84
						</xsl:if>
85
						<xsl:if test="string-length($fundingId) &gt; 0">
86
							<ROW table="project_fundingpath">
87
								<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@', $projectId)" /></FIELD>
88
								<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
89
								<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
90
								<xsl:call-template name="formatDate">
91
									<xsl:with-param name="datename">startdate</xsl:with-param>
92
									<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
93
								</xsl:call-template>
94
								<xsl:call-template name="formatDate">
95
									<xsl:with-param name="datename">enddate</xsl:with-param>
96
									<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
97
								</xsl:call-template>
98
							</ROW>
99
						</xsl:if>
100
					</ROWS>
101
				</metadata>
102

    
103
			</xsl:if>
104
		</record>
105
	</xsl:template>
106
</xsl:stylesheet>
(5-5/25)