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