Project

General

Profile

1
<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/"
2
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
4
    xmlns:oaf="http://namespace.openaire.eu/oaf" version="1.0" exclude-result-prefixes="oaf">
5

    
6
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
7

    
8
    <xsl:template match="//oaf:result">
9
        <oai_dc:dc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
10
            <xsl:apply-templates/>
11
        </oai_dc:dc>
12
    </xsl:template>
13
    <xsl:template match="subject">
14
        <dc:subject>
15
            <xsl:value-of select="."/>
16
        </dc:subject>
17
    </xsl:template>
18
    <xsl:template match="oaf:result/publisher">
19
        <dc:publisher>
20
            <xsl:value-of select="."/>
21
        </dc:publisher>
22
    </xsl:template>
23

    
24
    <!-- classname of instanceType for dataset is currently UNKNOWN and we want to skip it -->
25
    <xsl:template
26
        match="oaf:result/resulttype | instanceType[./@classname!='Unknown'] | resourceType[./@classname != '']">
27
        <dc:type xml:lang="eng">
28
            <xsl:value-of select="./@classname"/>
29
        </dc:type>
30
    </xsl:template>
31
    <xsl:template match="language[./@classid != '']">
32
        <dc:language>
33
            <xsl:value-of select="./@classid"/>
34
        </dc:language>
35
    </xsl:template>
36
    <xsl:template match="description">
37
        <dc:description>
38
            <xsl:value-of select="."/>
39
        </dc:description>
40
    </xsl:template>
41
    <xsl:template match="source | collectedFrom/@name">
42
        <dc:source>
43
            <xsl:value-of select="."/>
44
        </dc:source>
45
    </xsl:template>
46
    <xsl:template match="oaf:result/title">
47
        <dc:title>
48
            <xsl:value-of select="."/>
49
        </dc:title>
50
    </xsl:template>
51
    <xsl:template match="oaf:result/dateofacceptance">
52
        <dc:date>
53
            <xsl:value-of select="concat('date of acceptance: ', .)"/>
54
        </dc:date>
55
    </xsl:template>
56
    <xsl:template match="oaf:result/embargoenddate">
57
        <dc:date>
58
            <xsl:value-of select="concat('end of embargo: ', .)"/>
59
        </dc:date>
60
    </xsl:template>
61
    <xsl:template match="format">
62
        <dc:format>
63
            <xsl:value-of select="."/>
64
        </dc:format>
65
    </xsl:template>
66
    <xsl:template match="originalId | pid">
67
        <dc:identifier>
68
            <xsl:value-of select="."/>
69
        </dc:identifier>
70
    </xsl:template>
71
    <xsl:template match="bestlicense">
72
        <dc:rights>
73
            <xsl:value-of select="./@classname"/>
74
        </dc:rights>
75
    </xsl:template>
76
    <xsl:template match="rel[./to/@class='hasAuthor']">
77
        <dc:creator>
78
            <xsl:value-of select="./fullname"/>
79
        </dc:creator>
80
    </xsl:template>
81
    <xsl:template match="rel[./to/@class='hasContributor']">
82
        <dc:contributor>
83
            <xsl:value-of select="./fullname"/>
84
        </dc:contributor>
85
    </xsl:template>
86
    <xsl:template match="rel[./to/@class='isProducedBy']">
87
        <dc:relation>
88
            <xsl:value-of select="concat(./acronym, ', grant id: ', ./code)"/>
89
        </dc:relation>
90
    </xsl:template>
91

    
92
    <!-- Links from dataset to publications: only title and openaire identifiers are available...would be better to have the original id, or a pid... -->
93
    <xsl:template match="rel[/to/@class='isRelatedTo']">
94
        <dc:relation>
95
            <xsl:value-of select="./to"/>
96
        </dc:relation>
97
        <dc:relation>
98
            <xsl:value-of select="./title"/>
99
        </dc:relation>
100
    </xsl:template>
101
    <xsl:template match="context | category | concept">
102
        <dc:relation>
103
            <xsl:value-of select="./@label"/>
104
        </dc:relation>
105
    </xsl:template>
106
    <xsl:template match="webresource/url">
107
        <dc:relation>
108
            <xsl:value-of select="."/>
109
        </dc:relation>
110
    </xsl:template>
111

    
112

    
113
    <!-- Override default template -->
114
    <xsl:template match="text()|@*"/>
115
</xsl:stylesheet>
(2-2/3)