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

    
17
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/"
19
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
21
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:date="http://exslt.org/dates-and-times"
22
xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
23
    extension-element-prefixes="date TransformationFunction"
24
    exclude-result-prefixes="xs TransformationFunction" version="2.0" >
25

    
26

    
27
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
28
    <xsl:param name="varOfficialName"/>
29
    <xsl:param name="varDataSourceId"/>
30
    <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
31

    
32
<xsl:variable name="fundCodes">
33
       <codes>
34
              <code key="DFG"   nspPre="dfgf________"    names="(Deutsche Forschungsgemeinschaft|DFG)" dois="(10.13039/501100001659)" prjs=""/>
35
              <code key="FP7"    nspPre="corda_______"  names="(Seventh Framework Program|FP7)" dois="(10.13039/100011102)" prjs="\d{6}"/>
36
       </codes>
37
</xsl:variable>
38

    
39
<xsl:key name="fundCodesByNames" match="code" use="string(@names)"/>
40
<xsl:key name="fundCodesByDois" match="code" use="string(@dois)"/>
41

    
42
<!-- review status indicated not via resource type by via assertions or relations -->
43
<xsl:variable name="varRefereedAssRel" select="(//crossmark/custom_metadata/assertion/@name[. = 'peerreview_statement']/'0001',
44
                                                   //program/related_item/intra_work_relation/@relationship-type[. = 'isPreprintOf']/'0002')"/>
45

    
46

    
47
    <xsl:template name="terminate">
48
        <xsl:message terminate="yes">
49
            record is not compliant, transformation is interrupted.
50
        </xsl:message>
51
    </xsl:template>
52

    
53
    <xsl:template match="issn">
54
        <xsl:if test="not(name(parent::node()) = 'journal_metadata')">
55
        <xsl:choose>
56
            <xsl:when test=".[@media_type = 'electronic']">
57
                <dc:source>
58
                    <xsl:value-of
59
                        select="concat(string('eissn: '), normalize-space(.))"
60
                    />
61
                </dc:source>
62
            </xsl:when>
63
            <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
64
                <dc:source>
65
                    <xsl:value-of
66
                        select="concat(string('issn: '), normalize-space(.))"
67
                    />
68
                </dc:source>
69
            </xsl:when>
70
        </xsl:choose>
71
        </xsl:if>
72
    </xsl:template>
73

    
74
    <xsl:template match="isbn">
75
        <xsl:if test="not(name(parent::node()) = 'journal_metadata')">
76
        <xsl:choose>
77
            <xsl:when test=".[@media_type = 'electronic']">    <dc:source>
78
                <xsl:value-of
79
                    select="concat(string('eisbn: '), normalize-space(.))"
80
                />
81
            </dc:source></xsl:when>
82
            <xsl:when test=".[@media_type = 'print' or not(@media_type)]">
83
                <dc:source>
84
                    <xsl:value-of
85
                        select="concat(string('isbn: '), normalize-space(.))"
86
                    />
87
                </dc:source>
88
            </xsl:when>
89
        </xsl:choose>
90
        </xsl:if>
91
    </xsl:template>
92

    
93
    <xsl:template match="publisher">
94
        <dc:publisher>
95
            <xsl:value-of select="./publisher_name"/>
96
        </dc:publisher>
97
    </xsl:template>
98

    
99
    <xsl:template match="/">
100
        <xsl:if test="not(.//error)">
101
            <record>
102
                <header>
103
                    <xsl:copy-of select="//*[local-name() = 'header']/*" copy-namespaces="no"/>
104
                    <dr:dateOfTransformation>
105
                        <xsl:value-of select="date:date-time()"/>
106
                    </dr:dateOfTransformation>
107
                </header>
108
                <metadata>
109

    
110
<xsl:if test="not(//(journal_article, conference_paper, book/content_item, book[not(./content_item)]/book_series_metadata/series_metadata, book[not(./content_item)]/book_metadata, posted_content, report-paper/report-paper_metadata, dissertation, database/dataset, sa_component/component_list/component)/titles/title[string-length(normalize-space(.))> 0]) and not(//*[local-name()='conference_paper']/*[local-name()='titles']/*[local-name()='title'][string-length(normalize-space(.))> 0])">
111
                                                         <xsl:call-template name="terminate"/>
