Project

General

Profile

1
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2
    xmlns:oaf="http://namespace.openaire.eu/oaf">
3
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="utf-8"/>
4
    <xsl:strip-space elements="*"/>
5

    
6

    
7
    <xsl:template match="/">
8
        <xsl:apply-templates select="//oaf:entity/*"/>
9
    </xsl:template>
10

    
11
    <xsl:template match="result/header"/>
12

    
13
    <xsl:template match="oaf:result[./resulttype/@classid = 'dataset']">
14
        <oaf:result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15
            xmlns:oaf="http://namespace.openaire.eu/oaf"
16
            xsi:schemaLocation="http://namespace.openaire.eu/oaf http://datathon.openaire.eu/datathon-schema/oaf-dataset-1.1.xsd">
17
            <xsl:apply-templates/>
18
        </oaf:result>
19
    </xsl:template>
20

    
21
    <xsl:template match="oaf:result[./resulttype/@classid = 'publication']">
22
        <oaf:result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23
            xmlns:oaf="http://namespace.openaire.eu/oaf"
24
            xsi:schemaLocation="http://namespace.openaire.eu/oaf http://datathon.openaire.eu/datathon-schema/oaf-publication-1.1.xsd">
25
            <xsl:apply-templates/>
26
            <xsl:apply-templates select="../extraInfo" mode="citations"/>
27
        </oaf:result>
28
    </xsl:template>
29
    
30
    <xsl:template match="oaf:project">
31
        <oaf:project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32
            xmlns:oaf="http://namespace.openaire.eu/oaf"
33
            xsi:schemaLocation="http://namespace.openaire.eu/oaf http://datathon.openaire.eu/datathon-schema/oaf-project-1.1.xsd">
34
            <xsl:apply-templates/>
35
            <oaf:oamandatedatasets>
36
                <xsl:choose>
37
                    <xsl:when test="string-length(./ecsc39) &gt; 0">
38
                        <xsl:value-of select="./ecsc39"/>
39
                    </xsl:when>
40
                    <xsl:otherwise>false</xsl:otherwise>
41
                </xsl:choose>
42
             </oaf:oamandatedatasets>
43
        </oaf:project>
44
    </xsl:template>
45
    
46
    <xsl:template match="oaf:organization">
47
        <oaf:organization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
48
            xmlns:oaf="http://namespace.openaire.eu/oaf"
49
            xsi:schemaLocation="http://namespace.openaire.eu/oaf http://datathon.openaire.eu/datathon-schema/oaf-org-1.1.xsd">
50
            <xsl:apply-templates/>
51
        </oaf:organization>
52
    </xsl:template>
53

    
54
    <xsl:template match="fundingtree">
55
        <oaf:funding>
56
            <oaf:funder id="{./funder/id}"
57
                shortname="{./funder/shortname}"
58
                name="{./funder/name}"
59
                jurisdiction="{./funder/jurisdiction}"/>
60
            <xsl:if test=".//funding_level_0">
61
                <oaf:funding_level_0 name="{.//funding_level_0/name}"><xsl:value-of select=".//funding_level_0/id"/></oaf:funding_level_0>
62
            </xsl:if>
63
            <xsl:if test=".//funding_level_1">
64
                <oaf:funding_level_1 name="{.//funding_level_1/name}"><xsl:value-of select=".//funding_level_1/id"/></oaf:funding_level_1>
65
            </xsl:if>
66
            <xsl:if test=".//funding_level_2">
67
                <oaf:funding_level_2 name="{.//funding_level_2/name}"><xsl:value-of select=".//funding_level_2/id"/></oaf:funding_level_2>
68
            </xsl:if>
69
        </oaf:funding>
70
    </xsl:template>
71

    
72
    <xsl:template match="extraInfo[./@typology = 'citations']" mode="citations">
73
        <oaf:citations provenance="{@provenance}" trust="{@trust}">
74
            <xsl:for-each select="./citations/citation">
75
                <oaf:citation position="{@position}">
76
                <xsl:apply-templates select="./*"/>
77
                </oaf:citation>
78
            </xsl:for-each>
79
        </oaf:citations>
80
    </xsl:template>
81

    
82
    <xsl:template match="rawtext | id" mode="citations">
83
        <xsl:element name="oaf:{./local-name()}" namespace="http://namespace.openaire.eu/oaf">
84
            <xsl:apply-templates/>
85
        </xsl:element>
86
    </xsl:template>
87
    
88
   
89
    <!-- excluded from all entities-->
90
    <xsl:template match="extraInfo"/>
91
    <xsl:template match="children"/>
92
    <xsl:template match="context[./@type = 'funding']"/>
93
    <xsl:template match="datainfo"/>
94
    <xsl:template match="datasourcetypeui"/>
95
    <xsl:template match="@schemeid | @schemename | @classid | @scheme"/>
96
    
97
    <xsl:template match="oaf:result/relevantdate"/>
98
    <xsl:template match="oaf:result/lastmetadataupdate"/>
99
    <xsl:template match="oaf:result/country"/>
