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="issn">
28
        <xsl:if test="not(name(parent::node()) = 'journal_metadata')">
29
        <xsl:choose>
30
            <xsl:when test=".[@media_type = 'electronic']">
31
                <dc:source>
32
                    <xsl:value-of
33
                        select="concat(string('eissn: '), normalize-space(.))"
34
                    />
35
                </dc:source>
36
            </xsl:when>
37
            <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
38
                <dc:source>
39
                    <xsl:value-of
40
                        select="concat(string('issn: '), normalize-space(.))"
41
                    />
42
                </dc:source>
43
            </xsl:when>
44
        </xsl:choose>
45
        </xsl:if>
46
    </xsl:template>
47

    
48
    <xsl:template match="isbn">
49
        <xsl:if test="not(name(parent::node()) = 'journal_metadata')">
50
        <xsl:choose>
51
            <xsl:when test=".[@media_type = 'electronic']">    <dc:source>
52
                <xsl:value-of
53
                    select="concat(string('eisbn: '), normalize-space(.))"
54
                />
55
            </dc:source></xsl:when>
56
            <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
57
                <dc:source>
58
                    <xsl:value-of
59
                        select="concat(string('isbn: '), normalize-space(.))"
60
                    />
61
                </dc:source>
62
            </xsl:when>
63
        </xsl:choose>
64
        </xsl:if>
65
    </xsl:template>
66

    
67
    <xsl:template match="publisher">
68
        <dc:publisher>
69
            <xsl:value-of select="./publisher_name"/>
70
        </dc:publisher>
71
    </xsl:template>
72

    
73
    <xsl:template match="/">
74
        <xsl:if test="not(.//error)">
75
            <record>
76
                <header>
77
                    <xsl:copy-of select="//*[local-name() = 'header']/*" copy-namespaces="no"/>
78
                    <dr:dateOfTransformation>
79
                        <xsl:value-of select="date:date-time()"/>
80
                    </dr:dateOfTransformation>
81
                </header>
82
                <metadata>
83
                    <dc:language>eng</dc:language>
84
                    <oaf:accessrights>UNKNOWN</oaf:accessrights>
85
                    <oaf:hostedBy id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
86
                        name="Unknown Repository"/>
87
                    <oaf:collectedFrom>
88
                        <xsl:attribute name="name">
89
                            <xsl:value-of select="$varOfficialName"/>
90
                        </xsl:attribute>
91
                        <xsl:attribute name="id">
92
                            <xsl:value-of select="$varDataSourceId"/>
93
                        </xsl:attribute>
94
                    </oaf:collectedFrom>
95

    
96
                    <xsl:apply-templates select=".//*"/>
97
                </metadata>
98
                <xsl:copy-of select="//*[local-name() = 'about']/*" copy-namespaces="no"/>
99
            </record>
100
        </xsl:if>
101

    
102
    </xsl:template>
103

    
104
    <xsl:template match="dc:relation">
105
        <xsl:variable name="projectId"
106
            select="substring-after(., 'info:eu-repo/grantAgreement/EC/H2020/')"/>
107
        <oaf:projectid>
108
            <xsl:value-of select="concat('corda__h2020::', $projectId)"/>
109
        </oaf:projectid>
110
    </xsl:template>
111

    
112
    <xsl:template match="
113
            journal_article/titles/title |
114
            conference_paper/titles/title |
115
            book/content_item/titles/title |
116
            posted_content/titles/title">
117
        <dc:title>
118
            <xsl:value-of select="normalize-space(.)"/>
119
        </dc:title>
120
        <!-- TODO: handle subtititles if needed -->
121
    </xsl:template>
122

    
123
    <xsl:template match="book/book_metadata | book/book_series_metadata">
124

    
125
        <xsl:if test="not(../content_item)">
126
            <dc:title>
127
                <xsl:value-of select="normalize-space(./titles/title)"/>
128
            </dc:title>
129
         <!--   <dc:date>
130
                <xsl:variable name="d">
131
                    <xsl:value-of
132
                        select="string-join((./publication_date/year, ./publication_date/month, ./publication_date/day), '-')"
133
                    />
134
                </xsl:variable>
135
                <xsl:value-of select="$d"/>
136
            </dc:date> -->
137
            <dc:type>
138
                <xsl:value-of select="string('info:eu-repo/semantics/book')"/>
139
            </dc:type>
140
            <xsl:if test="./series_metadata">
141
                <dc:source>
142
                    <xsl:value-of select="./series_metadata/*/title"/>
143
                </dc:source>
144
            </xsl:if>
145
            <dr:CobjCategory>0002</dr:CobjCategory>
146
        </xsl:if>
147

    
148
</xsl:template>
149

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

    
163
    <xsl:template match="publication_date | posted_date | acceptance_date">
164
        <xsl:variable name="d">
165
            <xsl:value-of select="string-join((./year, ./month, ./day), '-')"/>
166
        </xsl:variable>
167
        <xsl:if test="name(parent::node()) = 'journal_article' or
168
            name(parent::node()) = 'conference_paper' or
169
            name(parent::node()) = 'book_metadata' or
170
            name(parent::node()) = 'book_series_metadata' or
