Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
4
                version="1.0">
5

    
6
	<xsl:param name="parentDatasourceId"/>
7
	<xsl:param name="namespacePrefix"/>
8

    
9
	<xsl:variable name="dsId" select="concat($namespacePrefix, '::', normalize-space(.//*[local-name()='re3data.orgIdentifier']))"/>
10

    
11
	<xsl:template match="/">
12
		<record
13
		>
14

    
15
			<xsl:copy-of select=".//*[local-name()='header']"/>
16
			<metadata>
17
				<ROWS>
18
					<ROW table="datasources">
19
						<FIELD name="_dnet_resource_identifier_">
20
							<xsl:value-of select="$dsId"/>
21
						</FIELD>
22
						<FIELD name="id">
23
							<xsl:value-of select="$dsId"/>
24
						</FIELD>
25
						<FIELD name="officialName">
26
							<xsl:value-of select=".//*[local-name()='repositoryName']"/>
27
						</FIELD>
28
						<FIELD name="englishName">
29
							<xsl:value-of select=".//*[local-name()='additionalName'][@language='eng']"/>
30
						</FIELD>
31
						<FIELD name="typology">
32
							<xsl:value-of select=".//*[local-name()='software']/*[local-name()='softwareName']"/>
33
						</FIELD>
34
						<FIELD name="webSiteURL">
35
							<xsl:value-of select=".//*[local-name()='repositoryURL']"/>
36
						</FIELD>
37
						<FIELD name="logoURL"></FIELD>
38
						<FIELD name="contactEmail"></FIELD>
39
						<FIELD name="latitude"></FIELD>
40
						<FIELD name="longitude"></FIELD>
41
						<FIELD name="timezone"></FIELD>
42
						<FIELD name="nameSpacePrefix">
43
							<xsl:value-of select="dnet:generateNsPrefix('r3', dnet:md5(normalize-space(.//*[local-name()='re3data.orgIdentifier'])))"/>
44
						</FIELD>
45
						<FIELD name="description">
46
							<xsl:value-of select="./*[local-name()='description']"/>
47
						</FIELD>
48
						<FIELD name="collectedfrom">
49
							<xsl:value-of select="$parentDatasourceId"/>
50
						</FIELD>
51
						<FIELD name="datasourceClass">datarepository::unknown</FIELD>
52
						<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
53
						<FIELD name="releaseStartDate" type="date">
54
							<xsl:value-of select=".//*[local-name()='startDate']"/>
55
						</FIELD>
56
						<FIELD name="releaseEndDate" type="date">
57
							<xsl:value-of select=".//*[local-name()='endDate']"/>
58
						</FIELD>
59
						<FIELD name="missionStatementURL">
60
							<xsl:value-of select=".//*[local-name()='missionStatementURL']"/>
61
						</FIELD>
62
						<xsl:choose>
63
							<xsl:when test=".//*[local-name()='providerType'] = 'dataProvider'">
64
								<FIELD name="dataProvider" type="boolean">true</FIELD>
65
							</xsl:when>
66
							<xsl:otherwise>
67
								<FIELD name="dataProvider" type="boolean">false</FIELD>
68
							</xsl:otherwise>
69
						</xsl:choose>
70
						<xsl:choose>
71
							<xsl:when test=".//*[local-name()='providerType'] = 'serviceProvider'">
72
								<FIELD name="serviceProvider" type="boolean">true</FIELD>
73
							</xsl:when>
74
							<xsl:otherwise>
75
								<FIELD name="serviceProvider" type="boolean">false</FIELD>
76
							</xsl:otherwise>
77
						</xsl:choose>
78
						<FIELD name="databaseAccessType">
79
							<xsl:value-of select=".//*[local-name()='databaseAccessType']"/>
80
						</FIELD>
81
						<FIELD name="dataUploadType">
82
							<xsl:value-of select=".//*[local-name()='dataUploadType']"/>
83
						</FIELD>
84
						<FIELD name="databaseAccessRestriction">
85
							<xsl:value-of select=".//*[local-name()='databaseAccessRestriction']"/>
86
						</FIELD>
87
						<FIELD name="dataUploadRestriction">
