1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet version="1.0" 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"
|
3
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions">
|
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, '::fundingStream'))" />
|
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
|
<xsl:call-template name="formatDate">
|
53
|
<xsl:with-param name="datename">startdate</xsl:with-param>
|
54
|
<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
|
55
|
</xsl:call-template>
|
56
|
<xsl:call-template name="formatDate">
|
57
|
<xsl:with-param name="datename">enddate</xsl:with-param>
|
58
|
<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
|
59
|
</xsl:call-template>
|
60
|
</ROW>
|
61
|
<xsl:if test="string-length(normalize-space(//column[@name = 'ORGANIZATION_INVOLVED'])) > 0">
|
62
|
<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))" />
|
63
|
<ROW table="organizations">
|
64
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$organizationId" /></FIELD>
|
65
|
<FIELD name="id"><xsl:value-of select="$organizationId" /></FIELD>
|
66
|
<FIELD name="legalname"><xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']" /></FIELD>
|
67
|
<FIELD name="countryclass">HR</FIELD>
|
68
|
<FIELD name="countryscheme">dnet:countries</FIELD>
|
69
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
70
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
71
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
72
|
</ROW>
|
73
|
<ROW table="project_organization">
|
74
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select='concat($projectId, "@@", $organizationId)' /></FIELD>
|
75
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
76
|
<FIELD name="resporganization"><xsl:value-of select="$organizationId" /></FIELD>
|
77
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
78
|
<FIELD name="semanticclass">coordinator</FIELD>
|
79
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
80
|
</ROW>
|
81
|
</xsl:if>
|
82
|
<xsl:if test="string-length($fundingId) > 0">
|
83
|
<ROW table="project_fundingpath">
|
84
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@', $projectId)" /></FIELD>
|
85
|
<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
|
86
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
87
|
<xsl:call-template name="formatDate">
|
88
|
<xsl:with-param name="datename">startdate</xsl:with-param>
|
89
|
<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
|
90
|
</xsl:call-template>
|
91
|
<xsl:call-template name="formatDate">
|
92
|
<xsl:with-param name="datename">enddate</xsl:with-param>
|
93
|
<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
|
94
|
</xsl:call-template>
|
95
|
</ROW>
|
96
|
</xsl:if>
|
97
|
</ROWS>
|
98
|
</metadata>
|
99
|
|
100
|
</xsl:if>
|
101
|
</record>
|
102
|
</xsl:template>
|
103
|
</xsl:stylesheet>
|