112
</xsl:if>
113

    
114
                    <dc:language>eng</dc:language>
115
                    <xsl:call-template name="accessrights"/>
116
                    <oaf:hostedBy id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
117
                        name="Unknown Repository"/>
118
                    <oaf:collectedFrom>
119
                        <xsl:attribute name="name">
120
                            <xsl:value-of select="$varOfficialName"/>
121
                        </xsl:attribute>
122
                        <xsl:attribute name="id">
123
                            <xsl:value-of select="$varDataSourceId"/>
124
                        </xsl:attribute>
125
                    </oaf:collectedFrom>
126

    
127
<xsl:if test="not(//posted_content)">
128
<xsl:choose>
129
     <xsl:when test="count($varRefereedAssRel[. = '0001']) > 0">
130
          <oaf:refereed>
131
               <xsl:value-of select="'0001'"/>
132
          </oaf:refereed>
133
     </xsl:when>
134
     <xsl:when test="count($varRefereedAssRel[. = '0002']) > 0">
135
               <oaf:refereed>
136
                    <xsl:value-of select="'0002'"/>
137
               </oaf:refereed>
138
     </xsl:when>
139
</xsl:choose>
140
</xsl:if>
141

    
142
                    <xsl:apply-templates select=".//*"/>
143

    
144
<!--
145
<xsl:call-template name="CatType"/>
146
-->
147

    
148
                </metadata>
149
                <xsl:copy-of select="//*[local-name() = 'about']/*" copy-namespaces="no"/>
150
            </record>
151
        </xsl:if>
152

    
153
    </xsl:template>
154

    
155
<!-- funding -->
156
<xsl:template match="*[local-name()='relation'][starts-with(., 'info:eu-repo/grantAgreement/')] | assertion[./@name='fundgroup']">
157

    
158
<xsl:variable name="varFP7" select="'corda_______::'"/>
159
<xsl:variable name="varH2020" select="'corda__h2020::'"/>
160
<xsl:variable name="varAKA" select="'aka_________::'"/>
161
<!-- <xsl:variable name="varAFF" select="'aff_________::'"/>  old namespace prefix for Academy of Finland. The new nsp is aka_________ -->
162
<xsl:variable name="varARC" select="'arc_________::'"/>
163
<xsl:variable name="varCONICYT" select="'conicytf____::'"/>
164
<xsl:variable name="varDFG" select="'dfgf________::'"/>
165
<xsl:variable name="varFCT" select="'fct_________::'"/>
166
<xsl:variable name="varFWF" select="'fwf_________::'"/>
167
<xsl:variable name="varHRZZ" select="'irb_hr______::'"/>
168
<xsl:variable name="varMESTD" select="'mestd_______::'"/>
169
<xsl:variable name="varMIUR" select="'miur________::'"/>     <!-- tbd, no statements yet -->
170
<xsl:variable name="varMZOS" select="'irb_hr______::'"/>
171
<xsl:variable name="varNHMRC" select="'nhmrc_______::'"/>
172
<xsl:variable name="varNIH" select="'nih_________::'"/>
173
<xsl:variable name="varNSF" select="'nsf_________::'"/>
174
<xsl:variable name="varNWO" select="'nwo_________::'"/>
175
<xsl:variable name="varUKRI" select="'ukri________::'"/>
176
<xsl:variable name="varSFI" select="'sfi_________::'"/>
177
<xsl:variable name="varSGOV" select="'sgov________::'"/>
178
<xsl:variable name="varSNSF" select="'snsf________::'"/>
179
<xsl:variable name="varTARA" select="'taraexp_____::'"/>
180
<xsl:variable name="varTUBITAK" select="'tubitakf____::'"/>
181
<xsl:variable name="varWT" select="'wt__________::'"/>
182

    
183
<xsl:for-each select=".[local-name()='relation'][starts-with(., 'info:eu-repo/grantAgreement/EC/H2020')]">
184
        <xsl:variable name="projectId"       select="substring-after(., 'info:eu-repo/grantAgreement/EC/H2020/')"/>