88
							<xsl:value-of select=".//*[local-name()='dataUploadRestriction']"/>
89
						</FIELD>
90
						<xsl:choose>
91
							<xsl:when test=".//*[local-name()='versioning'] = 'yes'">
92
								<FIELD name="serviceProvider" type="boolean">true</FIELD>
93
							</xsl:when>
94
							<xsl:otherwise>
95
								<FIELD name="serviceProvider" type="boolean">false</FIELD>
96
							</xsl:otherwise>
97
						</xsl:choose>
98
						<FIELD name="citationGuidelineURL">
99
							<xsl:value-of select=".//*[local-name()='citationGuidelineURL']"/>
100
						</FIELD>
101
						<FIELD name="qualityManagementKind">
102
							<xsl:value-of select=".//*[local-name()='qualityManagement']"/>
103
						</FIELD>
104
						<FIELD name="PIDsystems">
105
							<xsl:value-of select=".//*[local-name()='pidSystem']"/>
106
						</FIELD>
107
						<FIELD name="certificates">
108
							<xsl:value-of select=".//*[local-name()='certificate']"/>
109
						</FIELD>
110
					</ROW>
111

    
112
					<xsl:for-each select="//*[local-name()='api']">
113
						<xsl:variable name="apiId" select="concat('api_________::', $dsId, '::', position())"/>
114
						<ROW table="api">
115
							<FIELD name="_dnet_resource_identifier_">
116
								<xsl:value-of select="$apiId"/>
117
							</FIELD>
118
							<FIELD name="id">
119
								<xsl:value-of select="$apiId"/>
120
							</FIELD>
121
							<FIELD name="protocolclass">
122
								<xsl:value-of select="normalize-space(@apiType)"/>
123
							</FIELD>
124
							<FIELD name="datasource">
125
								<xsl:value-of select="$dsId"/>
126
							</FIELD>
127
							<FIELD name="typologyclass">datarepository::unknown</FIELD>
128
						</ROW>
129

    
130
						<ROW table="apicollections">
131
							<FIELD name="_dnet_resource_identifier_">
132
								<xsl:value-of select="concat($apiId, '@@baseUrl')"/>
133
							</FIELD>
134
							<FIELD name="param">baseUrl</FIELD>
135
							<xsl:variable name="baseURL" select="normalize-space(.)"/>
136
							<FIELD name="original">
137
								<xsl:choose>
138
									<xsl:when test="$baseURL != ''">
139
										<xsl:value-of select="$baseURL"/>
140
									</xsl:when>
141
									<xsl:otherwise>
142
										<xsl:value-of select="string('http://unavailable.base.url')"/>
143
									</xsl:otherwise>
144
								</xsl:choose>
145
							</FIELD>
146
							<FIELD name="api">
147
								<xsl:value-of select="$apiId"/>
148
							</FIELD>
149
						</ROW>
150
					</xsl:for-each>
151

    
152
					<xsl:for-each select="//*[local-name()='policy']">
153
						<xsl:variable name="policyURL" select="./*[local-name='policyURL']"/>
154
						<xsl:variable name="policyId" select="concat($namespacePrefix, '::', dnet:md5($policyURL))"/>
155
						<ROW table="policies">
156
							<FIELD name="_dnet_resource_identifier_">
157
								<xsl:value-of select="$policyId"/>
158
							</FIELD>
159
							<FIELD name="id">
160
								<xsl:value-of select="$policyId"/>
161
							</FIELD>
162
							<FIELD name="name">
163
								<xsl:value-of select="./*[local-name='policyName']"/>
164
							</FIELD>
165
							<FIELD name="url">
166
								<xsl:value-of select="$policyURL"/>
167
							</FIELD>
168
						</ROW>
169

    
170
						<ROW table="datasource_policy">
171
							<FIELD name="_dnet_resource_identifier_">
172
								<xsl:value-of select="concat($dsId, '@@', $policyId)"/>
173
							</FIELD>
174
							<FIELD name="datasource">
175
								<xsl:value-of select="$dsId"/>
176
							</FIELD>
177
							<FIELD name="policy">
178
								<xsl:value-of select="$policyId"/>
