1 |
53315
|
alessia.ba
|
<!--
|
2 |
|
|
(M): Mandatory
|
3 |
|
|
(R): Reccomended
|
4 |
|
|
(M w A): Mandatory when Applicable
|
5 |
|
|
-->
|
6 |
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
7 |
|
|
xmlns:datacite="http://datacite.org/schema/kernel-3"
|
8 |
|
|
xmlns:oaf="http://namespace.openaire.eu/oaf" version="1.0" exclude-result-prefixes="oaf">
|
9 |
|
|
|
10 |
|
|
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
|
11 |
|
|
|
12 |
|
|
<xsl:variable name="openaireNamespace" select="string('oai:dnet:')"/>
|
13 |
|
|
|
14 |
|
|
<xsl:template match="//oaf:entity">
|
15 |
|
|
<datacite:resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
16 |
|
|
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
|
17 |
|
|
<xsl:apply-templates/>
|
18 |
|
|
<datacite:titles>
|
19 |
|
|
<xsl:for-each select="oaf:result/title/text()">
|
20 |
|
|
<datacite:title>
|
21 |
|
|
<xsl:value-of select="normalize-space(.)"/>
|
22 |
|
|
</datacite:title>
|
23 |
|
|
</xsl:for-each>
|
24 |
|
|
</datacite:titles>
|
25 |
|
|
<datacite:descriptions>
|
26 |
|
|
<xsl:for-each select="oaf:result/description/text()">
|
27 |
|
|
<datacite:description descriptionType="Abstract">
|
28 |
|
|
<xsl:value-of select="normalize-space(.)"/>
|
29 |
|
|
</datacite:description>
|
30 |
|
|
</xsl:for-each>
|
31 |
|
|
</datacite:descriptions>
|
32 |
|
|
<datacite:subjects>
|
33 |
|
|
<xsl:for-each select="oaf:result/subject[./text()]">
|
34 |
|
|
<xsl:choose>
|
35 |
|
|
<xsl:when test="@classname='keyword'">
|
36 |
|
|
<datacite:subject>
|
37 |
|
|
<xsl:value-of select="normalize-space(./text())"/>
|
38 |
|
|
</datacite:subject>
|
39 |
|
|
</xsl:when>
|
40 |
|
|
<xsl:otherwise>
|
41 |
|
|
<datacite:subject subjectScheme="{@classid}">
|
42 |
|
|
<xsl:value-of select="normalize-space(./text())"/>
|
43 |
|
|
</datacite:subject>
|
44 |
|
|
</xsl:otherwise>
|
45 |
|
|
</xsl:choose>
|
46 |
|
|
</xsl:for-each>
|
47 |
|
|
</datacite:subjects>
|
48 |
|
|
<!-- Dates are mandatory but we do not always have them... -->
|
49 |
|
|
<datacite:dates>
|
50 |
|
|
<datacite:date dateType="Issued">
|
51 |
|
|
<xsl:value-of select="oaf:result/dateofacceptance/text()"/>
|
52 |
|
|
</datacite:date>
|
53 |
|
|
<xsl:variable name="embargoEndDate">
|
54 |
|
|
<xsl:value-of select="oaf:result/embargoenddate/text()"/>
|
55 |
|
|
</xsl:variable>
|
56 |
|
|
<xsl:if test="$embargoEndDate != ''">
|
57 |
|
|
<datacite:date dateType="Available">
|
58 |
|
|
<xsl:value-of select="$embargoEndDate"/>
|
59 |
|
|
</datacite:date>
|
60 |
|
|
</xsl:if>
|
61 |
|
|
</datacite:dates>
|
62 |
|
|
<!-- Size (O) -->
|
63 |
|
|
<datacite:sizes>
|
64 |
|
|
<xsl:for-each select="oaf:result/size/text()">
|
65 |
|
|
<datacite:size>
|
66 |
|
|
<xsl:value-of select="."/>
|
67 |
|
|
</datacite:size>
|
68 |
|
|
</xsl:for-each>
|
69 |
|
|
</datacite:sizes>
|
70 |
|
|
|
71 |
|
|
</datacite:resource>
|
72 |
|
|
</xsl:template>
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
<!--Identifier (M) -->
|
76 |
|
|
<xsl:template match="oaf:result//webresource/url ">
|
77 |
|
|
<datacite:identifier identifierType="URL">
|
78 |
|
|
<xsl:value-of select="./text()"/>
|
79 |
|
|
</datacite:identifier>
|
80 |
|
|
</xsl:template>
|
81 |
|
|
|
82 |
|
|
<!-- Alt id : we know it's only one because we do not deduplicate dataset-->
|
83 |
|
|
<xsl:template match="oaf:result/pid/text()">
|
84 |
|
|
<datacite:alternateIdentifiers>
|
85 |
|
|
<datacite:alternateIdentifier alternateIdentifierType="{@classid}">
|
86 |
|
|
<xsl:value-of select="."/>
|
87 |
|
|
</datacite:alternateIdentifier>
|
88 |
|
|
</datacite:alternateIdentifiers>
|
89 |
|
|
</xsl:template>
|
90 |
|
|
|
91 |
|
|
<!-- Handling relationships -->
|
92 |
|
|
<xsl:template match="oaf:result/rels">
|
93 |
|
|
<!-- Creators (M) -->
|
94 |
|
|
<datacite:creators>
|
95 |
|
|
<xsl:apply-templates select="./rel[./to/@class='hasAuthor']"/>
|
96 |
|
|
</datacite:creators>
|
97 |
|
|
<datacite:contributors>
|
98 |
|
|
<!-- person contributors: not yet available in openaire -->
|
99 |
|
|
<xsl:apply-templates select="./rel[./to/@class='hasContributor']"/>
|
100 |
|
|
<!-- contributor fields is also used to model funding information -->
|
101 |
|
|
<xsl:apply-templates select="./rel[./to/@class='isProducedBy']"/>
|
102 |
|
|
</datacite:contributors>
|
103 |
|
|
<datacite:relatedIdentifiers>
|
104 |
|
|
<!-- Links to publications -->
|
105 |
|
|
<xsl:apply-templates select="./rel[./resulttype/@classid='publication']"/>
|
106 |
|
|
</datacite:relatedIdentifiers>
|
107 |
|
|
|
108 |
|
|
</xsl:template>
|
109 |
|
|
|
110 |
|
|
<!--Creator template -->
|
111 |
|
|
<xsl:template match="rel[./to/@class='hasAuthor']">
|
112 |
|
|
<datacite:creator>
|
113 |
|
|
<datacite:creatorName>
|
114 |
|
|
<xsl:value-of select="./fullname"/>
|
115 |
|
|
</datacite:creatorName>
|
116 |
|
|
</datacite:creator>
|
117 |
|
|
</xsl:template>
|
118 |
|
|
|
119 |
|
|
<!-- Person Contributor template -->
|
120 |
|
|
<xsl:template match="rel[./to/@class='hasContributor']">
|
121 |
|
|
<datacite:contributor>
|
122 |
|
|
<datacite:contributorName>
|
123 |
|
|
<xsl:value-of select="./fullname"/>
|
124 |
|
|
</datacite:contributorName>
|
125 |
|
|
</datacite:contributor>
|
126 |
|
|
</xsl:template>
|
127 |
|
|
|
128 |
|
|
<!-- Funding template, goes into contributors -->
|
129 |
|
|
<xsl:template match="rel[./to/@class='isProducedBy']">
|
130 |
|
|
<xsl:variable name="funder">
|
131 |
|
|
<xsl:choose>
|
132 |
|
|
<xsl:when test="./contracttype/@schemeid = 'ec:FP7contractTypes'">
|
133 |
|
|
<xsl:value-of select="string('EC')"/>
|
134 |
|
|
</xsl:when>
|
135 |
|
|
<xsl:when test="./contracttype/@schemeid = 'wt:contractTypes'">
|
136 |
|
|
<xsl:value-of select="string('WT')"/>
|
137 |
|
|
</xsl:when>
|
138 |
|
|
<xsl:when test="./contracttype/@schemeid = 'fct:contractTypes'">
|
139 |
|
|
<xsl:value-of select="string('FCT')"/>
|
140 |
|
|
</xsl:when>
|
141 |
|
|
</xsl:choose>
|
142 |
|
|
</xsl:variable>
|
143 |
|
|
<xsl:variable name="fundingProgramme">
|
144 |
|
|
<xsl:choose>
|
145 |
|
|
<xsl:when test="$funder = 'EC'">
|
146 |
|
|
<xsl:value-of select="./funding/funding_level_0"/>
|
147 |
|
|
</xsl:when>
|
148 |
|
|
<xsl:when test="$funder = 'WT'">
|
149 |
|
|
<xsl:value-of select="substring-after(./funding_level_1/text(), 'WT::')"/>
|
150 |
|
|
</xsl:when>
|
151 |
|
|
<xsl:when test="$funder = 'FCT'">
|
152 |
|
|
<xsl:value-of select="substring-after(./funding_level_1/text(), 'FCT::')"/>
|
153 |
|
|
</xsl:when>
|
154 |
|
|
</xsl:choose>
|
155 |
|
|
</xsl:variable>
|
156 |
|
|
<xsl:variable name="jurisdiction">
|
157 |
|
|
<xsl:choose>
|
158 |
|
|
<xsl:when test="$funder = 'EC'">
|
159 |
|
|
<xsl:value-of select="string('EU')"/>
|
160 |
|
|
</xsl:when>
|
161 |
|
|
<xsl:when test="$funder = 'WT'">
|
162 |
|
|
<xsl:value-of select="string('')"/>
|
163 |
|
|
</xsl:when>
|
164 |
|
|
<xsl:when test="$funder = 'FCT'">
|
165 |
|
|
<xsl:value-of select="string('PT')"/>
|
166 |
|
|
</xsl:when>
|
167 |
|
|
<xsl:otherwise/>
|
168 |
|
|
</xsl:choose>
|
169 |
|
|
</xsl:variable>
|
170 |
|
|
<datacite:contributor contributorType="Funder">
|
171 |
|
|
<datacite:contributorName>
|
172 |
|
|
<xsl:value-of select="$funder"/>
|
173 |
|
|
</datacite:contributorName>
|
174 |
|
|
<datacite:nameIdentifier nameIdentifierScheme="info">
|
175 |
|
|
<xsl:value-of
|
176 |
|
|
select="concat('info:eu-repo/grantAgreement/', $funder, '/', $fundingProgramme, '/', ./code, '/', $jurisdiction, '/' , ./title, '/', ./acronym)"
|
177 |
|
|
/>
|
178 |
|
|
</datacite:nameIdentifier>
|
179 |
|
|
</datacite:contributor>
|
180 |
|
|
</xsl:template>
|
181 |
|
|
|
182 |
|
|
<!-- Links to publication. The related id should be a DOI or similar, but we only have the openaire id for now... -->
|
183 |
|
|
<xsl:template match="rel[./resulttype/@classid='publication']">
|
184 |
|
|
<datacite:relatedIdentifier relatedIdentifierType="openaire" relationType="IsReferencedBy">
|
185 |
|
|
<xsl:value-of select="concat($openaireNamespace, ./to/text())"/>
|
186 |
|
|
</datacite:relatedIdentifier>
|
187 |
|
|
</xsl:template>
|
188 |
|
|
|
189 |
|
|
<!--publisher (M) from publisher -->
|
190 |
|
|
<xsl:template match="oaf:result/publisher/text()">
|
191 |
|
|
<datacite:publisher>
|
192 |
|
|
<xsl:value-of select="normalize-space(.)"/>
|
193 |
|
|
</datacite:publisher>
|
194 |
|
|
</xsl:template>
|
195 |
|
|
|
196 |
|
|
<!-- Publication year (M) -->
|
197 |
|
|
<xsl:template match="oaf:result/dateofacceptance/text()">
|
198 |
|
|
<datacite:publicationYear>
|
199 |
|
|
<xsl:value-of select="normalize-space(substring-before(.,'-'))"/>
|
200 |
|
|
</datacite:publicationYear>
|
201 |
|
|
</xsl:template>
|
202 |
|
|
|
203 |
|
|
<!-- Language (R) from language@classid -->
|
204 |
|
|
<xsl:template match="oaf:result/language/@classid">
|
205 |
|
|
<datacite:language>
|
206 |
|
|
<xsl:value-of select="."/>
|
207 |
|
|
</datacite:language>
|
208 |
|
|
</xsl:template>
|
209 |
|
|
|
210 |
|
|
<!-- ResourceType (R) -->
|
211 |
|
|
<xsl:template
|
212 |
|
|
match="oaf:result/children/instance/instancetype[./@classname!='Unknown'] | oaf:result/resourcetype[./@classname != '']">
|
213 |
|
|
<datacite:resourceType resourceTypeGeneral="{./@classname}"/>
|
214 |
|
|
</xsl:template>
|
215 |
|
|
|
216 |
|
|
<!-- Version (O) -->
|
217 |
|
|
<xsl:template match="oaf:result/version/text()">
|
218 |
|
|
<datacite:version>
|
219 |
|
|
<xsl:value-of select="."/>
|
220 |
|
|
</datacite:version>
|
221 |
|
|
</xsl:template>
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
<!-- Rights list (M) -->
|
225 |
|
|
<xsl:template match="oaf:result/bestlicense">
|
226 |
|
|
<xsl:variable name="license">
|
227 |
|
|
<xsl:choose>
|
228 |
|
|
<xsl:when test="@classid='OPEN'">
|
229 |
|
|
<xsl:value-of select="string('info:eu-repo/semantics/openAccess')"/>
|
230 |
|
|
</xsl:when>
|
231 |
|
|
<xsl:when test="@classid='CLOSED'">
|
232 |
|
|
<xsl:value-of select="string('info:eu-repo/semantics/closedAccess')"/>
|
233 |
|
|
</xsl:when>
|
234 |
|
|
<xsl:when test="@classid='RESTRICTED'">
|
235 |
|
|
<xsl:value-of select="string('info:eu-repo/semantics/restrictedAccess')"/>
|
236 |
|
|
</xsl:when>
|
237 |
|
|
<xsl:when test="@classid='EMBARGO'">
|
238 |
|
|
<xsl:value-of select="string('info:eu-repo/semantics/embargoedAccess')"/>
|
239 |
|
|
</xsl:when>
|
240 |
|
|
<xsl:otherwise>
|
241 |
|
|
<xsl:value-of select="string('info:eu-repo/semantics/unknownAccess')"/>
|
242 |
|
|
</xsl:otherwise>
|
243 |
|
|
</xsl:choose>
|
244 |
|
|
</xsl:variable>
|
245 |
|
|
<datacite:rightsList>
|
246 |
|
|
<datacite:rights rightsURI="{$license}">
|
247 |
|
|
<xsl:value-of select="./@classname"/>
|
248 |
|
|
</datacite:rights>
|
249 |
|
|
</datacite:rightsList>
|
250 |
|
|
</xsl:template>
|
251 |
|
|
|
252 |
|
|
<!-- Override default template -->
|
253 |
|
|
<xsl:template match="text()|@*"/>
|
254 |
|
|
</xsl:stylesheet>
|