100
    <xsl:template match="oaf:result/fulltext"/>
101
    <xsl:template match="oaf:result/contributor"/>
102
    <xsl:template match="oaf:result/storagedate"/>
103
    <xsl:template match="oaf:result/metadataversionnumber"/>
104
    
105
    <xsl:template match="oaf:result[./resulttype/@classid = 'dataset']/bestlicense"/>
106
    <xsl:template match="oaf:result[./resulttype/@classid = 'dataset']/source"/>
107
    
108
    <xsl:template match="oaf:result[./resulttype/@classid = 'publication']/format"/>
109
    <xsl:template match="oaf:result[./resulttype/@classid = 'publication']/resourcetype"/>
110
    <xsl:template match="oaf:result[./resulttype/@classid = 'publication']/device"/>
111
    <xsl:template match="oaf:result[./resulttype/@classid = 'publication']/size"/>
112
    <xsl:template match="oaf:result[./resulttype/@classid = 'publication']/version"/>
113

    
114
    <xsl:template match="oaf:project/websiteurl"/>
115
    <xsl:template match="oaf:project/keywords"/>
116
    <xsl:template match="oaf:project/subjects"/>
117
    <xsl:template match="oaf:project/pid"/>
118
    <xsl:template match="oaf:project/duration"/>
119
    <xsl:template match="oaf:project/ecsc39"/>
120
    <xsl:template match="oaf:project/ecarticle29_3"/>
121
    
122
    <!-- ORGS -->
123
    <xsl:template match="oaf:organization/logourl"/>
124
    <xsl:template match="oaf:organization/pid"/>
125
    
126
    <xsl:template match="oaf:organization/eclegalbody">
127
        <oaf:legalbody><xsl:value-of select="."/></oaf:legalbody>
128
    </xsl:template>
129
    <xsl:template match="oaf:organization/ecenterprise">
130
        <oaf:enterprise><xsl:value-of select="."/></oaf:enterprise>
131
    </xsl:template>
132
    <xsl:template match="oaf:organization/ecnonprofit">
133
        <oaf:noprofit><xsl:value-of select="."/></oaf:noprofit>
134
    </xsl:template>
135
    <xsl:template match="oaf:organization/echighereducation">
136
        <oaf:highereducation><xsl:value-of select="."/></oaf:highereducation>
137
    </xsl:template>
138
    <xsl:template match="oaf:organization/ecsmevalidated">
139
        <oaf:smevalidated><xsl:value-of select="."/></oaf:smevalidated>
140
    </xsl:template>
141
    <xsl:template match="oaf:organization/ecinternationalorganization">
142
        <oaf:internationalorganization><xsl:value-of select="."/></oaf:internationalorganization>
143
    </xsl:template>
144
    <xsl:template match="oaf:organization/eclegalperson">
145
        <oaf:legalperson><xsl:value-of select="."/></oaf:legalperson>
146
    </xsl:template>
147
    <xsl:template match="oaf:organization/ecresearchorganization">
148
        <oaf:researchorganization><xsl:value-of select="."/></oaf:researchorganization>
149
    </xsl:template>
150
    <!-- Types of orgs we do not know what they mean -->
151
    <xsl:template match="oaf:organization/ecnutscode"/>
152
    <xsl:template match="oaf:organization/ecinternationalorganizationeurinterests"/>
153
       
154

    
155
    <!-- Communities -->
156
    <xsl:template match="context[./@type = 'community']">
157
        <oaf:community id="{@id}" label="{@label}">
158
            <xsl:apply-templates/>
159
        </oaf:community>
160
    </xsl:template>
161

    
162
    <!-- exclude attributes -->
163
    <xsl:template match="oaf:result/title | rel[./to/@type = 'result']/title">
164
        <xsl:element name="oaf:resulttitle" namespace="http://namespace.openaire.eu/oaf">
165
            <xsl:value-of select="./text()"/>
166
        </xsl:element>
167
    </xsl:template>
168
    <xsl:template match="oaf:project/title | rel[./to/@type = 'project']/title">
169
        <xsl:element name="oaf:projecttitle" namespace="http://namespace.openaire.eu/oaf">
170
            <xsl:value-of select="./text()"/>
171
        </xsl:element>
172
    </xsl:template>
173

    
174
    <!-- move the classname into the node text content -->
175
    <xsl:template match="resulttype | resourcetype | instancetype">
176
        <xsl:element name="oaf:{./local-name()}" namespace="http://namespace.openaire.eu/oaf">
177
            <xsl:value-of select="./@classname"/>
178
        </xsl:element>
179
    </xsl:template>
180
    <xsl:template match="language | country | datasourcetype | contracttype">
181
        <xsl:element name="oaf:{./local-name()}" namespace="http://namespace.openaire.eu/oaf">
182
            <xsl:attribute name="code">
183
                <xsl:value-of select="./@classid"/>
184
            </xsl:attribute>
185
            <xsl:value-of select="./@classname"/>
186
        </xsl:element>
187
    </xsl:template>