179
							</FIELD>
180
						</ROW>
181
					</xsl:for-each>
182

    
183
					<xsl:for-each select="//*[local-name()='subject']">
184
						<xsl:variable name="subjectId" select="concat($namespacePrefix, '::DFG_',  substring-before(. , ' '))"></xsl:variable>
185
						<xsl:variable name="subjectName" select="substring-after(., ' ')"></xsl:variable>
186
						<ROW table="subjects">
187
							<FIELD name="_dnet_resource_identifier_">
188
								<xsl:value-of select="$subjectId"/>
189
							</FIELD>
190
							<FIELD name="id">
191
								<xsl:value-of select="$subjectId"/>
192
							</FIELD>
193
							<FIELD name="name">
194
								<xsl:value-of select="$subjectName"/>
195
							</FIELD>
196
							<FIELD name="semanticclass">DFG</FIELD>
197
							<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
198
						</ROW>
199

    
200
						<ROW table="datasource_subject">
201
							<FIELD name="_dnet_resource_identifier_">
202
								<xsl:value-of select="concat($dsId, '@@', $subjectId)"/>
203
							</FIELD>
204
							<FIELD name="datasource">
205
								<xsl:value-of select="$dsId"/>
206
							</FIELD>
207
							<FIELD name="subject">
208
								<xsl:value-of select="$subjectId"/>
209
							</FIELD>
210
						</ROW>
211
					</xsl:for-each>
212

    
213
					<xsl:for-each select="//*[local-name()='institution']">
214
						<xsl:variable name="orgId" select="concat($namespacePrefix, '::', dnet:md5(normalize-space(./*[local-name()='institutionName'])))"/>
215
						<ROW table="organizations">
216
							<FIELD name="_dnet_resource_identifier_">
217
								<xsl:value-of select="$orgId"/>
218
							</FIELD>
219
							<FIELD name="id">
220
								<xsl:value-of select="$orgId"/>
221
							</FIELD>
222
							<FIELD name="legalname">
223
								<xsl:value-of select="./*[local-name()='institutionName']"/>
224
							</FIELD>
225
							<FIELD name="legalshortname">
226
								<xsl:value-of select="./*[local-name()='institutionAdditionalName'][1]"/>
227
							</FIELD>
228
							<FIELD name="websiteurl">
229
								<xsl:choose>
230
									<xsl:when test="starts-with(normalize-space(./*[local-name()='institutionURL']), 'http')">
231
										<xsl:value-of select="./*[local-name()='institutionURL']"/>
232
									</xsl:when>
233
									<xsl:when test="string-length(normalize-space(./*[local-name()='institutionURL'])) &gt; 0">
234
										<xsl:value-of select="concat('http://', normalize-space(./*[local-name()='institutionURL']))"/>
235
									</xsl:when>
236
								</xsl:choose>
237
							</FIELD>
238
							<FIELD name="countryClass">
239
								<xsl:value-of select="./*[local-name()='institutionCountry']"/>
240
							</FIELD>
241
							<FIELD name="collectedfrom">
242
								<xsl:value-of select="$parentDatasourceId"/>
243
							</FIELD>
244
							<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
245
						</ROW>
246

    
247
						<ROW table="datasource_organization">
248
							<FIELD name="_dnet_resource_identifier_">
249
								<xsl:value-of select="concat($dsId, '@@', $orgId)"/>
250
							</FIELD>
251
							<FIELD name="datasource">
252
								<xsl:value-of select="$dsId"/>
253
							</FIELD>
254
							<FIELD name="organization">
255
								<xsl:value-of select="$orgId"/>
256
							</FIELD>
257
							<FIELD name="startdate" type="date">
258
								<xsl:value-of select="./*[local-name()='responsibilityStartDate']"/>
259
							</FIELD>
260
							<FIELD name="enddate" type="date">
261
								<xsl:value-of select="./*[local-name()='responsibilityEndDate']"/>
262
							</FIELD>
263
						</ROW>
264
					</xsl:for-each>
265

    
266
				</ROWS>
267
			</metadata>
268
		</record>
269
	</xsl:template>
270
</xsl:stylesheet>
271

    
(20-20/25)