1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="cda48c6b-fae8-4292-bbf3-08ebf07eb681_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2018-06-04T11:15:30+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>Croatian MZOS projects to DB</TITLE>
|
14
|
<CODE>
|
15
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
|
16
|
|
17
|
<xsl:param name="varDataSourceId"/>
|
18
|
<xsl:variable name="funderAcronym" select="string('MZOS')"/>
|
19
|
|
20
|
<xsl:template name="formatDate">
|
21
|
<xsl:param name="datename"/>
|
22
|
<xsl:param name="datevalue"/>
|
23
|
<xsl:choose>
|
24
|
<xsl:when test="string-length($datevalue) = 4 and $datename = 'startdate'">
|
25
|
<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
|
26
|
<xsl:value-of select="concat($datevalue, '-01-01')"/>
|
27
|
</FIELD>
|
28
|
</xsl:when>
|
29
|
<xsl:when test="string-length($datevalue) = 4 and $datename = 'enddate'">
|
30
|
<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
|
31
|
<xsl:value-of select="concat($datevalue, '-12-31')"/>
|
32
|
</FIELD>
|
33
|
</xsl:when>
|
34
|
<xsl:when test="string-length($datevalue) = 10">
|
35
|
<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
|
36
|
<xsl:value-of select="$datevalue"/>
|
37
|
</FIELD>
|
38
|
</xsl:when>
|
39
|
</xsl:choose>
|
40
|
</xsl:template>
|
41
|
|
42
|
<xsl:variable name="namespacePrefix" select="string('irb_hr______')"/>
|
43
|
|
44
|
<xsl:template match="/">
|
45
|
<record>
|
46
|
<xsl:if test="contains(//column[@name='FUNDER_NAME'], $funderAcronym)">
|
47
|
|
48
|
<xsl:variable name="fundingId" select="normalize-space(concat($namespacePrefix, '::', $funderAcronym))"/>
|
49
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
50
|
<metadata>
|
51
|
<ROWS>
|
52
|
<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'PROJECT_IDENTIFIER']))"/>
|
53
|
<xsl:variable name="projectTitle">
|
54
|
<xsl:choose>
|
55
|
<xsl:when test="//column[@name = 'PROJECT_TITLE'] != ''">
|
56
|
<xsl:value-of select="//column[@name = 'PROJECT_TITLE']"/>
|
57
|
</xsl:when>
|
58
|
<xsl:otherwise>
|
59
|
<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
|
60
|
</xsl:otherwise>
|
61
|
</xsl:choose>
|
62
|
</xsl:variable>
|
63
|
|
64
|
<ROW table="projects">
|
65
|
<FIELD name="_dnet_resource_identifier_">
|
66
|
<xsl:value-of select="$projectId"/>
|
67
|
</FIELD>
|
68
|
<FIELD name="id">
|
69
|
<xsl:value-of select="$projectId"/>
|
70
|
</FIELD>
|
71
|
<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
|
72
|
<FIELD name="code">
|
73
|
<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
|
74
|
</FIELD>
|
75
|
<FIELD name="title">
|
76
|
<xsl:value-of select="$projectTitle"/>
|
77
|
</FIELD>
|
78
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
79
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
80
|
<FIELD name="collectedfrom">
|
81
|
<xsl:value-of select="$varDataSourceId"/>
|
82
|
</FIELD>
|
83
|
<xsl:call-template name="formatDate">
|
84
|
<xsl:with-param name="datename">startdate</xsl:with-param>
|
85
|
<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
|
86
|
</xsl:call-template>
|
87
|
<xsl:call-template name="formatDate">
|
88
|
<xsl:with-param name="datename">enddate</xsl:with-param>
|
89
|
<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
|
90
|
</xsl:call-template>
|
91
|
</ROW>
|
92
|
<xsl:if test="string-length(normalize-space(//column[@name = 'ORGANIZATION_INVOLVED'])) > 0">
|
93
|
<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))"/>
|
94
|
<ROW table="dsm_organizations">
|
95
|
<FIELD name="_dnet_resource_identifier_">
|
96
|
<xsl:value-of select="$organizationId"/>
|
97
|
</FIELD>
|
98
|
<FIELD name="id">
|
99
|
<xsl:value-of select="$organizationId"/>
|
100
|
</FIELD>
|
101
|
<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
|
102
|
<FIELD name="legalname">
|
103
|
<xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']"/>
|
104
|
</FIELD>
|
105
|
<FIELD name="country">HR</FIELD>
|
106
|
<FIELD name="collectedfrom">
|
107
|
<xsl:value-of select="$varDataSourceId"/>
|
108
|
</FIELD>
|
109
|
<FIELD name="provenanceAction">sysimport:crosswalk:entityregistry</FIELD>
|
110
|
</ROW>
|
111
|
<ROW table="project_organization">
|
112
|
<FIELD name="_dnet_resource_identifier_">
|
113
|
<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
|
114
|
</FIELD>
|
115
|
<FIELD name="project">
|
116
|
<xsl:value-of select="$projectId"/>
|
117
|
</FIELD>
|
118
|
<FIELD name="resporganization">
|
119
|
<xsl:value-of select="$organizationId"/>
|
120
|
</FIELD>
|
121
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
122
|
<FIELD name="semanticclass">coordinator</FIELD>
|
123
|
|
124
|
</ROW>
|
125
|
</xsl:if>
|
126
|
<xsl:if test="string-length($fundingId) > 0">
|
127
|
<ROW table="project_fundingpath">
|
128
|
<FIELD name="_dnet_resource_identifier_">
|
129
|
<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
|
130
|
</FIELD>
|
131
|
<FIELD name="funding">
|
132
|
<xsl:value-of select="$fundingId"/>
|
133
|
</FIELD>
|
134
|
<FIELD name="project">
|
135
|
<xsl:value-of select="$projectId"/>
|
136
|
</FIELD>
|
137
|
<xsl:call-template name="formatDate">
|
138
|
<xsl:with-param name="datename">startdate</xsl:with-param>
|
139
|
<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
|
140
|
</xsl:call-template>
|
141
|
<xsl:call-template name="formatDate">
|
142
|
<xsl:with-param name="datename">enddate</xsl:with-param>
|
143
|
<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
|
144
|
</xsl:call-template>
|
145
|
</ROW>
|
146
|
</xsl:if>
|
147
|
</ROWS>
|
148
|
</metadata>
|
149
|
|
150
|
</xsl:if>
|
151
|
</record>
|
152
|
</xsl:template>
|
153
|
</xsl:stylesheet>
|
154
|
</CODE>
|
155
|
</SCRIPT>
|
156
|
</CONFIGURATION>
|
157
|
<STATUS/>
|
158
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
159
|
</BODY>
|
160
|
</RESOURCE_PROFILE>
|