185
        <oaf:projectid>     <xsl:value-of select="concat($varH2020, $projectId)"/>       </oaf:projectid>
186
</xsl:for-each>
187

    
188
<!-- EU FP7 -->
189
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/100011102')] or ./assertion[./@name='funder_name' and (contains(., 'Seventh Framework Program') or contains(., 'FP7'))]]/assertion[./@name='award_number']">
190
        <xsl:variable name="projectId"       select="."/>
191
        <oaf:projectid>     <xsl:value-of select="concat($varFP7, $projectId)"/>       </oaf:projectid>
192
</xsl:for-each>
193

    
194
<!-- Changed the NSP it is AKA and not AFF -->
195
<!-- AKA -->
196
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100002341')] or ./assertion[./@name='funder_name' and (contains(., 'Suomen Akatemia') or contains(., 'Academy of Finland'))]]/assertion[./@name='award_number']">
197
        <xsl:variable name="projectId"       select="."/>
198
        <oaf:projectid>     <xsl:value-of select="concat($varAKA, $projectId)"/>       </oaf:projectid>
199
</xsl:for-each>
200

    
201
<!-- ARC -->
202
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100000923')] or ./assertion[./@name='funder_name' and contains(., 'Australian Research Council')]]/assertion[./@name='award_number']">
203
        <xsl:variable name="projectId"       select="."/>
204
        <oaf:projectid>     <xsl:value-of select="concat($varARC, $projectId)"/>       </oaf:projectid>
205
</xsl:for-each>
206

    
207
<!-- CONICYT -->
208
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100002848')] or ./assertion[./@name='funder_name' and (contains(., 'Comisión Nacional de Investigación Científica y Tecnológica') or contains(., 'CONICYT'))]]/assertion[./@name='award_number']">
209
        <xsl:variable name="projectId"       select="."/>
210
        <oaf:projectid>     <xsl:value-of select="concat($varCONICYT, $projectId)"/>       </oaf:projectid>
211
</xsl:for-each>
212

    
213
<!-- DFG -->
214
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100001659')] or ./assertion[./@name='funder_name' and (contains(., 'Deutsche Forschungsgemeinschaft') or contains(., 'DFG'))]]/assertion[./@name='award_number']">
215
        <xsl:variable name="projectId"       select="."/>
216
        <oaf:projectid>     <xsl:value-of select="concat($varDFG, $projectId)"/>       </oaf:projectid>
217
</xsl:for-each>
218

    
219
<!-- UKRI -->
220
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100000690')] or ./assertion[./@name='funder_name' and (contains(., 'Research Councils UK') or contains(., 'RCUK'))]]/assertion[./@name='award_number']  or substring-after(normalize-space(./*[local-name()='funderIdentifier']), 'doi.org/') = ('10.13039/100014013') or contains(./*[local-name()='funderName'], 'UKRI'), contains(./*[local-name()='funderName'], 'UK Research and Innovation')">
221
        <xsl:variable name="projectId"       select="."/>
222
        <oaf:projectid>     <xsl:value-of select="concat($varUKRI, $projectId)"/>       </oaf:projectid>
223
</xsl:for-each>
224

    
225
<!-- SGOV -->
226
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][./assertion[./@name='funder_name' and (contains(., 'Gobierno de Espana') or contains(., 'Ministry of Economy and Competitiveness') or contains(., 'Ministerio de Economía y Competitividad'))]]/assertion[./@name='award_number']">
227
        <xsl:variable name="projectId"       select="."/>
228
        <oaf:projectid>     <xsl:value-of select="concat($varSGOV, $projectId)"/>       </oaf:projectid>
