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="orderedAuthorsInRels"/>
77
                <xsl:call-template name="orderedAuthorsInCreators"/>
78
                <xsl:call-template name="oafFields"/>
79
            </oai:metadata>
80
            <xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
81
        </oai:record>
82
    </xsl:template>
83

    
84

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

    
95
    <!-- Creators (M) when they are not as linked entities -->
96
    <xsl:template name="orderedAuthorsInCreators">
97
        <xsl:for-each select="//oaf:result/creator">
98
            <xsl:sort select="./@rank"/>
99
            <dc:creator>
100
                <xsl:value-of select="./text()"/>
101
            </dc:creator>
102
        </xsl:for-each>
103
    </xsl:template>
104

    
105
    <!-- Titles (M): based on title/@classname <dc:title>main title:subtitle</dc:title>
106
		<dc:title>alternative title</dc:title> <dc:title>translated title</dc:title>
107
		We have only "main title" for now: let's keep it simple here...
108
    -->
109
    <xsl:template match="//oaf:result/title">
110
        <dc:title>
111
            <xsl:value-of select="normalize-space(./text())"/>
112
        </dc:title>
113
    </xsl:template>
114

    
115
    <!-- Contributors (R)  -->
116
    <xsl:template match="//oaf:result//rel[./to/@class = 'hasContributor']">
117
        <dc:contributor>
118
            <xsl:value-of select="./fullname"/>
119
        </dc:contributor>
120
    </xsl:template>
121
    <xsl:template match="//oaf:result/contributor">
122
        <dc:contributor>
123
            <xsl:value-of select="./text()"/>
124
        </dc:contributor>
125
    </xsl:template>
126

    
127

    
128
    <!-- Let's not keep the original ids, only the PIDs -->
129
    <!--
130
    <xsl:template match="//oaf:result/originalId/text()">
131
        <dc:identifier><xsl:value-of select="normalize-space(.)"/></dc:identifier>
132
    </xsl:template>
133
    -->
134

    
135
    <!--
136
        Alternative Identifier (R), idType from pid@classid
137
        <dc:relation>info:eu-repo/semantics/altIdentifier/[idType]/[ID]</dc:relation>
138
    -->
139
    <xsl:template match="//oaf:result/pid[./text()]">
140
        <dc:relation>
141
            <xsl:value-of
142
                select="concat('info:eu-repo/semantics/altIdentifier/', @classid, '/', ./text())"/>
143
        </dc:relation>
144
    </xsl:template>
145

    
146
    <xsl:template match="//oaf:result//*[local-name() = 'instance']/webresource/url/text()">
147
        <dc:identifier>
148
            <xsl:value-of select="."/>
149
        </dc:identifier>
150
    </xsl:template>
151

    
152
    <!--
153
        Subjects (M w A)
154
        <dc:subject classid="thescheme" classname="theschemeName">value<dc:subject>
155
        <dc:subject classid="dcc" classname="dcc">I am the value<dc:subject>
156
    -->
157
    <xsl:template match="//oaf:result/subject[not(@inferred)]">
158
        <dc:subject classid="{./@classid}" classname="{./@classname}">
159
            <xsl:value-of select="normalize-space(./text())"/>
160
        </dc:subject>
161
    </xsl:template>
162

    
163
    <!--description (M w A) from description -->
164
    <xsl:template match="//oaf:result/description/text()">
165
        <dc:description>
166
            <xsl:value-of select="normalize-space(.)"/>
167
        </dc:description>
168
    </xsl:template>
169
    <!--publisher (M w A) from publisher -->
170
    <xsl:template match="//oaf:result/publisher/text()">
171
        <dc:publisher>
172
            <xsl:value-of select="normalize-space(.)"/>
173
        </dc:publisher>
174
    </xsl:template>
175
    <!-- Publication date (M) from dateofacceptance -->
176
    <xsl:template match="//oaf:result/dateofacceptance/text()">
177
        <dc:date>
178
            <xsl:value-of select="normalize-space(.)"/>
