Project

General

Profile

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
					<![CDATA[
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
17

    
18
	<xsl:param name="varDataSourceId"/>
19
	<xsl:variable name="funderAcronym" select="string('MZOS')"/>
20

    
21
	<xsl:template name="formatDate">
22
		<xsl:param name="datename"/>
23
		<xsl:param name="datevalue"/>
24
		<xsl:choose>
25
			<xsl:when test="string-length($datevalue) = 4 and $datename = 'startdate'">
26
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
27
					<xsl:value-of select="concat($datevalue, '-01-01')"/>
28
				</FIELD>
29
			</xsl:when>
30
			<xsl:when test="string-length($datevalue) = 4 and $datename = 'enddate'">
31
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
32
					<xsl:value-of select="concat($datevalue, '-12-31')"/>
33
				</FIELD>
34
			</xsl:when>
35
			<xsl:when test="string-length($datevalue) = 10">
36
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
37
					<xsl:value-of select="$datevalue"/>
38
				</FIELD>
39
			</xsl:when>
40
		</xsl:choose>
41
	</xsl:template>
42

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

    
45
	<xsl:template match="/">
46
		<record>
47
			<xsl:if test="contains(//column[@name='FUNDER_NAME'], $funderAcronym)">
48

    
49
				<xsl:variable name="fundingId" select="normalize-space(concat($namespacePrefix, '::', $funderAcronym))"/>
50
				<xsl:copy-of select=".//*[local-name()='header']"/>
51
				<metadata>
52
					<ROWS>
53
						<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'PROJECT_IDENTIFIER']))"/>
54
						<xsl:variable name="projectTitle">
55
							<xsl:choose>
56
								<xsl:when test="//column[@name = 'PROJECT_TITLE'] != ''">
57
									<xsl:value-of select="//column[@name = 'PROJECT_TITLE']"/>
58
								</xsl:when>
59
								<xsl:otherwise>
60
									<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
61
								</xsl:otherwise>
62
							</xsl:choose>
63
						</xsl:variable>
64

    
65
						<ROW table="projects">
66
							<FIELD name="_dnet_resource_identifier_">
67
								<xsl:value-of select="$projectId"/>
68
							</FIELD>
69
							<FIELD name="id">
70
								<xsl:value-of select="$projectId"/>
71
							</FIELD>
72
							<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
73
							<FIELD name="code">
74
								<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
75
							</FIELD>
76
							<FIELD name="title">
77
								<xsl:value-of select="$projectTitle"/>
78
							</FIELD>
79
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
80
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
81
							<FIELD name="collectedfrom">
82
								<xsl:value-of select="$varDataSourceId"/>
83
							</FIELD>
84
							<xsl:call-template name="formatDate">
85
								<xsl:with-param name="datename">startdate</xsl:with-param>
86
								<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
87
							</xsl:call-template>
88
							<xsl:call-template name="formatDate">
89
								<xsl:with-param name="datename">enddate</xsl:with-param>
90
								<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
91
							</xsl:call-template>
92
						</ROW>
93
						<xsl:if test="string-length(normalize-space(//column[@name = 'ORGANIZATION_INVOLVED'])) &gt; 0">
94
							<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))"/>
95
							<ROW table="dsm_organizations">
96
								<FIELD name="_dnet_resource_identifier_">
97
									<xsl:value-of select="$organizationId"/>
98
								</FIELD>
99
								<FIELD name="id">
100
									<xsl:value-of select="$organizationId"/>
101
								</FIELD>
102
								<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
103
								<FIELD name="legalname">
104
									<xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']"/>
105
								</FIELD>
106
								<FIELD name="country">HR</FIELD>
107
								<FIELD name="collectedfrom">
108
									<xsl:value-of select="$varDataSourceId"/>
109
								</FIELD>
110
								<FIELD name="provenanceAction">sysimport:crosswalk:entityregistry</FIELD>
111
							</ROW>
112
							<ROW table="project_organization">
113
								<FIELD name="_dnet_resource_identifier_">
114
									<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
115
								</FIELD>
116
								<FIELD name="project">
117
									<xsl:value-of select="$projectId"/>
118
								</FIELD>
119
								<FIELD name="resporganization">
120
									<xsl:value-of select="$organizationId"/>
121
								</FIELD>
122
								<FIELD name="participantnumber" type="int">1</FIELD>
123
								<FIELD name="semanticclass">coordinator</FIELD>
124

    
125
							</ROW>
126
						</xsl:if>
127
						<xsl:if test="string-length($fundingId) &gt; 0">
128
							<ROW table="project_fundingpath">
129
								<FIELD name="_dnet_resource_identifier_">
130
									<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
131
								</FIELD>
132
								<FIELD name="funding">
133
									<xsl:value-of select="$fundingId"/>
134
								</FIELD>
135
								<FIELD name="project">
136
									<xsl:value-of select="$projectId"/>
137
								</FIELD>
138
								<xsl:call-template name="formatDate">
139
									<xsl:with-param name="datename">startdate</xsl:with-param>
140
									<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>
141
								</xsl:call-template>
142
								<xsl:call-template name="formatDate">
143
									<xsl:with-param name="datename">enddate</xsl:with-param>
144
									<xsl:with-param name="datevalue" select="//column[@name = 'END_DATE']"></xsl:with-param>
145
								</xsl:call-template>
146
							</ROW>
147
						</xsl:if>
148
					</ROWS>
149
				</metadata>
150

    
151
			</xsl:if>
152
		</record>
153
	</xsl:template>
154
</xsl:stylesheet>
155
                  ]]>
156
				</CODE>
157
			</SCRIPT>
158
		</CONFIGURATION>
159
		<STATUS/>
160
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
161
	</BODY>
162
</RESOURCE_PROFILE>
(8-8/27)