229
</xsl:for-each>
230

    
231
<!-- SNSF -->
232
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100001711')] or ./assertion[./@name='funder_name' and (contains(., 'Swiss National Science Foundation') or contains(., 'Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung'))]]/assertion[./@name='award_number']">
233
        <xsl:variable name="projectId"       select="."/>
234
        <oaf:projectid>     <xsl:value-of select="concat($varSNSF, $projectId)"/>       </oaf:projectid>
235
</xsl:for-each>
236

    
237
<!-- TUBITAK -->
238
<xsl:for-each select=".[local-name()='assertion' and ./@name='fundgroup'][.//assertion[./@name='funder_identifier' and ends-with(., '10.13039/501100004410')] or ./assertion[./@name='funder_name' and (contains(., 'Turkish National Science and Research Council') or (contains(., 'Türkiye Bilimsel ve Teknolojik Ara') and contains(., 'rma Kurumu')))]]/assertion[./@name='award_number']">
239
        <xsl:variable name="projectId"       select="."/>
240
        <oaf:projectid>     <xsl:value-of select="concat($varTUBITAK, $projectId)"/>       </oaf:projectid>
241
</xsl:for-each>
242

    
243

    
244
    </xsl:template>
245

    
246
    <xsl:template match="
247
            journal_article/titles/title |
248
            conference_paper/titles/title |
249
            book/content_item/titles/title |
250
            posted_content/titles/title |
251
            report-paper/report-paper_metadata/titles/title |
252
            dissertation/titles/title |
253
            database/dataset/titles/title |
254
            sa_component/component_list/component/titles/title">
255
        <dc:title>
256
            <xsl:value-of select="normalize-space(.)"/>
257
        </dc:title>
258
<!-- MODIFIED TO MAKE IT WORK WHEN MORE THAN ONE SUBTITLE ELEMENT EXIST -->
259
<xsl:for-each select="../subtitle">
260
        <dc:title>
261
            <xsl:value-of select="normalize-space(.)"/>
262
        </dc:title>
263
       </xsl:for-each>
264
<!-- OLD CODE
265
       <xsl:if test="../subtitle[string-length(.) > 0]">
266
        <dc:title>
267
            <xsl:value-of select="normalize-space(../subtitle)"/>
268
        </dc:title>
269
       </xsl:if>
270
--><!-- END MODIFICATION -->
271
        <!-- TODO: handle subtitles if needed -->
272
    </xsl:template>
273

    
274
<!-- Modified the template match. There was a clash with another template done specifically for book_series_metadata
275
    <xsl:template match="book/book_metadata | book/book_series_metadata">-->
276
<xsl:template match="book/book_metadata">
277
        <xsl:if test="not(../content_item)">
278
            <dc:title>
279
                <xsl:value-of select="normalize-space(./titles/title)"/>
280
            </dc:title>
281
<!-- START SAME MOD DONE BEFORE
282
       <xsl:if test="./titles/subtitle[string-length(.) > 0]">
283
        <dc:title>
284
            <xsl:value-of select="normalize-space(./titles/subtitle[string-length(.) > 0])"/>
285
        </dc:title>
286
       </xsl:if> -->
287

    
288
<xsl:for-each select="../subtitle">
289
        <dc:title>
290
            <xsl:value-of select="normalize-space(.)"/>
291
        </dc:title>
292
       </xsl:for-each>
293

    
294
<!-- END -->
295
         <!--   <dc:date>
296
                <xsl:variable name="d">
297
                    <xsl:value-of
298
                        select="string-join((./publication_date/year, ./publication_date/month, ./publication_date/day), '-')"
299
                    />
300
                </xsl:variable>
301
                <xsl:value-of select="$d"/>
302
            </dc:date> -->
303
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/book')"/>
304
            <dc:type>
305
                <xsl:value-of select="$varType"/>
306
            </dc:type>
307
<!-- The following part is copied where the series metadata template is -->
308
            <xsl:if test="./series_metadata">
309
                <dc:source>
310
                    <xsl:value-of select="./series_metadata/*/title"/>
311
                </dc:source>
312
            </xsl:if>
313
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
314
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
315
<dr:CobjCategory>
316
          <xsl:attribute name="type" select="$varSuperType"/>
