Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="2bc17dbe-93a9-4a4d-bd61-9831f1efdd0c_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2016-11-21T11:15:30+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>crossref2oaf</TITLE>
14
				<CODE>
15
					<![CDATA[
16
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/"
18
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
20
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:date="http://exslt.org/dates-and-times"
21
    extension-element-prefixes="date" exclude-result-prefixes="xs" version="2.0">
22

    
23
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
24
    <xsl:param name="varOfficialName"/>
25
    <xsl:param name="varDataSourceId"/>
26

    
27
    <xsl:template match="/">
28
        <xsl:if test="not(.//error)">
29
            <record>
30
                <header>
31
                    <xsl:copy-of select="//*[local-name() = 'header']/*" copy-namespaces="no"/>
32
                    <dr:dateOfTransformation>
33
                        <xsl:value-of select="date:date-time()"/>
34
                    </dr:dateOfTransformation>
35
                </header>
36
                <metadata>
37
                    <dc:language>eng</dc:language>
38
                    <oaf:accessrights>UNKNOWN</oaf:accessrights>
39
                    <oaf:hostedBy id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
40
                        name="Unknown Repository"/>
41
                    <oaf:collectedFrom>
42
                        <xsl:attribute name="name">
43
                            <xsl:value-of select="$varOfficialName"/>
44
                        </xsl:attribute>
45
                        <xsl:attribute name="id">
46
                            <xsl:value-of select="$varDataSourceId"/>
47
                        </xsl:attribute>
48
                    </oaf:collectedFrom>
49

    
50
                    <xsl:apply-templates select=".//*"/>
51
                </metadata>
52
                <xsl:copy-of select="//*[local-name() = 'about']/*" copy-namespaces="no"/>
53
            </record>
54
        </xsl:if>
55

    
56
    </xsl:template>
57

    
58
    <xsl:template match="dc:relation">
59
        <xsl:variable name="projectId"
60
            select="substring-after(., 'info:eu-repo/grantAgreement/EC/H2020/')"/>
61
        <oaf:projectid>
62
            <xsl:value-of select="concat('corda__h2020::', $projectId)"/>
63
        </oaf:projectid>
64
    </xsl:template>
65

    
66
    <xsl:template
67
        match="
68
            journal_article/titles/title |
69
            conference_paper/titles/title |
70
            book/content_item/titles/title |
71
            posted_content/titles/title">
72
        <dc:title>
73
            <xsl:value-of select="normalize-space(.)"/>
74
        </dc:title>
75
        <!-- TODO: handle subtititles if needed -->
76
    </xsl:template>
77

    
78
    <xsl:template match="book/book_metadata | book/book_series_metadata">
79

    
80
        <xsl:if test="not(../content_item)">
81
            <dc:title>
82
                <xsl:value-of select="normalize-space(./titles/title)"/>
83
            </dc:title>
84
            <dc:date>
85
                <xsl:variable name="d">
86
                    <xsl:value-of
87
                        select="string-join((./publication_date/year, ./publication_date/month, ./publication_date/day), '-')"
88
                    />
89
                </xsl:variable>
90
                <xsl:value-of select="$d"/>
91
            </dc:date>
92
            <dc:type>
93
                <xsl:value-of select="string('info:eu-repo/semantics/book')"/>
94
            </dc:type>
95
            <xsl:if test="./series_metadata">
96
                <dc:source>
97
                    <xsl:value-of select="./series_metadata/*/title"/>
98
                </dc:source>
99
            </xsl:if>
100
            <xsl:for-each select="./isbn">
101
                <xsl:choose>
102
                    <xsl:when test=".[@media_type = 'electronic']">    <dc:source>
103
                <xsl:value-of
104
                    select="concat(string('eisbn: '), normalize-space(.))"
105
                />
106
            </dc:source></xsl:when>
107
                    <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
108
                        <dc:source>
109
                <xsl:value-of
110
                    select="concat(string('isbn: '), normalize-space(.))"
111
                />
112
            </dc:source>
113
                    </xsl:when>
114
                </xsl:choose>
115

    
116
            </xsl:for-each>
117
            <xsl:for-each select="./issn">
118
                <xsl:choose>
119
                    <xsl:when test=".[@media_type = 'electronic']">
120
                        <dc:source>
121
                    <xsl:value-of
122
                        select="concat(string('eissn: '), normalize-space(.))"
123
                    />
124
                </dc:source>
125
                    </xsl:when>
126
                    <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
127
                        <dc:source>
128
                    <xsl:value-of
129
                        select="concat(string('issn: '), normalize-space(./series_metadata/issn[@media_type = 'print' or not(@media_type)]))"
130
                    />
131
                </dc:source>
132
                    </xsl:when>
133
                </xsl:choose>
134

    
135

    
136
            </xsl:for-each>
137

    
138
            <dr:CobjCategory>0002</dr:CobjCategory>
139
        </xsl:if>
140

    
141
        <xsl:if test="./publisher">
142
            <dc:publisher>
143
                <xsl:value-of select="./publisher/publisher_name"/>
144
            </dc:publisher>
145
        </xsl:if>
146

    
147

    
148
</xsl:template>
149
      <xsl:template
150
        match="
151
            journal_article/contributors/person_name[./@contributor_role = 'author'] |
152
            conference_paper/contributors/person_name[./@contributor_role = 'author'] |
153
            content_item/contributors/person_name[./@contributor_role = 'author'] |
154
            posted_content/contributors/person_name[./@contributor_role = 'author']">
155
        <dc:creator>
156
            <xsl:if test="string-length(./ORCID)">
157
                <xsl:attribute name="nameIdentifierScheme">ORCID</xsl:attribute>
158
                <xsl:attribute name="schemeURI">http://orcid.org/</xsl:attribute>
159
                <xsl:attribute name="nameIdentifier">
160
                    <xsl:value-of select="substring-after(./ORCID, 'http://orcid.org/')"/>
161
                </xsl:attribute>
162
            </xsl:if>
163
            <xsl:value-of select="concat(./surname, ', ', ./given_name)"/>
164
        </dc:creator>
165
    </xsl:template>
166

    
167
    <xsl:template
168
        match="
169
            journal_article/publication_date |
170
            conference_paper/publication_date |
171
            content_item/publication_date">
172
        <xsl:variable name="d">
173
            <xsl:value-of select="string-join((./year, ./month, ./day), '-')"/>
174
        </xsl:variable>
175
        <dc:date>
176
            <xsl:value-of select="$d"/>
177
        </dc:date>
178
        <!--  <oaf:dateAccepted>
179
            <xsl:value-of select="$d"/>
180
        </oaf:dateAccepted> -->
181
    </xsl:template>
182

    
183
    <xsl:template
184
        match="
185
            posted_content/posted_date |
186
            posted_content/acceptance_date">
187
        <xsl:variable name="d">
188
            <xsl:value-of select="string-join((./year, ./month, ./day), '-')"/>
189
        </xsl:variable>
190
        <dc:date>
191
            <xsl:value-of select="$d"/>
192
        </dc:date>
193
        <!--  <oaf:dateAccepted>
194
            <xsl:value-of select="$d"/>
195
        </oaf:dateAccepted> -->
196
    </xsl:template>
197
    <xsl:template match="dri:recordIdentifier">
198
        <dc:identifier>
199
            <xsl:value-of select="concat('http://dx.doi.org/', .)"/>
200
        </dc:identifier>
201
        <oaf:identifier identifierType="doi">
202
            <xsl:value-of select="."/>
203
        </oaf:identifier>
204
    </xsl:template>
205

    
206
    <xsl:template match="conference_paper">
207
        <dc:type>
208
            <xsl:value-of select="string('info:eu-repo/semantics/conferenceObject')"/>
209
        </dc:type>
210
        <dc:type>
211
            <xsl:value-of select="string('conference paper')"/>
212
        </dc:type>
213
        <!-- conference_paper: only source -->
214
        <dc:source>
215
            <xsl:value-of select="normalize-space(../proceedings_metadata/proceedings_title)"/>
216
        </dc:source>
217
        <dr:CobjCategory>0004</dr:CobjCategory>
218
        <!-- TODO: ISBN? Other proceedings info? -->
219
    </xsl:template>
220

    
221
    <xsl:template match="journal_article">
222
        <dc:type>
223
            <xsl:value-of select="string('info:eu-repo/semantics/article')"/>
224
        </dc:type>
225
        <dc:type>
226
            <xsl:value-of select="string('journal article')"/>
227
        </dc:type>
228
        <dc:source>
229
            <xsl:value-of select="normalize-space(../journal_metadata/full_title)"/>
230
        </dc:source>
231
        <dr:CobjCategory>0001</dr:CobjCategory>
232
        <oaf:journal eissn="{../journal_metadata/issn[@media_type='electronic']}"
233
            issn="{../journal_metadata/issn[@media_type='print' or not(@media_type)]}"
234
            iss="{../journal_issue/issue}" vol="{../journal_issue/journal_volume/volume}"
235
            sp="{./pages/first_page}" ep="{./pages/last_page}">
236
            <xsl:value-of select="normalize-space(../journal_metadata/full_title)"/>
237
        </oaf:journal>
238
    </xsl:template>
239

    
240
    <xsl:template match="content_item">
241
        <dc:type>
242
            <xsl:value-of select="string('info:eu-repo/semantics/bookPart')"/>
243
        </dc:type>
244
        <dc:type>
245
            <xsl:value-of select="./@component_type"/>
246
        </dc:type>
247
        <xsl:choose>
248
            <xsl:when test="../book_series_metadata">
249
                <dc:source>
250
                    <xsl:value-of select="concat(normalize-space(../book_series_metadata/series_metadata/*/title), ' - ', normalize-space(../book_series_metadata/titles/title))"/>
251
                </dc:source>
252
            </xsl:when>
253
            <xsl:when test="../book_metadata">
254
                <dc:source>
255
                    <xsl:value-of select="normalize-space(../book_metadata/*/title)"/>
256
                </dc:source>
257
            </xsl:when>
258
            </xsl:choose>
259

    
260
            <xsl:for-each select="..//issn ">
261
                    <xsl:choose>
262
                        <xsl:when test=".[@media_type = 'electronic']">
263
                             <dc:source>
264
                            <xsl:value-of select="concat(string('eissn: '), normalize-space(.))"/>
265
                        </dc:source>
266
                        </xsl:when>
267
                        <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
268
                            <dc:source>
269
                                <xsl:value-of select="concat(string('issn: '), normalize-space(.))"/>
270
                            </dc:source>
271
                        </xsl:when>
272
                    </xsl:choose>
273
                </xsl:for-each>
274
                <xsl:for-each select="..//isbn ">
275
                    <xsl:choose>
276
                        <xsl:when test=".[@media_type = 'electronic']">
277
                            <dc:source>
278
                    <xsl:value-of select="concat(string('eisbn: '), normalize-space(.))"/>
279
                </dc:source>
280
                        </xsl:when>
281
                        <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
282
                            <dc:source>
283
                    <xsl:value-of select="concat(string('isbn: '), normalize-space(.))" />
284
                </dc:source>
285
                        </xsl:when>
286
                    </xsl:choose>
287
                </xsl:for-each>
288

    
289

    
290

    
291
        <dr:CobjCategory>0013</dr:CobjCategory>
292

    
293
    </xsl:template>
294

    
295
 <!--   <xsl:template match="book_series_metadata">
296
        <xsl:if test="not(../content_item)">
297
            <dc:type>
298
                <xsl:value-of select="string('info:eu-repo/semantics/book')"/>
299
            </dc:type>
300
            <dc:source>
301
                <xsl:value-of
302
                    select="concat(normalize-space(../book_series_metadata/series_metadata/*/title), ' - ', normalize-space(../book_series_metadata/titles/title))"
303
                />
304
            </dc:source>
305
            <dr:CobjCategory>0002</dr:CobjCategory>
306
        </xsl:if>
307
    </xsl:template>
308

    
309
    <xsl:template match="book/book_metadata">
310
        <xsl:if test="not(../content_item)">
311
            <dc:type>
312
                <xsl:value-of select="string('info:eu-repo/semantics/book')"/>
313
            </dc:type>
314
            <dc:source>
315
                <xsl:value-of
316
                    select="concat(string('eisbn: '), normalize-space(./isbn[@media_type = 'electronic']))"
317
                />
318
            </dc:source>
319
            <dc:source>
320
                <xsl:value-of
321
                    select="concat(string('isbn: '), normalize-space(./isbn[@media_type = 'print' or not(@media_type)]))"
322
                />
323
            </dc:source>
324
            <dr:CobjCategory>0002</dr:CobjCategory>
325
        </xsl:if>
326

    
327

    
328
    </xsl:template>-->
329

    
330
    <xsl:template match="posted_content">
331
        <xsl:variable name="type">
332
            <xsl:value-of select="./@type"/>
333
        </xsl:variable>
334
        <xsl:choose>
335
            <xsl:when test="normalize-space($type) = 'preprint'">
336
                <dc:type>
337
                    <xsl:value-of select="string('info:eu-repo/semantics/preprint')"/>
338
                </dc:type>
339
                <dr:CobjCategory>0016</dr:CobjCategory>
340
            </xsl:when>
341
            <xsl:when test="normalize-space($type) = 'working_paper'">
342
                <dc:type>
343
                    <xsl:value-of select="string('info:eu-repo/semantics/workingPaper')"/>
344
                </dc:type>
345
            </xsl:when>
346
            <xsl:when test="normalize-space($type) = 'report'">
347
                <dc:type>
348
                    <xsl:value-of select="string('info:eu-repo/semantics/report')"/>
349
                </dc:type>
350
            </xsl:when>
351
            <xsl:otherwise>
352
                <dc:type>
353
                    <xsl:value-of select="string('info:eu-repo/semantics/other')"/>
354
                </dc:type>
355

    
356
            </xsl:otherwise>
357

    
358
        </xsl:choose>
359
        <dc:source>
360
            <xsl:value-of
361
                select="concat(normalize-space(.//institution_name), ' - ', normalize-space(./item_number))"
362
            />
363
        </dc:source>
364
        <xsl:if test="not(normalize-space($type) = 'preprint')">
365
            <dr:CobjCategory>0020</dr:CobjCategory>
366
        </xsl:if>
367

    
368
    </xsl:template>
369
    <!-- Extend with new templates for additional types of publication     -->
370

    
371

    
372
    <xsl:template match="* | @*"/>
373

    
374
</xsl:stylesheet>
375

    
376
]]>
377
				</CODE>
378
			</SCRIPT>
379
		</CONFIGURATION>
380
		<STATUS/>
381
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
382
	</BODY>
383
</RESOURCE_PROFILE>
(6-6/84)