1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
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">
|
14
|
<xsl:value-of select="concat($datevalue, '-01-01')"/>
|
15
|
</FIELD>
|
16
|
</xsl:when>
|
17
|
<xsl:when test="string-length($datevalue) = 4 and $datename = 'enddate'">
|
18
|
<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
|
19
|
<xsl:value-of select="concat($datevalue, '-12-31')"/>
|
20
|
</FIELD>
|
21
|
</xsl:when>
|
22
|
<xsl:when test="string-length($datevalue) = 10">
|
23
|
<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
|
24
|
<xsl:value-of select="$datevalue"/>
|
25
|
</FIELD>
|
26
|
</xsl:when>
|
27
|
</xsl:choose>
|
28
|
</xsl:template>
|
29
|
|
30
|
<xsl:variable name="namespacePrefix" select="string('irb_hr______')"/>
|
31
|
|
32
|
<xsl:template match="/">
|
33
|
<record
|
34
|
>
|
35
|
<xsl:if test="contains(//column[@name='FUNDER_NAME'], $funderAcronym)">
|
36
|
|
37
|
<xsl:variable name="fundingId" select="normalize-space(concat($namespacePrefix, '::', $funderAcronym))"/>
|
38
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
39
|
<metadata>
|
40
|
<ROWS>
|
41
|
<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'PROJECT_IDENTIFIER']))"/>
|
42
|
<xsl:variable name="projectTitle">
|
43
|
<xsl:choose>
|
44
|
<xsl:when test="//column[@name = 'PROJECT_TITLE'] != ''">
|
45
|
<xsl:value-of select="//column[@name = 'PROJECT_TITLE']"/>
|
46
|
</xsl:when>
|
47
|
<xsl:otherwise>
|
48
|
<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
|
49
|
</xsl:otherwise>
|
50
|
</xsl:choose>
|
51
|
</xsl:variable>
|
52
|
|
53
|
<ROW table="projects">
|
54
|
<FIELD name="_dnet_resource_identifier_">
|
55
|
<xsl:value-of select="$projectId"/>
|
56
|
</FIELD>
|
57
|
<FIELD name="id">
|
58
|
<xsl:value-of select="$projectId"/>
|
59
|
</FIELD>
|
60
|
<FIELD name="code">
|
61
|
<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
|
62
|
</FIELD>
|
63
|
<FIELD name="title">
|
64
|
<xsl:value-of select="$projectTitle"/>
|
65
|
</FIELD>
|
66
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
67
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
68
|
<FIELD name="collectedfrom">
|
69
|
<xsl:value-of select="$parentDatasourceId"/>
|
70
|
</FIELD>
|
71
|
<xsl:call-template name="formatDate">
|
72
|
<xsl:with-param name="datename">startdate</xsl:with-param>
|
73
|
<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
|
74
|
</xsl:call-template>
|
75
|
<xsl:call-template name="formatDate">
|
76
|
<xsl:with-param name="datename">enddate</xsl:with-param>
|
77
|
<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
|
78
|
</xsl:call-template>
|
79
|
</ROW>
|
80
|
<xsl:if test="string-length(normalize-space(//column[@name = 'ORGANIZATION_INVOLVED'])) > 0">
|
81
|
<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))"/>
|
82
|
<ROW table="organizations">
|
83
|
<FIELD name="_dnet_resource_identifier_">
|
84
|
<xsl:value-of select="$organizationId"/>
|
85
|
</FIELD>
|
86
|
<FIELD name="id">
|
87
|
<xsl:value-of select="$organizationId"/>
|
88
|
</FIELD>
|
89
|
<FIELD name="legalname">
|
90
|
<xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']"/>
|
91
|
</FIELD>
|
92
|
<FIELD name="countryclass">HR</FIELD>
|
93
|
<FIELD name="countryscheme">dnet:countries</FIELD>
|
94
|
<FIELD name="collectedfrom">
|
95
|
<xsl:value-of select="$parentDatasourceId"/>
|
96
|
</FIELD>
|
97
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
98
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
99
|
</ROW>
|
100
|
<ROW table="project_organization">
|
101
|
<FIELD name="_dnet_resource_identifier_">
|
102
|
<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
|
103
|
</FIELD>
|
104
|
<FIELD name="project">
|
105
|
<xsl:value-of select="$projectId"/>
|
106
|
</FIELD>
|
107
|
<FIELD name="resporganization">
|
108
|
<xsl:value-of select="$organizationId"/>
|
109
|
</FIELD>
|
110
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
111
|
<FIELD name="semanticclass">coordinator</FIELD>
|
112
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
113
|
</ROW>
|
114
|
</xsl:if>
|
115
|
<xsl:if test="string-length($fundingId) > 0">
|
116
|
<ROW table="project_fundingpath">
|
117
|
<FIELD name="_dnet_resource_identifier_">
|
118
|
<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
|
119
|
</FIELD>
|
120
|
<FIELD name="funding">
|
121
|
<xsl:value-of select="$fundingId"/>
|
122
|
</FIELD>
|
123
|
<FIELD name="project">
|
124
|
<xsl:value-of select="$projectId"/>
|
125
|
</FIELD>
|
126
|
<xsl:call-template name="formatDate">
|
127
|
<xsl:with-param name="datename">startdate</xsl:with-param>
|
128
|
<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
|
129
|
</xsl:call-template>
|
130
|
<xsl:call-template name="formatDate">
|
131
|
<xsl:with-param name="datename">enddate</xsl:with-param>
|
132
|
<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
|
133
|
</xsl:call-template>
|
134
|
</ROW>
|
135
|
</xsl:if>
|
136
|
</ROWS>
|
137
|
</metadata>
|
138
|
|
139
|
</xsl:if>
|
140
|
</record>
|
141
|
</xsl:template>
|
142
|
</xsl:stylesheet>
|