317
          <xsl:value-of select="$varCobjCategory" />
318
</dr:CobjCategory>
319
        </xsl:if>
320

    
321
</xsl:template>
322

    
323
    <xsl:template match="person_name[./@contributor_role = 'author']">
324
        <dc:creator>
325
            <xsl:if test="string-length(./ORCID)">
326
                <xsl:attribute name="nameIdentifierScheme">ORCID</xsl:attribute>
327
                <xsl:attribute name="schemeURI">http://orcid.org/</xsl:attribute>
328
                <xsl:attribute name="nameIdentifier">
329
                    <xsl:value-of select="substring-after(./ORCID, 'http://orcid.org/')"/>
330
                </xsl:attribute>
331
            </xsl:if>
332
            <xsl:value-of select="concat(./surname, ', ', ./given_name)"/>
333
        </dc:creator>
334
    </xsl:template>
335

    
336
    <xsl:template match="publication_date | posted_date | acceptance_date | approval_date">
337
        <xsl:variable name="d">
338
            <xsl:value-of select="string-join((./year, ./month, ./day), '-')"/>
339
        </xsl:variable>
340
        <xsl:if test="name(parent::node()) = 'journal_article' or
341
            name(parent::node()) = 'conference_paper' or
342
            name(parent::node()) = 'book_metadata' or
343
            name(parent::node()) = 'book_series_metadata' or
344
            name(parent::node()) = 'posted_content' or
345
            name(parent::node()) = 'dissertation' or
346
            name(parent::node()) = 'report-paper_metadata'">
347
            <dc:date>
348
                <xsl:value-of select="$d"/>
349
            </dc:date>
350
        </xsl:if>
351

    
352
    </xsl:template>
353

    
354
    <xsl:template match="dri:recordIdentifier">
355
        <dc:identifier>
356
            <xsl:value-of select="concat('http://dx.doi.org/', .)"/>
357
        </dc:identifier>
358
        <oaf:identifier identifierType="doi">
359
            <xsl:value-of select="."/>
360
        </oaf:identifier>
361
    </xsl:template>
362

    
363
    <xsl:template match="conference_paper">
364
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/conferenceObject')"/>
365
        <dc:type>
366
            <xsl:value-of select="$varType"/>
367
        </dc:type>
368
        <dc:type>
369
            <xsl:value-of select="string('conference paper')"/>
370
        </dc:type>
371
        <!-- conference_paper: only source -->
372
        <dc:source>
373
            <xsl:value-of select="normalize-space(../proceedings_metadata/proceedings_title)"/>
374
        </dc:source>
375
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
376
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
377
<dr:CobjCategory>
378
          <xsl:attribute name="type" select="$varSuperType"/>
379
          <xsl:value-of select="$varCobjCategory" />
380
</dr:CobjCategory>
381
    </xsl:template>
382

    
383
    <xsl:template match="journal_article">
384
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/article')"/>
385
        <dc:type>
386
            <xsl:value-of select="$varType"/>
387
        </dc:type>
388
        <dc:type>
389
            <xsl:value-of select="string('journal article')"/>
390
        </dc:type>
391
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
392
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
393
<dr:CobjCategory>
394
          <xsl:attribute name="type" select="$varSuperType"/>
395
          <xsl:value-of select="$varCobjCategory" />
396
</dr:CobjCategory>
397

    
398
        <oaf:journal eissn="{../journal_metadata/issn[@media_type='electronic']}"
399
            issn="{../journal_metadata/issn[@media_type='print' or not(@media_type)]}"
400
            iss="{../journal_issue/issue}" vol="{../journal_issue/journal_volume/volume}"
401
            sp="{./pages/first_page}" ep="{./pages/last_page}">
402
            <xsl:value-of select="normalize-space(../journal_metadata/full_title[1])"/>
403
        </oaf:journal>
404
    </xsl:template>
405

    
406
    <xsl:template match="content_item">
407
            <xsl:variable name="varType" select="./@component_type"/>
