1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet 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:oaa="http://namespace.openaire.eu/oaa"
|
4
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions"
|
5
|
xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="1.0">
|
6
|
|
7
|
<xsl:param name="parentDatasourceId"/>
|
8
|
<xsl:param name="namespacePrefix"/>
|
9
|
|
10
|
<xsl:template match="/">
|
11
|
<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
12
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
13
|
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
14
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
|
15
|
|
16
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
17
|
<metadata>
|
18
|
<xsl:variable name="rid" select="normalize-space(//repository/@rID)"/>
|
19
|
<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
|
20
|
<xsl:variable name="oUrl" select="normalize-space(//oUrl)"/>
|
21
|
<xsl:variable name="oName" select="normalize-space(//oName)"/>
|
22
|
<xsl:variable name="organizationId" select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/>
|
23
|
<xsl:variable name="repositoryType">
|
24
|
<xsl:choose>
|
25
|
<xsl:when test="normalize-space(//repositoryType) = 'Institutional'">
|
26
|
<xsl:value-of select="string('pubsrepository::institutional')"/>
|
27
|
</xsl:when>
|
28
|
<xsl:when test="normalize-space(//repositoryType) = 'Disciplinary'">
|
29
|
<xsl:value-of select="string('pubsrepository::thematic')"/>
|
30
|
</xsl:when>
|
31
|
<xsl:when test="normalize-space(//repositoryType) = 'Aggregating'">
|
32
|
<xsl:value-of select="string('aggregator::pubsrepository::unknown')"/>
|
33
|
</xsl:when>
|
34
|
<xsl:otherwise>
|
35
|
<xsl:value-of select="string('pubsrepository::unknown')"/>
|
36
|
</xsl:otherwise>
|
37
|
</xsl:choose>
|
38
|
</xsl:variable>
|
39
|
|
40
|
<xsl:variable name="contenttypes">
|
41
|
<xsl:for-each select=".//contentType">
|
42
|
<xsl:if test="position() > 1">-</xsl:if>
|
43
|
<xsl:value-of select="."/>
|
44
|
</xsl:for-each>
|
45
|
</xsl:variable>
|
46
|
<xsl:variable name="languages">
|
47
|
<xsl:for-each select=".//lName">
|
48
|
<xsl:if test="position() > 1">,</xsl:if>
|
49
|
<xsl:value-of select="."/>
|
50
|
</xsl:for-each>
|
51
|
</xsl:variable>
|
52
|
<ROWS>
|
53
|
<ROW table="datasources">
|
54
|
<FIELD name="id">
|
55
|
<xsl:value-of select="$datasourceId"/>
|
56
|
</FIELD>
|
57
|
<FIELD name="_dnet_resource_identifier_">
|
58
|
<xsl:value-of select="$datasourceId"/>
|
59
|
</FIELD>
|
60
|
<FIELD name="officialname">
|
61
|
<xsl:value-of select="normalize-space(//rName)"/>
|
62
|
</FIELD>
|
63
|
<FIELD name="englishname">
|
64
|
<xsl:value-of select="normalize-space(//rAcronym)"/>
|
65
|
</FIELD>
|
66
|
<FIELD name="od_contenttypes">
|
67
|
<xsl:value-of select="normalize-space($contenttypes)"/>
|
68
|
</FIELD>
|
69
|
<FIELD name="od_languages">
|
70
|
<xsl:value-of select="normalize-space($languages)"/>
|
71
|
</FIELD>
|
72
|
<FIELD name="od_numberofitems">
|
73
|
<xsl:value-of select="normalize-space(//rNumOfItems)"/>
|
74
|
</FIELD>
|
75
|
<FIELD name="od_numberofitemsdate">
|
76
|
<xsl:value-of select="normalize-space(//rDateHarvested)"/>
|
77
|
</FIELD>
|
78
|
<FIELD name="description">
|
79
|
<xsl:value-of select="normalize-space(//rDescription)"/>
|
80
|
</FIELD>
|
81
|
<FIELD name="contactEmail">
|
82
|
<xsl:value-of select="normalize-space(//pEmail)"/>
|
83
|
</FIELD>
|
84
|
<FIELD name="latitude" type="float">
|
85
|
<xsl:value-of select="normalize-space(//paLatitude)"/>
|
86
|
</FIELD>
|
87
|
<FIELD name="longitude" type="float">
|
88
|
<xsl:value-of select="normalize-space(//paLongitude)"/>
|
89
|
</FIELD>
|
90
|
<FIELD name="websiteurl">
|
91
|
<xsl:value-of select="normalize-space(//rUrl)"/>
|
92
|
</FIELD>
|
93
|
<FIELD name="logourl"></FIELD>
|
94
|
<FIELD name="namespaceprefix">
|
95
|
<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
|
96
|
</FIELD>
|
97
|
<FIELD name="datasourceclass">
|
98
|
<xsl:value-of select="$repositoryType"/>
|
99
|
</FIELD>
|
100
|
<FIELD name="datasourcescheme">dnet:datasource_typologies</FIELD>
|
101
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
102
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
103
|
<FIELD name="typology">
|
104
|
<xsl:value-of select="normalize-space(//rSoftWareName)"/>
|
105
|
</FIELD>
|
106
|
<FIELD name="optional1"></FIELD>
|
107
|
<FIELD name="optional2"></FIELD>
|
108
|
<FIELD name="collectedfrom">
|
109
|
<xsl:value-of select="$parentDatasourceId"/>
|
110
|
</FIELD>
|
111
|
</ROW>
|
112
|
|
113
|
<xsl:for-each select=".//class">
|
114
|
<xsl:variable name="subjectId" select="normalize-space(concat($parentDatasourceId, '::', ./clCode))"/>
|
115
|
<xsl:variable name="subjectValue" select="normalize-space(./clTitle)"/>
|
116
|
<ROW table="subjects">
|
117
|
<FIELD name="id">
|
118
|
<xsl:value-of select="$subjectId"/>
|
119
|
</FIELD>
|
120
|
<FIELD name="name">
|
121
|
<xsl:value-of select="$subjectValue"/>
|
122
|
</FIELD>
|
123
|
<FIELD name="semanticclass">dnet:od_subjects</FIELD>
|
124
|
<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
|
125
|
<FIELD name="_dnet_resource_identifier_">
|
126
|
<xsl:value-of select="$subjectId"/>
|
127
|
</FIELD>
|
128
|
</ROW>
|
129
|
<ROW table="datasource_subject">
|
130
|
<FIELD name="datasource">
|
131
|
<xsl:value-of select="$datasourceId"/>
|
132
|
</FIELD>
|
133
|
<FIELD name="subject">
|
134
|
<xsl:value-of select="$subjectId"/>
|
135
|
</FIELD>
|
136
|
<FIELD name="_dnet_resource_identifier_">
|
137
|
<xsl:value-of select="concat($datasourceId, '@@', $subjectId)"/>
|
138
|
</FIELD>
|
139
|
</ROW>
|
140
|
</xsl:for-each>
|
141
|
|
142
|
<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
|
143
|
<ROW table="api">
|
144
|
<FIELD name="id">
|
145
|
<xsl:value-of select="$apiId"/>
|
146
|
</FIELD>
|
147
|
<FIELD name="_dnet_resource_identifier_">
|
148
|
<xsl:value-of select="$apiId"/>
|
149
|
</FIELD>
|
150
|
<FIELD name="protocolclass">oai</FIELD>
|
151
|
<FIELD name="datasource">
|
152
|
<xsl:value-of select="$datasourceId"/>
|
153
|
</FIELD>
|
154
|
<FIELD name="contentdescriptionclass">metadata</FIELD>
|
155
|
<FIELD name="typologyclass">
|
156
|
<xsl:value-of select="$repositoryType"/>
|
157
|
</FIELD>
|
158
|
</ROW>
|
159
|
|
160
|
<ROW table="apicollections">
|
161
|
<FIELD name="api">
|
162
|
<xsl:value-of select="$apiId"/>
|
163
|
</FIELD>
|
164
|
<FIELD name="param">baseUrl</FIELD>
|
165
|
<FIELD name="_dnet_resource_identifier_">
|
166
|
<xsl:value-of select="concat($apiId, '@@baseUrl')"/>
|
167
|
</FIELD>
|
168
|
<xsl:choose>
|
169
|
<xsl:when test="string-length(normalize-space(//rOaiBaseUrl)) > 0">
|
170
|
<FIELD name="original">
|
171
|
<xsl:value-of select="normalize-space(//rOaiBaseUrl)"/>
|
172
|
</FIELD>
|
173
|
</xsl:when>
|
174
|
<xsl:otherwise>
|
175
|
<FIELD name="original">unknown</FIELD>
|
176
|
</xsl:otherwise>
|
177
|
</xsl:choose>
|
178
|
</ROW>
|
179
|
|
180
|
<ROW table="apicollections">
|
181
|
<FIELD name="api">
|
182
|
<xsl:value-of select="$apiId"/>
|
183
|
</FIELD>
|
184
|
<FIELD name="param">format</FIELD>
|
185
|
<FIELD name="_dnet_resource_identifier_">
|
186
|
<xsl:value-of select="concat($apiId, '@@format')"/>
|
187
|
</FIELD>
|
188
|
<FIELD name="original">oai_dc</FIELD>
|
189
|
</ROW>
|
190
|
|
191
|
<ROW table="apicollections">
|
192
|
<FIELD name="api">
|
193
|
<xsl:value-of select="$apiId"/>
|
194
|
</FIELD>
|
195
|
<FIELD name="param">metadata_identifier_path</FIELD>
|
196
|
<FIELD name="_dnet_resource_identifier_">
|
197
|
<xsl:value-of select="concat($apiId, '@@metadata_identifier_path')"/>
|
198
|
</FIELD>
|
199
|
<FIELD name="original">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
|
200
|
<FIELD name="accessparam" type="boolean">false</FIELD>
|
201
|
</ROW>
|
202
|
|
203
|
<ROW table="organizations">
|
204
|
<FIELD name="id">
|
205
|
<xsl:value-of select="$organizationId"/>
|
206
|
</FIELD>
|
207
|
<FIELD name="_dnet_resource_identifier_">
|
208
|
<xsl:value-of select="$organizationId"/>
|
209
|
</FIELD>
|
210
|
<FIELD name="legalname">
|
211
|
<xsl:value-of select="$oName"/>
|
212
|
</FIELD>
|
213
|
<FIELD name="legalshortname">
|
214
|
<xsl:value-of select="normalize-space(//oAcronym)"/>
|
215
|
</FIELD>
|
216
|
<FIELD name="websiteurl">
|
217
|
<xsl:choose>
|
218
|
<xsl:when test="starts-with(normalize-space(//oUrl), 'http')">
|
219
|
<xsl:value-of select="normalize-space(//oUrl)" />
|
220
|
</xsl:when>
|
221
|
<xsl:when test="string-length(normalize-space(//oUrl)) > 0">
|
222
|
<xsl:value-of select="concat('http://', normalize-space(//oUrl))" />
|
223
|
</xsl:when>
|
224
|
</xsl:choose>
|
225
|
</FIELD>
|
226
|
<FIELD name="countryClass">
|
227
|
<xsl:choose>
|
228
|
<xsl:when test="normalize-space(//cIsoCode) = 'GB'">UK</xsl:when>
|
229
|
<xsl:otherwise>
|
230
|
<xsl:value-of select="normalize-space(//cIsoCode)"></xsl:value-of>
|
231
|
</xsl:otherwise>
|
232
|
</xsl:choose>
|
233
|
</FIELD>
|
234
|
<FIELD name="countryScheme">dnet:countries</FIELD>
|
235
|
<FIELD name="collectedfrom">
|
236
|
<xsl:value-of select="$parentDatasourceId"/>
|
237
|
</FIELD>
|
238
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
239
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
240
|
<FIELD name="trust" type="float">0.8</FIELD>
|
241
|
</ROW>
|
242
|
|
243
|
<ROW table="datasource_organization">
|
244
|
<FIELD name="datasource">
|
245
|
<xsl:value-of select="$datasourceId"/>
|
246
|
</FIELD>
|
247
|
<FIELD name="organization">
|
248
|
<xsl:value-of select="$organizationId"/>
|
249
|
</FIELD>
|
250
|
<FIELD name="_dnet_resource_identifier_">
|
251
|
<xsl:value-of select="concat($datasourceId,'@@',$organizationId)"/>
|
252
|
</FIELD>
|
253
|
</ROW>
|
254
|
|
255
|
</ROWS>
|
256
|
</metadata>
|
257
|
</record>
|
258
|
</xsl:template>
|
259
|
|
260
|
</xsl:stylesheet>
|