171
            name(parent::node()) = 'posted_content'">
172

    
173

    
174
            <dc:date>
175
                <xsl:value-of select="$d"/>
176
            </dc:date>
177
        </xsl:if>
178

    
179
    </xsl:template>
180

    
181
    <xsl:template match="dri:recordIdentifier">
182
        <dc:identifier>
183
            <xsl:value-of select="concat('http://dx.doi.org/', .)"/>
184
        </dc:identifier>
185
        <oaf:identifier identifierType="doi">
186
            <xsl:value-of select="."/>
187
        </oaf:identifier>
188
    </xsl:template>
189

    
190
    <xsl:template match="conference_paper">
191
        <dc:type>
192
            <xsl:value-of select="string('info:eu-repo/semantics/conferenceObject')"/>
193
        </dc:type>
194
        <dc:type>
195
            <xsl:value-of select="string('conference paper')"/>
196
        </dc:type>
197
        <!-- conference_paper: only source -->
198
        <dc:source>
199
            <xsl:value-of select="normalize-space(../proceedings_metadata/proceedings_title)"/>
200
        </dc:source>
201

    
202
        <dr:CobjCategory>0004</dr:CobjCategory>
203

    
204

    
205
    </xsl:template>
206

    
207
    <xsl:template match="journal_article">
208
        <dc:type>
209
            <xsl:value-of select="string('info:eu-repo/semantics/article')"/>
210
        </dc:type>
211
        <dc:type>
212
            <xsl:value-of select="string('journal article')"/>
213
        </dc:type>
214

    
215
        <dr:CobjCategory>0001</dr:CobjCategory>
216
        <oaf:journal eissn="{../journal_metadata/issn[@media_type='electronic']}"
217
            issn="{../journal_metadata/issn[@media_type='print' or not(@media_type)]}"
218
            iss="{../journal_issue/issue}" vol="{../journal_issue/journal_volume/volume}"
219
            sp="{./pages/first_page}" ep="{./pages/last_page}">
220
            <xsl:value-of select="normalize-space(../journal_metadata/full_title)"/>
221
        </oaf:journal>
222
    </xsl:template>
223

    
224
    <xsl:template match="content_item">
225
        <dc:type>
226
            <xsl:value-of select="string('info:eu-repo/semantics/bookPart')"/>
227
        </dc:type>
228
        <dc:type>
229
            <xsl:value-of select="./@component_type"/>
230
        </dc:type>
231
        <xsl:choose>
232
            <xsl:when test="../book_series_metadata">
233
                <dc:source>
234
                    <xsl:value-of select="concat(normalize-space(../book_series_metadata/series_metadata/*/title), ' - ', normalize-space(../book_series_metadata/titles/title))"/>
235
                </dc:source>
236
            </xsl:when>
237
            <xsl:when test="../book_metadata">
238
                <dc:source>
239
                    <xsl:value-of select="normalize-space(../book_metadata/*/title)"/>
240
                </dc:source>
241
            </xsl:when>
242
            </xsl:choose>
243
        <dr:CobjCategory>0013</dr:CobjCategory>
244

    
245
    </xsl:template>
246

    
247
    <xsl:template match="posted_content">
248
        <xsl:variable name="type">
249
            <xsl:value-of select="./@type"/>
250
        </xsl:variable>
251
        <xsl:choose>
252
            <xsl:when test="normalize-space($type) = 'preprint'">
253
                <dc:type>
254
                    <xsl:value-of select="string('info:eu-repo/semantics/preprint')"/>
255
                </dc:type>
256
                <dr:CobjCategory>0016</dr:CobjCategory>
257
            </xsl:when>
258
            <xsl:when test="normalize-space($type) = 'working_paper'">
259
                <dc:type>
260
                    <xsl:value-of select="string('info:eu-repo/semantics/workingPaper')"/>
261
                </dc:type>
262
            </xsl:when>
263
            <xsl:when test="normalize-space($type) = 'report'">
264
                <dc:type>
265
                    <xsl:value-of select="string('info:eu-repo/semantics/report')"/>
266
                </dc:type>
267
            </xsl:when>
268
            <xsl:otherwise>
269
                <dc:type>
270
                    <xsl:value-of select="string('info:eu-repo/semantics/other')"/>
271
                </dc:type>
272

    
273
            </xsl:otherwise>
274

    
275
        </xsl:choose>
276
        <dc:source>
277
            <xsl:value-of
278
                select="concat(normalize-space(.//institution_name), ' - ', normalize-space(./item_number))"
279
            />
280
        </dc:source>
281
        <xsl:if test="not(normalize-space($type) = 'preprint')">
282
            <dr:CobjCategory>0020</dr:CobjCategory>
283
        </xsl:if>
284

    
285
    </xsl:template>
286

    
287
    <!-- Extend with new templates for additional types of publication     -->
288

    
289
    <xsl:template match="* | @*"/>
290

    
291
</xsl:stylesheet>
292

    
293
]]>
294
				</CODE>
295
			</SCRIPT>
296
		</CONFIGURATION>
297
		<STATUS/>
298
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
299
	</BODY>
300
</RESOURCE_PROFILE>
(1-1/9)