408
        <dc:type>
409
            <xsl:value-of select="string('info:eu-repo/semantics/bookPart')"/>
410
        </dc:type>
411
        <dc:type>
412
            <xsl:value-of select="$varType"/>
413
        </dc:type>
414
        <xsl:choose>
415
            <xsl:when test="../book_series_metadata">
416
                <dc:source>
417
                    <xsl:value-of select="concat(normalize-space(../book_series_metadata/series_metadata/*/title), ' - ', normalize-space(../book_series_metadata/titles/title))"/>
418
                </dc:source>
419
            </xsl:when>
420
            <xsl:when test="../book_metadata">
421
                <dc:source>
422
                    <xsl:value-of select="normalize-space(../book_metadata/*/title)"/>
423
                </dc:source>
424
            </xsl:when>
425
            </xsl:choose>
426
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
427
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
428
<dr:CobjCategory>
429
          <xsl:attribute name="type" select="$varSuperType"/>
430
          <xsl:value-of select="$varCobjCategory" />
431
</dr:CobjCategory>
432
    </xsl:template>
433

    
434
    <xsl:template match="book/book_series_metadata">
435
        <xsl:if test="not(../content_item)">
436
            <dc:title>
437
                <xsl:value-of select="concat(normalize-space(./series_metadata/*/title),' ' , normalize-space(./titles/title))"/>
438
            </dc:title>
439
       <xsl:if test="./titles/subtitle[string-length(.) > 0]">
440
        <dc:title>
441
            <xsl:value-of select="normalize-space(./titles/subtitle[string-length(.) > 0])"/>
442
        </dc:title>
443
       </xsl:if>
444
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/book')"/>
445
            <dc:type>
446
                <xsl:value-of select="$varType"/>
447
            </dc:type>
448
<xsl:variable name='varCobjCategory' select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
449
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
450
<dr:CobjCategory>
451
          <xsl:attribute name="type" select="$varSuperType"/>
452
          <xsl:value-of select="$varCobjCategory" />
453
</dr:CobjCategory>
454
            <dc:date>
455
                <xsl:variable name="d">
456
                    <xsl:value-of select="string-join((./publication_date/year, ./publication_date/month, ./publication_date/day), '-')"/>
457
                </xsl:variable>
458
                <xsl:value-of select="$d"/>
459
            </dc:date>
460
        </xsl:if>
461
        <xsl:if test=".//publisher">
462
            <dc:publisher>
463
                <xsl:value-of select="./publisher/publisher_name"/>
464
            </dc:publisher>
465
        </xsl:if>
466
<xsl:if test="./series_metadata">
467
                <dc:source>
468
                    <xsl:value-of select="./series_metadata/*/title"/>
469
                </dc:source>
470
            </xsl:if>
471
    </xsl:template>
472

    
473

    
474
    <xsl:template match="posted_content">
475
 <!--
476
        <xsl:variable name="type">
477
            <xsl:value-of select="./@type"/>
478
        </xsl:variable>
479
        <xsl:choose>
480
            <xsl:when test="normalize-space($type) = 'preprint'">
481
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/preprint')"/>
482
                <dc:type>
483
                    <xsl:value-of select="$varType"/>
484
                </dc:type>
485
            </xsl:when>
486
            <xsl:when test="normalize-space($type) = 'working_paper'">
487
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/workingPaper')"/>
488
                <dc:type>
489
                    <xsl:value-of select="$varType"/>
490
                </dc:type>
491
            </xsl:when>
492
            <xsl:when test="normalize-space($type) = 'report'">
493
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/report')"/>
494
                <dc:type>
495
                    <xsl:value-of select="$varType"/>
496
                </dc:type>
497
            </xsl:when>
498
            <xsl:otherwise>
499
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/other')"/>
500
                <dc:type>
501
                    <xsl:value-of select="$varType"/>
502
                </dc:type>
503
            </xsl:otherwise>
504
        </xsl:choose>
505
-->
506

    
507
            <xsl:variable name="varType" select="./@type[.='preprint']/'info:eu-repo/semantics/preprint',