188
    <xsl:template match="collectedfrom">
189
        <xsl:element name="oaf:collectedfrom" namespace="http://namespace.openaire.eu/oaf">
190
            <xsl:attribute name="name">
191
                <xsl:value-of select="./@name"/>
192
            </xsl:attribute>
193
        </xsl:element>
194
    </xsl:template>
195
    <xsl:template match="hostedby">
196
        <xsl:element name="oaf:hostedby" namespace="http://namespace.openaire.eu/oaf">
197
            <xsl:attribute name="name">
198
                <xsl:value-of select="./@name"/>
199
            </xsl:attribute>
200
        </xsl:element>
201
    </xsl:template>
202
    <!-- rename licenses -->
203
    <xsl:template match="bestlicense">
204
        <xsl:element name="oaf:bestaccessrights" namespace="http://namespace.openaire.eu/oaf">
205
            <xsl:attribute name="code">
206
                <xsl:value-of select="./@classid"/>
207
            </xsl:attribute>
208
            <xsl:value-of select="./@classname"/>
209
        </xsl:element>
210
    </xsl:template>
211
    <xsl:template match="licence">
212
        <xsl:element name="oaf:accessrights" namespace="http://namespace.openaire.eu/oaf">
213
            <xsl:attribute name="code">
214
                <xsl:value-of select="./@classid"/>
215
            </xsl:attribute>
216
            <xsl:value-of select="./@classname"/>
217
        </xsl:element>
218
    </xsl:template>
219

    
220
    <!-- rels -->
221

    
222
    <xsl:template match="rels">
223
        <xsl:for-each select="rel[./to/@class='hasAuthor']">
224
            <oaf:creator rank="{./ranking}"><xsl:value-of select="./fullname"/></oaf:creator>
225
        </xsl:for-each>
226
        <oaf:relationships>
227
            <xsl:apply-templates select="./rel" mode="rel"/>
228
        </oaf:relationships>
229
    </xsl:template>
230

    
231
    <xsl:template match="rel" mode="rel">
232
        <oaf:relationship semantics="{./to/@class}">
233
            <xsl:apply-templates select="attribute::*"/>
234
            <oaf:target type="{./to/@type}" id="{./to}">
235
                <xsl:apply-templates select="./*"/>
236
            </oaf:target>
237
        </oaf:relationship>
238
    </xsl:template>
239
    
240
    <xsl:template match="rel[./to/@class='hasAuthor']" mode="rel"/>
241
    <xsl:template match="rel[./to/@class='isAmongTopNSimilarDocuments']" mode="rel"/>
242
    <xsl:template match="rel[./to/@class='hasAmongTopNSimilarDocuments']" mode="rel"/>
243
    <xsl:template match="rel[./to/@class='isProvidedBy']" mode="rel"/>
244

    
245
    <xsl:template match="rel/to" />
246
    <xsl:template match="rel/type" />
247

    
248
    <!-- instances -->
249
    <xsl:template match="oaf:result/children">
250
        <oaf:instances>
251
            <xsl:apply-templates select="./instance"/>
252
        </oaf:instances>
253
        <xsl:apply-templates select="./externalreference"/>
254
    </xsl:template>
255
    
256
    <xsl:template match="externalreference">
257
        <oaf:externalreference>
258
            <oaf:sitename><xsl:value-of select="./sitename/text()"/></oaf:sitename>
259
            <oaf:url><xsl:value-of select="./url/text()"/></oaf:url>
260
            <oaf:refidentifier type="{./qualifier/@classid}"><xsl:value-of select="./refidentifier/text()"/></oaf:refidentifier>
261
        </oaf:externalreference>
262
    </xsl:template>
263

    
264
    <xsl:template match="instance/@id"/>
265
    <xsl:template match="@inferenceprovenance"/>
266
    <xsl:template match="@trust"/>
267
    <xsl:template match="@inferred"/>
268
    <xsl:template match="@provenanceaction">
269
        <xsl:attribute name="provenance">
270
            <xsl:choose>
271
                <xsl:when test=". = 'iis'"><xsl:value-of select="string('inference')"/></xsl:when>
272
                <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
273
            </xsl:choose>
274
        </xsl:attribute>
275
    </xsl:template>
276

    
277
    <xsl:template match="@classname">
278
        <xsl:attribute name="type">
279
            <xsl:value-of select="."/>
280
        </xsl:attribute>
281
    </xsl:template>
282

    
283
    <xsl:template match="*">
284
        <xsl:element name="oaf:{./local-name()}" namespace="http://namespace.openaire.eu/oaf">
285
            <xsl:apply-templates select="attribute::*"/>
286
            <xsl:apply-templates/>
287
        </xsl:element>
288
    </xsl:template>
289

    
290

    
291
    <xsl:template match="oaf:datasource | oaf:person"/>
292
    
293
    <xsl:template match="@*">
294
        <xsl:copy-of select="."/>
295
    </xsl:template>
296

    
297

    
298
</xsl:stylesheet>
    (1-1/1)