Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="b32acb71-c844-464a-8992-dfc804519a5e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2017-07-03T12:14:22+01:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>claims_openaire_2_OAF</TITLE>
14
                <CODE><![CDATA[<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"
15
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
    xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
17
    xmlns:oai="http://www.openarchives.org/OAI/2.0/"
18
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
19
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:date="http://exslt.org/dates-and-times"
21
    extension-element-prefixes="date" exclude-result-prefixes="xsl">
22

    
23
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
24

    
25
    <xsl:output indent="yes"/>
26

    
27
    <xsl:template match="/">
28
        <xsl:choose>
29
            <xsl:when
30
                test="string-length(//*[local-name() = 'objIdentifier']) = 46 and matches(//*[local-name() = 'objIdentifier'], '\w{12}') and (//instance/webresource/url != '' or //pid[@classid = 'doi'] != '')">
31
                <xsl:call-template name="createRecord"/>
32
            </xsl:when>
33
            <xsl:otherwise>
34
                <xsl:call-template name="skipRecord"/>
35
            </xsl:otherwise>
36
        </xsl:choose>
37

    
38
    </xsl:template>
39

    
40
    <xsl:template name="skipRecord">
41
        <oai:record>
42
            <oai:header>
43
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
44
                    copy-namespaces="no"/>
45
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
46
                    copy-namespaces="no"/>
47
                <dri:recordIdentifier>
48
                    <xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/>
49
                </dri:recordIdentifier>
50
                <dr:dateOfTransformation>
51
                    <xsl:value-of select="date:date-time()"/>
52
                </dr:dateOfTransformation>
53
            </oai:header>
54
            <oai:metadata>
55
                <xsl:copy-of select="//*[local-name() = 'metadata']/*"/>
56
            </oai:metadata>
57
        </oai:record>
58
    </xsl:template>
59

    
60
    <xsl:template name="createRecord">
61
        <oai:record>
62
            <oai:header>
63
                <xsl:copy-of select="//*[local-name() = 'header']/dri:objIdentifier"
64
                    copy-namespaces="no"/>
65
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
66
                    copy-namespaces="no"/>
67
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
68
                    copy-namespaces="no"/>
69
                <dr:dateOfTransformation>
70
                    <xsl:value-of select="date:date-time()"/>
71
                </dr:dateOfTransformation>
72
            </oai:header>
73
            <oai:metadata>
74
                <xsl:apply-templates/>
75
                <!-- Ordered creators (M) -->
76
                <xsl:call-template name="orderedAuthors"/>
77
                <xsl:call-template name="oafFields"/>
78
            </oai:metadata>
79
            <xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
80
        </oai:record>
81
    </xsl:template>
82

    
83

    
84
    <!-- Creators (M) -->
85
    <xsl:template name="orderedAuthors">
86
        <xsl:for-each select="//oaf:result//rel[./to/@class = 'hasAuthor']">
87
            <xsl:sort select="ranking"/>
88
            <dc:creator>
89
                <xsl:value-of select="./fullname"/>
90
            </dc:creator>
91
        </xsl:for-each>
92
    </xsl:template>
93

    
94
    <!-- Titles (M): based on title/@classname <dc:title>main title:subtitle</dc:title>
95
												<dc:title>alternative title</dc:title> <dc:title>translated title</dc:title>
96
												We have only "main title" for now: let's keep it simple here... -->
97
    <xsl:template match="//oaf:result/title">
98
        <dc:title>
99
            <xsl:value-of select="normalize-space(./text())"/>
100
        </dc:title>
101
    </xsl:template>
102

    
103
    <!-- Contributors (R) not currently available -->
104
    <xsl:template match="//oaf:result//rel[./to/@class = 'hasContributor']">
105
        <dc:contributor>
106
            <xsl:value-of select="./fullname"/>
107
        </dc:contributor>
108
    </xsl:template>
109

    
110
    <!--
111
    <xsl:template match="//oaf:result/originalId/text()">
112
        <dc:identifier><xsl:value-of select="normalize-space(.)"/></dc:identifier>
113
    </xsl:template>
114
    -->
115

    
116
    <!-- Alternative Identifier (R), idType from pid@classid <dc:relation>
117
												info:eu-repo/semantics/altIdentifier/[idType]/[ID] </dc:relation> -->
118
    <xsl:template match="//oaf:result/pid[./text()]">
119
        <dc:relation>
120
            <xsl:value-of
121
                select="concat('info:eu-repo/semantics/altIdentifier/', @classid, '/', ./text())"/>
122
        </dc:relation>
123
    </xsl:template>
124

    
125
    <xsl:template match="//oaf:result//*[local-name() = 'instance']/webresource/url/text()">
126
        <dc:identifier>
127
            <xsl:value-of select="."/>
128
        </dc:identifier>
129
    </xsl:template>
130

    
131
    <!-- Subjects (M w A) <dc:subject>bag of words</dc:subject> If subject@classname
132
												!= keywords, then we have a classification scheme to encode <dc:subject>info:eu-repo/classification/[scheme]/[value]</dc:subject>
133
												<dc:subject>info:eu-repo/classification/dcc/whatever</dc:subject> -->
134
    <xsl:template match="//oaf:result/subject[@classname = 'keyword']">
135
        <dc:subject>
136
            <xsl:value-of select="normalize-space(./text())"/>
137
        </dc:subject>
138
    </xsl:template>
139
    <xsl:template match="//oaf:result/subject[not(@classname = 'keyword') and @classid != '']">
140
        <dc:subject>
141
            <xsl:value-of
142
                select="concat('info:eu-repo/classification/', @classid, '/', normalize-space(./text()))"
143
            />
144
        </dc:subject>
145
    </xsl:template>
146

    
147
    <!--description (M w A) from description -->
148
    <xsl:template match="//oaf:result/description/text()">
149
        <dc:description>
150
            <xsl:value-of select="normalize-space(.)"/>
151
        </dc:description>
152
    </xsl:template>
153
    <!--publisher (M w A) from publisher -->
154
    <xsl:template match="//oaf:result/publisher/text()">
155
        <dc:publisher>
156
            <xsl:value-of select="normalize-space(.)"/>
157
        </dc:publisher>
158
    </xsl:template>
159
    <!-- Publication date (M) from dateofacceptance -->
160
    <xsl:template match="//oaf:result/dateofacceptance/text()">
161
        <dc:date>
162
            <xsl:value-of select="normalize-space(.)"/>
163
        </dc:date>
164
    </xsl:template>
165

    
166
    <xsl:template
167
        match="//oaf:result//*[local-name() = 'instance']/*[local-name() = 'instancetype']">
168
        <dc:type>
169
            <xsl:value-of select="./@classname"/>
170
        </dc:type>
171
    </xsl:template>
172

    
173
    <!-- Format (R), in theory from format, not sure we are filling it
174
												<dc:format>mediaType of the digital manifestation of the resource</dc:format>
175
												<dc:format>application/pdf</dc:format> -->
176
    <xsl:template match="//oaf:result/format/text()">
177
        <dc:format>
178
            <xsl:value-of select="normalize-space(.)"/>
179
        </dc:format>
180
    </xsl:template>
181

    
182
    <!-- source (R) from source -->
183
    <xsl:template match="//oaf:result/source/text()">
184
        <dc:source>
185
            <xsl:value-of select="normalize-space(.)"/>
186
        </dc:source>
187
    </xsl:template>
188

    
189
    <xsl:template match="//oaf:result/collectedfrom">
190
        <dc:source>
191
            <xsl:value-of select="normalize-space(@name)"/>
192
        </dc:source>
193
    </xsl:template>
194

    
195
    <!-- Language (R) from language@classid -->
196
    <xsl:template match="//oaf:result/language">
197
        <dc:language>
198
            <xsl:value-of select="./@classid"/>
199
        </dc:language>
200
    </xsl:template>
201

    
202

    
203
    <!-- Oaf:fields -->
204
    <xsl:template name="oafFields">
205
        <dr:CobjCategory>
206
            <xsl:value-of
207
                select="//*[local-name() = 'children']/*[local-name() = 'instance' and ./*[local-name() = 'instancetype']/@classid != ''][1]/*[local-name() = 'instancetype']/@classid"
208
            />
209
        </dr:CobjCategory>
210
        <oaf:dateAccepted>
211
            <xsl:value-of select="//oaf:result/dateofacceptance/text()"/>
212
        </oaf:dateAccepted>
213
        <oaf:accessrights>
214
            <xsl:value-of select="//oaf:result/bestlicense/@classid"/>
215
        </oaf:accessrights>
216
        <oaf:language>
217
            <xsl:value-of select="//oaf:result/language/@classid"/>
218
        </oaf:language>
219
        <oaf:embargoenddate>
220
            <xsl:value-of select="//oaf:result/embargoenddate/text()"/>
221
        </oaf:embargoenddate>
222
        <oaf:hostedby id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
223
            name="Unknown Repository"/>
224
        <oaf:collectedfrom id="infrastruct_::openaire" name="OpenAIRE"/>
225
        <oaf:journal eissn="{//oaf:result/journal/@eissn}" ep="{//oaf:result/journal/@ep}"
226
            iss="{//oaf:result/journal/@issn}" issn="{//oaf:result/journal/@issn}"
227
            lissn="{//oaf:result/journal/@lissn}" sp="{//oaf:result/journal/@sp}"
228
            vol="{//oaf:result/journal/@vol}">
229
            <xsl:value-of select="//oaf:result/journal/text()"/>
230
        </oaf:journal>
231
    </xsl:template>
232

    
233
    <!-- Override default template -->
234
    <xsl:template match="text() | @*"/>
235

    
236
</xsl:stylesheet>
237
]]></CODE>
238
            </SCRIPT>
239
        </CONFIGURATION>
240
        <STATUS/>
241
        <SECURITY_PARAMETERS/>
242
    </BODY>
243
</RESOURCE_PROFILE>
(3-3/84)