508
                                                                                     ./@type[.='working_paper']/'info:eu-repo/semantics/workingPaper',
509
                                                                                     ./@type[.='report']/'info:eu-repo/semantics/report',
510
                                                                                     ./@type[not(.=('preprint', 'working_paper', 'report'))]/'info:eu-repo/semantics/other'"/>
511
                <dc:type>
512
                    <xsl:value-of select="$varType"/>
513
                </dc:type>
514
        <dc:source>
515
            <xsl:value-of
516
                select="concat(normalize-space(.//institution_name), ' - ', normalize-space(./item_number))"
517
            />
518
        </dc:source>
519

    
520

    
521
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
522
<xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
523
<dr:CobjCategory>
524
          <xsl:attribute name="type" select="$varSuperType"/>
525
          <xsl:value-of select="$varCobjCategory" />
526
</dr:CobjCategory>
527

    
528
 <!--
529
        <xsl:if test="not(normalize-space($type) = 'preprint')">
530
        </xsl:if>
531
-->
532

    
533
<!-- review status -->
534
<xsl:variable name="varRefereedTyp" select="for $i in ($varType) return TransformationFunction:convertString($tf, normalize-space($i), 'ReviewLevels')"/>
535
<xsl:variable name="varRefereed" select="($varRefereedAssRel, $varRefereedTyp)"/>
536
<xsl:choose>
537
     <xsl:when test="count($varRefereed[. = '0001']) > 0">
538
          <oaf:refereed>
539
               <xsl:value-of select="'0001'"/>
540
          </oaf:refereed>
541
     </xsl:when>
542
     <xsl:when test="count($varRefereed[. = '0002']) > 0 or ./program/related_item/intra_work_relation/@relationship-type = 'isPreprintOf'">
543
               <oaf:refereed>
544
                    <xsl:value-of select="'0002'"/>
545
               </oaf:refereed>
546
     </xsl:when>
547
</xsl:choose>
548

    
549

    
550
    </xsl:template>
551

    
552
 <!-- sa_components seem to be supplements, but unfortunately don't state, what pertain to (no second PID)  -->
553
    <xsl:template match="sa_component">
554
            <xsl:variable name="varType" select="string('text')"/>
555
        <dc:type>
556
            <xsl:value-of select="$varType"/>
557
        </dc:type>
558
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
559
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
560
<dr:CobjCategory>
561
          <xsl:attribute name="type" select="$varSuperType"/>
562
          <xsl:value-of select="$varCobjCategory" />
563
</dr:CobjCategory>
564
    </xsl:template>
565

    
566
    <xsl:template match="report-paper">
567
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/report')"/>
568
        <dc:type>
569
            <xsl:value-of select="$varType"/>
570
        </dc:type>
571
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
572
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
573
<dr:CobjCategory>
574
          <xsl:attribute name="type" select="$varSuperType"/>
575
          <xsl:value-of select="$varCobjCategory" />
576
</dr:CobjCategory>
577
    </xsl:template>
578

    
579
    <xsl:template match="dissertation">
580
            <xsl:variable name="varType" select="string('info:eu-repo/semantics/doctoralThesis')"/>
581
        <dc:type>
582
            <xsl:value-of select="$varType"/>
583
        </dc:type>
584
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
585
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
586
<dr:CobjCategory>
587
          <xsl:attribute name="type" select="$varSuperType"/>
588
          <xsl:value-of select="$varCobjCategory" />
589
</dr:CobjCategory>
590
    </xsl:template>
591

    
592
 <!-- databases seem to be bibliographies  -->
593
    <xsl:template match="database">
594
            <xsl:variable name="varType" select="string('bibliography')"/>
595
        <dc:type>
596
            <xsl:value-of select="$varType"/>
597
        </dc:type>
598
<xsl:variable name="varCobjCategory" select="TransformationFunction:convertString($tf, $varType, 'TextTypologies')" />
599
<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
600
<dr:CobjCategory>
601
          <xsl:attribute name="type" select="$varSuperType"/>
