Revision 55094
Added by Alessia Bardi about 5 years ago
modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/noncompliant/doecode.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER |
|
4 |
value="eed41c78-cd74-4682-a9d1-65a2f6e35bab_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
|
5 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
|
6 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
|
7 |
<RESOURCE_URI value=""/> |
|
8 |
<DATE_OF_CREATION value="2018-11-15T17:09:06+00:00"/> |
|
9 |
</HEADER> |
|
10 |
<BODY> |
|
11 |
<CONFIGURATION> |
|
12 |
<IMPORTED/> |
|
13 |
<SCRIPT> |
|
14 |
<TITLE>xslt_cleaning_ORP-doecode</TITLE> |
|
15 |
<CODE> |
|
16 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1" |
|
17 |
xmlns:oaf="http://namespace.openaire.eu/oaf" |
|
18 |
xmlns:dr="http://www.driver-repository.eu/namespace/dr" |
|
19 |
xmlns:datacite="http://datacite.org/schema/kernel-4" |
|
20 |
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy" |
|
21 |
extension-element-prefixes="TransformationFunction" |
|
22 |
exclude-result-prefixes="TransformationFunction"> |
|
23 |
|
|
24 |
<xsl:param name="varOfficialName"/> |
|
25 |
<xsl:param name="varDsType"/> |
|
26 |
<xsl:param name="varDataSourceId"/> |
|
27 |
<xsl:param name="index" select="0"/> |
|
28 |
<xsl:param name="transDate" select="current-dateTime()"/> |
|
29 |
<xsl:variable name="tf" select="TransformationFunction:getInstance()"/> |
|
30 |
|
|
31 |
<xsl:template match="/"> |
|
32 |
<xsl:variable name="datasourcePrefix" |
|
33 |
select="normalize-space(//oaf:datasourceprefix)"/> |
|
34 |
<xsl:call-template name="validRecord"/> |
|
35 |
</xsl:template> |
|
36 |
|
|
37 |
<xsl:template name="terminate"> |
|
38 |
<xsl:message terminate="yes"> record is not compliant, transformation is |
|
39 |
interrupted. </xsl:message> |
|
40 |
</xsl:template> |
|
41 |
|
|
42 |
<xsl:template name="validRecord"> |
|
43 |
<record> |
|
44 |
<xsl:apply-templates select="//*[local-name() = 'header']"/> |
|
45 |
|
|
46 |
<metadata> |
|
47 |
|
|
48 |
<!-- |
|
49 |
<xsl:apply-templates select="//*[local-name() = 'metadata']//*[local-name() = 'docs']"/> |
|
50 |
--> |
|
51 |
|
|
52 |
<datacite:resource> |
|
53 |
|
|
54 |
<!-- |
|
55 |
CobjCategory, SuperType |
|
56 |
--> |
|
57 |
<xsl:choose> |
|
58 |
<xsl:when |
|
59 |
test="//*[local-name()='software_type'][. = 'S']"> |
|
60 |
<xsl:variable name="varCobjCategory" select="'0029'"/> |
|
61 |
<dr:CobjCategory> |
|
62 |
<xsl:attribute name="type" |
|
63 |
select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/> |
|
64 |
<xsl:value-of select="$varCobjCategory"/> |
|
65 |
</dr:CobjCategory> |
|
66 |
</xsl:when> |
|
67 |
<xsl:otherwise> |
|
68 |
<xsl:call-template name="terminate"/> |
|
69 |
</xsl:otherwise> |
|
70 |
</xsl:choose> |
|
71 |
|
|
72 |
<datacite:resourceType> |
|
73 |
<xsl:attribute name="resourceTypeGeneral" |
|
74 |
select="'Software'"/> |
|
75 |
</datacite:resourceType> |
|
76 |
|
|
77 |
<xsl:for-each |
|
78 |
select="//*[local-name() = 'programming_languages']"> |
|
79 |
<datacite:format> |
|
80 |
<xsl:value-of select="."/> |
|
81 |
</datacite:format> |
|
82 |
</xsl:for-each> |
|
83 |
|
|
84 |
<!-- |
|
85 |
access rights, licenses |
|
86 |
--> |
|
87 |
<oaf:accessrights> |
|
88 |
<xsl:choose> |
|
89 |
<xsl:when |
|
90 |
test="//*[local-name()='accessibility' and .='OS']"> |
|
91 |
<xsl:text>OPEN SOURCE</xsl:text> |
|
92 |
</xsl:when> |
|
93 |
<xsl:when |
|
94 |
test="//*[local-name()='accessibility' and .='ON']"> |
|
95 |
<xsl:text>RESTRICTED</xsl:text> |
|
96 |
</xsl:when> |
|
97 |
<xsl:when |
|
98 |
test="//*[local-name()='accessibility' and .='CS']"> |
|
99 |
<xsl:text>RESTRICTED</xsl:text> |
|
100 |
</xsl:when> |
|
101 |
<xsl:otherwise> |
|
102 |
<xsl:text>UNKNOWN</xsl:text> |
|
103 |
</xsl:otherwise> |
|
104 |
</xsl:choose> |
|
105 |
</oaf:accessrights> |
|
106 |
|
|
107 |
<oaf:license> |
|
108 |
<xsl:value-of select="//*[local-name()='licenses']"/> |
|
109 |
</oaf:license> |
|
110 |
|
|
111 |
<!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE |
|
112 |
--> |
|
113 |
|
|
114 |
<oaf:hostedBy> |
|
115 |
<xsl:attribute name="name"> |
|
116 |
<xsl:value-of select="$varOfficialName"/> |
|
117 |
</xsl:attribute> |
|
118 |
<xsl:attribute name="id"> |
|
119 |
<xsl:value-of select="$varDataSourceId"/> |
|
120 |
</xsl:attribute> |
|
121 |
</oaf:hostedBy> |
|
122 |
<oaf:collectedFrom> |
|
123 |
<xsl:attribute name="name"> |
|
124 |
<xsl:value-of select="$varOfficialName"/> |
|
125 |
</xsl:attribute> |
|
126 |
<xsl:attribute name="id"> |
|
127 |
<xsl:value-of select="$varDataSourceId"/> |
|
128 |
</xsl:attribute> |
|
129 |
</oaf:collectedFrom> |
|
130 |
|
|
131 |
<datacite:publisher> |
|
132 |
<xsl:value-of select="$varOfficialName"/> |
|
133 |
</datacite:publisher> |
|
134 |
|
|
135 |
|
|
136 |
<datacite:alternateIdentifiers> |
|
137 |
|
|
138 |
<!-- landing page --> |
|
139 |
<datacite:alternateIdentifier> |
|
140 |
<xsl:attribute name="alternateIdentifierType" |
|
141 |
select="'LandingPage'"/> |
|
142 |
<xsl:value-of |
|
143 |
select="concat('https://www.osti.gov/doecode/biblio/', //*[local-name() = 'code_id'])" |
|
144 |
/> |
|
145 |
</datacite:alternateIdentifier> |
|
146 |
<xsl:if test="//*[local-name() = 'landing_page']"> |
|
147 |
<datacite:alternateIdentifier> |
|
148 |
<xsl:attribute name="alternateIdentifierType" |
|
149 |
select="'LandingPage'"/> |
|
150 |
<xsl:value-of |
|
151 |
select="//*[local-name() = 'landing_page']"/> |
|
152 |
</datacite:alternateIdentifier> |
|
153 |
</xsl:if> |
|
154 |
|
|
155 |
<xsl:if test="//*[local-name() = 'repository_link']"> |
|
156 |
<datacite:alternateIdentifier> |
|
157 |
<xsl:attribute name="alternateIdentifierType" |
|
158 |
select="'DistributionLocation'"/> |
|
159 |
<xsl:value-of |
|
160 |
select="//*[local-name() = 'repository_link']"/> |
|
161 |
</datacite:alternateIdentifier> |
|
162 |
</xsl:if> |
|
163 |
|
|
164 |
<datacite:alternateIdentifier> |
|
165 |
<xsl:attribute name="alternateIdentifierType" |
|
166 |
select="'local accession id'"/> |
|
167 |
<xsl:value-of select="//*[local-name() = 'code_id']" |
|
168 |
/> |
|
169 |
</datacite:alternateIdentifier> |
|
170 |
|
|
171 |
</datacite:alternateIdentifiers> |
|
172 |
|
|
173 |
<xsl:if test="//*[local-name() = 'documentation_url']"> |
|
174 |
<datacite:relatedIdentifiers> |
|
175 |
<datacite:relatedIdentifier> |
|
176 |
<xsl:attribute name="relatedIdentifierType" |
|
177 |
select="'URL'"/> |
|
178 |
<xsl:attribute name="relationType" |
|
179 |
select="'IsDocumentedBy'"/> |
|
180 |
<xsl:value-of |
|
181 |
select="//*[local-name() = 'documentation_url']"/> |
|
182 |
</datacite:relatedIdentifier> |
|
183 |
</datacite:relatedIdentifiers> |
|
184 |
</xsl:if> |
|
185 |
|
|
186 |
<!-- identifier --> |
|
187 |
<xsl:if test="//*[local-name() = 'doi']"> |
|
188 |
<datacite:identifier> |
|
189 |
<xsl:attribute name="identifierType"> |
|
190 |
<xsl:value-of select="'DOI'"/> |
|
191 |
</xsl:attribute> |
|
192 |
<xsl:value-of select="//*[local-name() = 'doi']"/> |
|
193 |
</datacite:identifier> |
|
194 |
</xsl:if> |
|
195 |
|
|
196 |
<!-- title --> |
|
197 |
<datacite:titles> |
|
198 |
<datacite:title> |
|
199 |
<xsl:value-of |
|
200 |
select="//*[local-name() = 'software_title']"/> |
|
201 |
</datacite:title> |
|
202 |
<xsl:if test="//*[local-name() = 'acronym']"> |
|
203 |
<datacite:title> |
|
204 |
<xsl:attribute name="titleType" |
|
205 |
select="'Subtitle'"/> |
|
206 |
<xsl:value-of |
|
207 |
select="//*[local-name() = 'acronym']"/> |
|
208 |
</datacite:title> |
|
209 |
</xsl:if> |
|
210 |
</datacite:titles> |
|
211 |
|
|
212 |
<xsl:call-template name="authors"/> |
|
213 |
|
|
214 |
<!-- DOE CODE seems to have no paper references |
|
215 |
<xsl:call-template name="relatedPaper" /> |
|
216 |
--> |
|
217 |
|
|
218 |
<datacite:descriptions> |
|
219 |
<datacite:description> |
|
220 |
<xsl:attribute name="descriptionType"> |
|
221 |
<xsl:value-of select="'Abstract'"/> |
|
222 |
</xsl:attribute> |
|
223 |
<xsl:value-of |
|
224 |
select="//*[local-name() = 'description']"/> |
|
225 |
</datacite:description> |
|
226 |
</datacite:descriptions> |
|
227 |
|
|
228 |
<!-- subject --> |
|
229 |
<xsl:if test="//*[local-name() = 'keywords']"> |
|
230 |
<datacite:subjects> |
|
231 |
<datacite:subject> |
|
232 |
<xsl:value-of |
|
233 |
select="//*[local-name() = 'keywords']"/> |
|
234 |
</datacite:subject> |
|
235 |
</datacite:subjects> |
|
236 |
</xsl:if> |
|
237 |
|
|
238 |
<!-- date --> |
|
239 |
<xsl:choose> |
|
240 |
<xsl:when test="//*[local-name() = 'release_date']"> |
|
241 |
<datacite:date> |
|
242 |
<xsl:attribute name="dateType" select="'Issued'"/> |
|
243 |
<xsl:value-of |
|
244 |
select="//*[local-name() = 'release_date']"/> |
|
245 |
</datacite:date> |
|
246 |
<oaf:dateAccepted> |
|
247 |
<xsl:value-of |
|
248 |
select="//*[local-name() = 'release_date']"/> |
|
249 |
</oaf:dateAccepted> |
|
250 |
</xsl:when> |
|
251 |
<xsl:otherwise> |
|
252 |
<oaf:dateAccepted> |
|
253 |
<xsl:value-of |
|
254 |
select="//*[local-name() = 'date_record_added']"/> |
|
255 |
</oaf:dateAccepted> |
|
256 |
</xsl:otherwise> |
|
257 |
</xsl:choose> |
|
258 |
|
|
259 |
</datacite:resource> |
|
260 |
|
|
261 |
</metadata> |
|
262 |
<xsl:copy-of select="//*[local-name() = 'about']"/> |
|
263 |
</record> |
|
264 |
|
|
265 |
</xsl:template> |
|
266 |
|
|
267 |
<xsl:template match="node()|@*"> |
|
268 |
<xsl:copy> |
|
269 |
<xsl:apply-templates select="node()|@*"/> |
|
270 |
</xsl:copy> |
|
271 |
</xsl:template> |
|
272 |
|
|
273 |
<xsl:template |
|
274 |
match="//*[local-name() = 'metadata']//*[local-name() = 'resource']"> |
|
275 |
<xsl:copy> |
|
276 |
<xsl:apply-templates select="node()|@*"/> |
|
277 |
</xsl:copy> |
|
278 |
</xsl:template> |
|
279 |
|
|
280 |
<xsl:template match="//*[local-name() = 'header']"> |
|
281 |
<xsl:copy> |
|
282 |
<xsl:apply-templates select="node()|@*"/> |
|
283 |
<xsl:element name="dr:dateOfTransformation"> |
|
284 |
<xsl:value-of select="$transDate"/> |
|
285 |
</xsl:element> |
|
286 |
</xsl:copy> |
|
287 |
</xsl:template> |
|
288 |
|
|
289 |
<!-- |
|
290 |
<xsl:template match="//*[local-name() = 'authors']"> |
|
291 |
--> |
|
292 |
<xsl:template name="authors"> |
|
293 |
<xsl:choose> |
|
294 |
<xsl:when |
|
295 |
test="not(//*[local-name() = 'developers'][string-length(normalize-space(./*[local-name() = 'last_name'])) > 0 and not(./*[local-name() = 'last_name'] = 'none')])"> |
|
296 |
<xsl:call-template name="terminate"/> |
|
297 |
</xsl:when> |
|
298 |
<xsl:otherwise> |
|
299 |
|
|
300 |
<datacite:creators> |
|
301 |
|
|
302 |
<xsl:for-each select="//*[local-name() = 'developers']"> |
|
303 |
<xsl:element name="datacite:creator"> |
|
304 |
<xsl:element name="datacite:creatorName"> |
|
305 |
<xsl:value-of |
|
306 |
select="normalize-space(concat(./*[local-name()='last_name'], ', ', ./*[local-name()='first_name'], ' ', ./*[local-name()='middle_name']))" |
|
307 |
/> |
|
308 |
</xsl:element> |
|
309 |
<xsl:element name="datacite:givenName"> |
|
310 |
<xsl:value-of |
|
311 |
select="./*[local-name()='first_name']"/> |
|
312 |
</xsl:element> |
|
313 |
<xsl:element name="datacite:familyName"> |
|
314 |
<xsl:value-of |
|
315 |
select="./*[local-name()='last_name']"/> |
|
316 |
</xsl:element> |
|
317 |
<xsl:if |
|
318 |
test="string-length(./*[local-name() = 'orcid']) > 0"> |
|
319 |
<xsl:element name="datacite:nameIdentifier"> |
|
320 |
<xsl:attribute name="nameIdentifierScheme" |
|
321 |
select="'ORCID'"/> |
|
322 |
<xsl:attribute name="schemeURI" |
|
323 |
select="'http://orcid.org'"/> |
|
324 |
<xsl:value-of select="./*[local-name()='orcid']"/> |
|
325 |
</xsl:element> |
|
326 |
</xsl:if> |
|
327 |
<xsl:for-each |
|
328 |
select="./*[local-name() = 'affiliations'][string-length(.) > 0]"> |
|
329 |
<xsl:element name="datacite:affiliation"> |
|
330 |
<xsl:value-of select="."/> |
|
331 |
</xsl:element> |
|
332 |
</xsl:for-each> |
|
333 |
|
|
334 |
</xsl:element> |
|
335 |
</xsl:for-each> |
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
</datacite:creators> |
|
340 |
|
|
341 |
</xsl:otherwise> |
|
342 |
|
|
343 |
</xsl:choose> |
|
344 |
</xsl:template> |
|
345 |
|
|
346 |
<!-- |
|
347 |
<xsl:template match="//*[local-name() = 'DOI']"> |
|
348 |
--> |
|
349 |
<xsl:template name="relatedPaper"> |
|
350 |
<xsl:element name="datacite:relatedIdentifier"> |
|
351 |
<xsl:attribute name="relatedIdentifierType"> |
|
352 |
<xsl:value-of select="'DOI'"/> |
|
353 |
</xsl:attribute> |
|
354 |
<xsl:attribute name="relationType"> |
|
355 |
<xsl:value-of select="'isReferencedBy'"/> |
|
356 |
</xsl:attribute> |
|
357 |
<xsl:value-of select="//*[local-name() = 'DOI']"/> |
|
358 |
</xsl:element> |
|
359 |
</xsl:template> |
|
360 |
|
|
361 |
</xsl:stylesheet> |
|
362 |
</CODE> |
|
363 |
</SCRIPT> |
|
364 |
</CONFIGURATION> |
|
365 |
<STATUS/> |
|
366 |
<SECURITY_PARAMETERS/> |
|
367 |
</BODY> |
|
368 |
</RESOURCE_PROFILE> |
Also available in: Unified diff
TDS for DOE Code