179
        </dc:date>
180
    </xsl:template>
181

    
182
    <xsl:template
183
        match="//oaf:result//*[local-name() = 'instance']/*[local-name() = 'instancetype']">
184
        <dc:type>
185
            <xsl:value-of select="./@classname"/>
186
        </dc:type>
187
    </xsl:template>
188

    
189
    <!--
190
        Format (R), in theory from format, not sure we are filling it
191
		<dc:format>mediaType of the digital manifestation of the resource</dc:format>
192
		<dc:format>application/pdf</dc:format>
193
    -->
194
    <xsl:template match="//oaf:result/format/text()">
195
        <dc:format>
196
            <xsl:value-of select="normalize-space(.)"/>
197
        </dc:format>
198
    </xsl:template>
199

    
200
    <!-- source (R) from source -->
201
    <xsl:template match="//oaf:result/source/text()">
202
        <dc:source>
203
            <xsl:value-of select="normalize-space(.)"/>
204
        </dc:source>
205
    </xsl:template>
206

    
207
    <xsl:template match="//oaf:result/collectedfrom">
208
        <dc:source>
209
            <xsl:value-of select="normalize-space(@name)"/>
210
        </dc:source>
211
    </xsl:template>
212

    
213
    <!-- Language (R) from language@classid -->
214
    <xsl:template match="//oaf:result/language">
215
        <dc:language>
216
            <xsl:value-of select="./@classid"/>
217
        </dc:language>
218
    </xsl:template>
219

    
220

    
221
    <!-- Oaf:fields -->
222
    <xsl:template name="oafFields">
223
        <dr:CobjCategory>
224
            <xsl:value-of
225
                select="//*[local-name() = 'children']/*[local-name() = 'instance' and ./*[local-name() = 'instancetype']/@classid != ''][1]/*[local-name() = 'instancetype']/@classid"
226
            />
227
        </dr:CobjCategory>
228
        <oaf:dateAccepted>
229
            <xsl:value-of select="//oaf:result/dateofacceptance/text()"/>
230
        </oaf:dateAccepted>
231
        <xsl:if test="//oaf:result/bestlicense/@classid">
232
            <oaf:accessrights>
233
                <xsl:value-of select="//oaf:result/bestlicense/@classid"/>
234
            </oaf:accessrights>
235
        </xsl:if>
236
        <xsl:if test="//oaf:result/bestaccessright/@classid">
237
            <oaf:accessrights>
238
                <xsl:value-of select="//oaf:result/bestaccessright/@classid"/>
239
            </oaf:accessrights>
240
        </xsl:if>
241
        <oaf:language>
242
            <xsl:value-of select="//oaf:result/language/@classid"/>
243
        </oaf:language>
244
        <oaf:embargoenddate>
245
            <xsl:value-of select="//oaf:result/embargoenddate/text()"/>
246
        </oaf:embargoenddate>
247
        <oaf:hostedby id="infrastruct_::openaire" name="OpenAIRE"/>
248
        <oaf:collectedfrom id="infrastruct_::openaire" name="OpenAIRE"/>
249
        <oaf:journal eissn="{//oaf:result/journal/@eissn}" ep="{//oaf:result/journal/@ep}"
250
            iss="{//oaf:result/journal/@issn}" issn="{//oaf:result/journal/@issn}"
251
            lissn="{//oaf:result/journal/@lissn}" sp="{//oaf:result/journal/@sp}"
252
            vol="{//oaf:result/journal/@vol}">
253
            <xsl:value-of select="//oaf:result/journal/text()"/>
254
        </oaf:journal>
255
    </xsl:template>
256

    
257
    <!-- Override default template -->
258
    <xsl:template match="text() | @*"/>
259

    
260
</xsl:stylesheet>
261

    
262

    
263
]]></CODE>
264
			</SCRIPT>
265
		</CONFIGURATION>
266
		<STATUS/>
267
		<SECURITY_PARAMETERS/>
268
	</BODY>
269
</RESOURCE_PROFILE>
(3-3/6)