602
          <xsl:value-of select="$varCobjCategory" />
603
</dr:CobjCategory>
604
        <dc:source>
605
            <xsl:value-of select="normalize-space(./database_metadata/titles/title)"/>
606
        </dc:source>
607
    </xsl:template>
608

    
609
    <!-- Extend with new templates for additional types of publication     -->
610

    
611

    
612
<!-- oaf:accessrights -->
613
<xsl:template name="accessrights">
614

    
615
       <xsl:choose>
616
              <xsl:when test="//program[./@name = 'AccessIndicators']/(license_ref[./@applies_to='vor' or not(./@applies_to)][contains(., '://creativecommons.org/licenses/by')], free_to_read)">
617
                     <xsl:variable name="varEmbargoEnd">
618
                            <xsl:value-of select="max(//program[./@name = 'AccessIndicators']/(license_ref[./@applies_to='vor' or not(./@applies_to)][contains(., '://creativecommons.org/licenses/by')], free_to_read)/@start_date/string(.))"/>
619
                     </xsl:variable>
620
                     <xsl:if test="xs:date( max(( string($varEmbargoEnd), '0001-01-01' ) ) ) gt current-date()">
621
                            <oaf:accessrights>
622
                                   <xsl:value-of select="'EMBARGO'" />
623
                            </oaf:accessrights>
624
                     </xsl:if>
625
                     <xsl:if test="$varEmbargoEnd and not((xs:date( max( (string($varEmbargoEnd), '0001-01-01') ) ) gt current-date()))">
626
                            <oaf:accessrights>
627
                                   <xsl:value-of select="'OPEN'" />
628
                            </oaf:accessrights>
629
                     </xsl:if>
630
              </xsl:when>
631
              <xsl:otherwise>
632
                     <oaf:accessrights>
633
                            <xsl:value-of select="'UNKNOWN'"/>
634
                     </oaf:accessrights>
635
              </xsl:otherwise>
636
       </xsl:choose>
637

    
638
       <xsl:for-each select="//program[./@name = 'AccessIndicators']/(license_ref[not(./@applies_to = 'am') or not(./@applies_to)], free_to_read)">
639
              <xsl:if test="string-length(.)">
640
                     <oaf:license>
641
                            <xsl:value-of select="." />
642
                     </oaf:license>
643
              </xsl:if>
644
              <xsl:if test="./@start_date">
645
                     <dc:date>
646
                            <xsl:value-of select="concat('info:eu-repo/date/embargoEnd/', ./@start_date)"/>
647
                     </dc:date>
648
              </xsl:if>
649
       </xsl:for-each>
650

    
651
</xsl:template>
652

    
653
<xsl:template name="CatType">
654
<!--
655
<xsl:template match="journal_article | conference_paper | book/content_item | posted_content/type | report-paper | dissertation | database | sa_component">
656
          <xsl:variable name="varCobjCatTmp" select="TransformationFunction:convertString($tf, local-name(.), 'TextTypologies')" />
657
-->
658
          <xsl:variable name="varCobjCatTmp" select="TransformationFunction:convertString($tf, (//journal_article/local-name(), //conference_paper/local-name(), //book/content_item/'0013', //posted_content/@type), 'TextTypologies')" />
659
          <xsl:variable name="varCobjCategory" select="$varCobjCatTmp[string-length($varCobjCatTmp) > 0], '0020'[string-length($varCobjCatTmp) = 0]" />
660
          <xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')" />
661
          <dr:CobjCategory>
662
                    <xsl:attribute name="type" select="$varSuperType"/>
663
                    <xsl:value-of select="$varCobjCategory" />
664
          </dr:CobjCategory>
665
</xsl:template>
666

    
667
    <xsl:template match="* | @*"/>
668

    
669
</xsl:stylesheet>
670

    
671

    
672
]]>
673
				</CODE>
674
			</SCRIPT>
675
		</CONFIGURATION>
676
		<STATUS/>
677
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
678
	</BODY>
679
</RESOURCE_PROFILE>
(2-2/12)