Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
3
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
4
xmlns:oaf="http://namespace.openaire.eu/oaf"
5
xmlns:dc="http://purl.org/dc/elements/1.1/">
6
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
7

    
8
<xsl:template match = "/">
9

    
10
<result type ="result">
11
	<xsl:apply-templates select="//header"/>
12
    <xsl:apply-templates select="//children/result"/>
13
	<xsl:apply-templates select="//oaf:result"/>
14
	<xsl:apply-templates select="//rel"/>
15
	<xsl:apply-templates select="//children"/>
16
    <xsl:apply-templates select="//extraInfo"/>
17
</result>
18
</xsl:template>
19

    
20
<!-- HEADER
21
fields in header:
22
1. dri:objIdentifier 		[objIdentifier]
23
2. dri:repositoryId			X
24
3. dri:dateOfCollection		X
25
-->
26
<xsl:template match = "header">
27
	<field name="resultId" multiplicity="false" indexId="objIdentifier" label="Object id">
28
		<xsl:attribute name="value">
29
			<xsl:value-of select='./dri:objIdentifier'/>
30
		</xsl:attribute>
31
	</field>
32
	<!--<field name="repositoryId" multiplicity="false" indexId="???" label="???">
33
		<xsl:attribute name="value">
34
			<xsl:value-of select='./dri:repositoryId'/>
35
		</xsl:attribute>
36
	</field>-->
37
	<!--<field name="dateOfCollection" multiplicity="false" indexId="???" label="???">
38
		<xsl:attribute name="value">
39
			<xsl:value-of select='./dri:dateOfCollection'/>
40
		</xsl:attribute>
41
	</field>-->
42
</xsl:template>
43

    
44

    
45
<xsl:template match = "oaf:result">
46

    
47
	<xsl:for-each select = "./title">
48
		<field name="title" indexId = "resulttitle" multiplicity="true" label="Title">
49
			<xsl:attribute name="value">
50
				<xsl:value-of select='.'/>
51
			</xsl:attribute>
52
		</field>
53
	</xsl:for-each>
54

    
55
	<xsl:for-each select = "./dateofacceptance">
56
		<field name="dateofacceptance" indexId = "resultdateofacceptance" multiplicity="true" label="Date of acceptance">
57
			<xsl:attribute name="value">
58
				<xsl:value-of select='.'/>
59
			</xsl:attribute>
60
		</field>
61
	</xsl:for-each>
62

    
63
	<xsl:for-each select = "./storagedate">
64
		<field name="storagedate" indexId = "resultstoragedate" multiplicity="true" label="Date of storage">
65
			<xsl:attribute name="value">
66
				<xsl:value-of select='.'/>
67
			</xsl:attribute>
68
		</field>
69
	</xsl:for-each>
70

    
71
	<xsl:for-each select = "./description">
72
		<field name="description" indexId = "resultdescription" multiplicity="true" label="Description">
73
			<xsl:attribute name="value">
74
				<xsl:value-of select='.'/>
75
			</xsl:attribute>
76
		</field>
77
	</xsl:for-each>
78

    
79
	<xsl:for-each select = "./publisher">
80
		<field name="publisher" indexId = "resultpublisher" multiplicity="true" label="Publisher(s)">
81
			<xsl:attribute name="value">
82
				<xsl:value-of select='.'/>
83
			</xsl:attribute>
84
		</field>
85
	</xsl:for-each>
86

    
87
	<xsl:for-each select = "./language">
88
		<field name="languageid" indexId = "resultlanguageid" multiplicity="true" label="Language(s)">
89
			<xsl:attribute name="value">
90
				<xsl:value-of select='./@classid'/>
91
			</xsl:attribute>
92
		</field>
93
		<field name="languagename" indexId = "resultlanguagename" multiplicity="true" label="Language(s)">
94
			<xsl:attribute name="value">
95
				<xsl:value-of select='./@classname'/>
96
			</xsl:attribute>
97
		</field>
98
		<field name="language" indexId = "" multiplicity="true" label="Language(s)">
99
			<xsl:attribute name="value">
100
				<xsl:value-of select='./@classname'/>
101
			</xsl:attribute>
102
			<xsl:attribute name="value_original">
103
				<xsl:value-of select='./@classid'/>
104
			</xsl:attribute>
105
		</field>
106
	</xsl:for-each>
107

    
108
	<xsl:for-each select = "./resulttype">
109
		<field name="resulttypeid" indexId = "resulttypeid" multiplicity="true" label="Type">
110
			<xsl:attribute name="value">
111
				<xsl:value-of select='./@classid'/>
112
			</xsl:attribute>
113
		</field>
114
		<field name="resulttypename" indexId = "resulttypename" multiplicity="true" label="Type">
115
			<xsl:attribute name="value">
116
				<xsl:value-of select='./@classname'/>
117
			</xsl:attribute>
118
		</field>
119
	</xsl:for-each>
120

    
121
	<xsl:for-each select = "./resourcetype">
122
		<field name="resourcetypeid" indexId = "" multiplicity="true" label="Resource Type">
123
			<xsl:attribute name="value">
124
				<xsl:value-of select='./@classid'/>
125
			</xsl:attribute>
126
		</field>
127
		<field name="resourcetypename" indexId = "" multiplicity="true" label="Resource Type">
128
			<xsl:attribute name="value">
129
				<xsl:value-of select='./@classname'/>
130
			</xsl:attribute>
131
		</field>
132
	</xsl:for-each>
133

    
134
	<xsl:for-each select = "./subject">
135
		<field name="subject" indexId = "resultsubject" multiplicity="true" label="Subject">
136
			<xsl:attribute name="value">
137
				<xsl:value-of select='.'/>
138
			</xsl:attribute>
139
 			<field name = "inferred" indexId="" multiplicity = "false" label="inferred">
140
				<xsl:attribute name="value">
141
					<xsl:choose>
142
						<xsl:when test="@inferred !=''">
143
							<xsl:value-of select="@inferred"/>
144
						</xsl:when>
145
						<xsl:otherwise>
146
							<xsl:text>false</xsl:text>
147
						</xsl:otherwise>
148
					</xsl:choose>
149
				</xsl:attribute>
150
			</field>
151
			<field name = "trust" indexId="" multiplicity = "false" label="trust level">
152
				<xsl:attribute name="value">
153
					<xsl:choose>
154
						<xsl:when test="@trust !=''">
155
							<xsl:value-of select="@trust"/>
156
						</xsl:when>
157
						<xsl:otherwise>
158
							<xsl:text>NEUTRAL</xsl:text>
159
						</xsl:otherwise>
160
					</xsl:choose>
161
				</xsl:attribute>
162
			</field>
163
            <field name = "provenance" indexId="" multiplicity = "false" label="provenance">
164
				<xsl:attribute name="value">
165
				<xsl:choose>
166
						<xsl:when test="@provenanceaction !=''">
167
							<xsl:value-of select="@provenanceaction"/>
168
						</xsl:when>
169
						<xsl:otherwise>
170
							<xsl:text></xsl:text>
171
						</xsl:otherwise>
172
					</xsl:choose>
173
				</xsl:attribute>
174
			</field>
175
			<field name="taxonomy" indexId="" multiplicity="false">
176
				<xsl:attribute name="value">
177
					<xsl:choose>
178
						<xsl:when test="@classname !=''">
179
							<xsl:value-of select="@classname"/>
180
						</xsl:when>
181
						<xsl:otherwise>
182
							<xsl:text></xsl:text>
183
						</xsl:otherwise>
184
					</xsl:choose>
185
				</xsl:attribute>
186
			</field>
187
		</field>
188
	</xsl:for-each>
189

    
190
	<xsl:for-each select = "./relevantdate">
191
		<field name="relevantyear" indexId = "" multiplicity="true" label="Relevant year">
192
			<xsl:attribute name="value">
193
				<xsl:value-of select='substring-before(.,"-")'/>
194
			</xsl:attribute>
195
		</field>
196
		<field name="relevantdate" indexId = "resultdate" multiplicity="true" label="Relevant date">
197
			<xsl:attribute name="value">
198
				<xsl:value-of select='.'/>
199
			</xsl:attribute>
200
		</field>
201
	</xsl:for-each>
202

    
203
	<xsl:for-each select = "./pid">
204
		<field name="pid" multiplicity="true" label="Pid">
205
			<field name="value" indexId = "pid" multiplicity="false" label="Pid">
206
				<xsl:attribute name="value">
207
					<xsl:value-of select='.'/>
208
				</xsl:attribute>
209
			</field>
210
			<field name="classid" indexId = "pidclassid" multiplicity="false" label="Pid class id">
211
				<xsl:attribute name="value">
212
					<xsl:value-of select='./@classid'/>
213
				</xsl:attribute>
214
			</field>
215
			<field name="classname" indexId = "pidclassname" multiplicity="false" label="Pid class name">
216
				<xsl:attribute name="value">
217
					<xsl:value-of select='./@classname'/>
218
				</xsl:attribute>
219
			</field>
220
		</field>
221
	</xsl:for-each>
222

    
223
    <xsl:for-each select="./bestlicense">
224
        <field name="bestlicense" indexId="resultbestlicense" multiplicity="false" label="Best License">
225
            <xsl:attribute name="value">
226
                <xsl:value-of select="@classid" />
227
            </xsl:attribute>
228
        </field>
229
    </xsl:for-each>
230

    
231
	<xsl:for-each select = "./embargoenddate">
232
		<field name="embargoendyear" indexId = "" multiplicity="true" label="Embargo end year">
233
			<xsl:attribute name="value">
234
				<xsl:value-of select='substring-before(.,"-")'/>
235
			</xsl:attribute>
236
		</field>
237
		<field name="embargoenddate" indexId = "resultembargoenddate" multiplicity="true" label="Embargo end date">
238
			<xsl:attribute name="value">
239
				<xsl:value-of select='.'/>
240
			</xsl:attribute>
241
		</field>
242
	</xsl:for-each>
243

    
244
	<xsl:for-each select = "./journal">
245
		<field name="journal" indexId = "" multiplicity="true" label="Journal">
246
			<xsl:attribute name="value">
247
				<xsl:value-of select='.'/>
248
			</xsl:attribute>
249
		</field>
250
	</xsl:for-each>
251

    
252
	<xsl:for-each select = "./collectedfrom">
253
		<field name="collectedfrom" indexId = "resultcollectedfromdatasourceid" multiplicity="true" label="Collected from">
254
                <xsl:attribute name="value">
255
                        <xsl:value-of select='./@id'/>
256
                </xsl:attribute>
257
        </field>
258
        <!--field name="collectedfromname" indexId = "" multiplicity="true" label="Collected from">
259
                <xsl:attribute name="value">
260
                        <xsl:value-of select='./@name'/>
261
                </xsl:attribute>
262
        </field-->
263
	</xsl:for-each>
264

    
265
	<xsl:for-each select = "./device">
266
		<field name="device" indexId = "" multiplicity="true" label="Device">
267
			<xsl:attribute name="value">
268
				<xsl:value-of select='.'/>
269
			</xsl:attribute>
270
		</field>
271
	</xsl:for-each>
272

    
273
	<xsl:for-each select = "./size">
274
		<field name="size" indexId = "" multiplicity="true" label="Size">
275
			<xsl:attribute name="value">
276
				<xsl:value-of select='.'/>
277
			</xsl:attribute>
278
		</field>
279
	</xsl:for-each>
280

    
281
	<xsl:for-each select = "./format">
282
		<field name="format" indexId = "" multiplicity="true" label="Format">
283
			<xsl:attribute name="value">
284
				<xsl:value-of select='.'/>
285
			</xsl:attribute>
286
		</field>
287
	</xsl:for-each>
288

    
289
	<xsl:for-each select = "./version">
290
		<field name="version" indexId = "" multiplicity="true" label="Version">
291
			<xsl:attribute name="value">
292
				<xsl:value-of select='.'/>
293
			</xsl:attribute>
294
		</field>
295
	</xsl:for-each>
296

    
297
	<xsl:for-each select = "./lastmetadataupdate">
298
		<field name="lastmetadataupdate" indexId = "" multiplicity="true" label="Last metadata update">
299
			<xsl:attribute name="value">
300
				<xsl:value-of select='.'/>
301
			</xsl:attribute>
302
		</field>
303
	</xsl:for-each>
304

    
305
	<xsl:for-each select = "./metadataversionnumber">
306
		<field name="metadataversionnumber" indexId = "" multiplicity="true" label="Metadata version number">
307
			<xsl:attribute name="value">
308
				<xsl:value-of select='.'/>
309
			</xsl:attribute>
310
		</field>
311
	</xsl:for-each>
312

    
313
	<xsl:for-each select = "./source">
314
		<field name="source" indexId = "" multiplicity="true" label="source">
315
			<xsl:attribute name="value">
316
				<xsl:value-of select='.'/>
317
			</xsl:attribute>
318
		</field>
319
	</xsl:for-each>
320

    
321
	<xsl:for-each select = "./context">
322
		<field indexId="context" multiplicity="true" name="context" >
323

    
324
			<xsl:attribute name="value">
325
				<xsl:value-of select='./@value'/>
326
			</xsl:attribute>
327
			<xsl:attribute name="value_original">
328
				<xsl:value-of select='./@id'/>
329
			</xsl:attribute>
330

    
331
			<field name="contexttype" indexId="contexttype" multiplicity="false" label="Context Type">
332
				<xsl:attribute name="value">
333
					<xsl:value-of select="@type"></xsl:value-of>
334
				</xsl:attribute>
335
			</field>
336

    
337
			<xsl:for-each select = "./category">
338
				<field name="category" indexId="category" multiplicity="true" label="Category" >
339
					<xsl:attribute name="value">
340
						<xsl:value-of select='./@label' />
341
					</xsl:attribute>
342
					<xsl:attribute name="value_original">
343
						<xsl:value-of select='./@id'/>
344
					</xsl:attribute>
345

    
346
					<xsl:for-each select = ".//concept">
347
						<field name="concept" indexId="concept" multiplicity="true" label="Concept" >
348
							<xsl:attribute name="value">
349
								<xsl:value-of select='./@label'/>
350
							</xsl:attribute>
351
							<xsl:attribute name="value_original">
352
								<xsl:value-of select='./@id'/>
353
							</xsl:attribute>
354
						</field>
355
					</xsl:for-each>
356
				</field>
357
			</xsl:for-each>
358
		</field>
359
	</xsl:for-each>
360
</xsl:template>
361

    
362

    
363
<xsl:template match="extraInfo">
364
    <xsl:for-each select="./citations/citation">
365
        <field name="citation" multiplicity="true" indexId="" label="Citation">
366
            <field name="rawText" multiplicity="false" indexId="" label="Citation Text">
367
                <xsl:attribute name="value">
368
                    <xsl:value-of select="rawText"/>
369
                </xsl:attribute>
370
            </field>
371
            <xsl:for-each select="id">
372
            <field name="citationId" indexId="" multiplicity="true" label="Citation id details">
373
                <field name="id" multiplicity="false" indexId="" label="Citation id">
374
                    <xsl:attribute name="value">
375
                        <xsl:value-of select="@value"/>
376
                    </xsl:attribute>
377
                </field>
378
                <field name="type" multiplicity="false" indexId="" label="Citation id type">
379
                    <xsl:attribute name="value">
380
                        <xsl:value-of select="@type"/>
381
                    </xsl:attribute>
382
                </field>
383
                <field name="confidenceLevel" multiplicity="false" indexId="" label="Citation id confidence">
384
                    <xsl:attribute name="value">
385
                        <xsl:value-of select="@confidenceLevel"/>
386
                    </xsl:attribute>
387
                </field>
388
            </field>
389
            </xsl:for-each>
390
        </field>
391
    </xsl:for-each>
392
</xsl:template>
393

    
394
<xsl:template match="rel">
395
<!--PERSON-->
396
	<xsl:if test="./to/@type='person'">
397
		<field indexId = "objIdentifier"  multiplicity="true">
398
			<xsl:attribute name="name"><xsl:value-of select='./to/@class'/></xsl:attribute>
399
			<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
400
			<field name = "inferred" indexId="" multiplicity = "false" label="inferred">		
401
				<xsl:attribute name="value">
402
					<xsl:choose>
403
						<xsl:when test="@inferred !=''">
404
							<xsl:value-of select="@inferred"/>
405
						</xsl:when>
406
						<xsl:otherwise>
407
							<xsl:text>false</xsl:text>
408
						</xsl:otherwise>
409
					</xsl:choose>
410
				</xsl:attribute>
411
			</field>
412
			<field name = "trust" indexId="" multiplicity = "false" label="trust level">
413
				<xsl:attribute name="value">
414
					<xsl:choose>
415
						<xsl:when test="@trust !=''">
416
							<xsl:value-of select="@trust"/>
417
						</xsl:when>
418
						<xsl:otherwise>
419
							<xsl:text>NEUTRAL</xsl:text>
420
						</xsl:otherwise>
421
					</xsl:choose>
422
				</xsl:attribute>
423
			</field>
424
			<field name = "provenance" indexId="" multiplicity = "false" label="provenance">
425
				<xsl:attribute name="value">
426
				<xsl:choose>
427
						<xsl:when test="@provenanceaction !=''">
428
							<xsl:value-of select="@provenanceaction"/>
429
						</xsl:when>
430
						<xsl:otherwise>
431
							<xsl:text></xsl:text>
432
						</xsl:otherwise>
433
					</xsl:choose>
434
				</xsl:attribute>
435
			</field>
436
			<field name = "personId" indexId ="objIdentifier" multiplicity="false" label="Person id">		
437
				<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
438
			</field>
439
			<field name = "role" indexId ="" multiplicity="false" label="role">		
440
				<xsl:attribute name="value"><xsl:value-of select='./to/@class'/> </xsl:attribute>
441
			</field>
442
			<field name = "fullname" indexId ="personfullname" multiplicity="false" label="Person fullname">		
443
				<xsl:attribute name="value"><xsl:value-of select='./fullname'/> </xsl:attribute>
444
			</field>
445
			<field name = "ranking" indexId ="" multiplicity="false" label="ranking">		
446
				<xsl:attribute name="value"><xsl:value-of select='./ranking'/> </xsl:attribute>
447
			</field>
448
		</field>
449
	</xsl:if>	
450
<!--PROJECT-->
451
	<xsl:if test="./to/@type='project'">
452
		<field name="project" indexId = "objIdentifier" multiplicity="true">
453
			<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
454
			<field name = "inferred" indexId="" multiplicity = "false" label="inferred">		
455
				<xsl:attribute name="value">
456
					<xsl:choose>
457
						<xsl:when test="@inferred !=''">
458
							<xsl:value-of select="@inferred"/>
459
						</xsl:when>
460
						<xsl:otherwise>
461
							<xsl:text>false</xsl:text>
462
						</xsl:otherwise>
463
					</xsl:choose>
464
				</xsl:attribute>
465
			</field>
466
			<field name = "trust" indexId="" multiplicity = "false" label="trust level">
467
				<xsl:attribute name="value">
468
					<xsl:choose>
469
						<xsl:when test="@trust !=''">
470
							<xsl:value-of select="@trust"/>
471
						</xsl:when>
472
						<xsl:otherwise>
473
							<xsl:text>NEUTRAL</xsl:text>
474
						</xsl:otherwise>
475
					</xsl:choose>
476
				</xsl:attribute>
477
			</field>
478
			<field name = "provenance" indexId="" multiplicity = "false" label="provenance">
479
				<xsl:attribute name="value">
480
				<xsl:choose>
481
						<xsl:when test="@provenanceaction !=''">
482
							<xsl:value-of select="@provenanceaction"/>
483
						</xsl:when>
484
						<xsl:otherwise>
485
							<xsl:text></xsl:text>
486
						</xsl:otherwise>
487
					</xsl:choose>
488
				</xsl:attribute>
489
			</field>
490
			<field name = "projectId" indexId ="objIdentifier" multiplicity="false" label="Project id">		
491
				<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
492
			</field>
493
			<field name = "role" indexId ="" multiplicity="false" label="role">		
494
				<xsl:attribute name="value"><xsl:value-of select='./to/@class'/> </xsl:attribute>
495
			</field>
496
			<field name = "projectcode" indexId ="projectcode" multiplicity="false" label="Project(s)">		
497
				<xsl:attribute name="value"><xsl:value-of select='./code'/> </xsl:attribute>
498
			</field>	
499
			<field name = "projectacronym" indexId ="projectacronym" multiplicity="false" label="Project(s)">		
500
				<xsl:attribute name="value"><xsl:value-of select='./acronym'/> </xsl:attribute>
501
			</field>
502
			<field name = "projecttitle" indexId ="projecttitle" multiplicity="false" label="Project title">		
503
				<xsl:attribute name="value"><xsl:value-of select='./title'/> </xsl:attribute>
504
			</field>
505
			<field name = "projectcontracttypeid" indexId ="projectcontracttypeid" multiplicity="false" label="Project contract type id">		
506
				<xsl:attribute name="value"><xsl:value-of select='./contracttype/@classid'/> </xsl:attribute>
507
			</field>
508
			<field name = "projectcontracttypename" indexId ="projectcontracttypename" multiplicity="false" label="Project contract type name">		
509
				<xsl:attribute name="value"><xsl:value-of select='./contracttype/@classname'/> </xsl:attribute>
510
			</field>
511
			<field name = "funding" indexId = "" multiplicity = "false">
512
                <field name = "funder" indexId = "relfunder" multiplicity = "true">
513
                    <xsl:attribute name="value_original">
514
                        <xsl:value-of select="./funding/funder/@id"/>
515
                    </xsl:attribute>
516
                    <xsl:attribute name = "value">
517
                        <xsl:call-template name="getExtension">
518
                            <xsl:with-param name="filename" select="./funding/funder/@id"/>
519
                        </xsl:call-template>
520
                        <!--xsl:value-of select='./funding/funding_level_0'/-->
521
                    </xsl:attribute>
522
                </field>
523
                <field name = "fundershortname" indexId = "relfundershortname" multiplicity = "true">
524
                    <xsl:attribute name = "value">
525
                        <xsl:call-template name="getExtension">
526
                            <xsl:with-param name="filename" select="./funding/funder/@shortname"/>
527
                        </xsl:call-template>
528
                    </xsl:attribute>
529
                </field>
530
                <field name = "funding_level_0" indexId = "fundinglevel0_id" multiplicity = "false">
531
					<xsl:attribute name="value_original">
532
						<xsl:value-of select="./funding/funding_level_0"/>
533
					</xsl:attribute>					
534
					<xsl:attribute name = "value">
535
						<xsl:call-template name="getExtension">
536
							<xsl:with-param name="filename" select="./funding/funding_level_0"/>
537
						</xsl:call-template>			
538
						<!--xsl:value-of select='./funding/funding_level_0'/-->
539
					</xsl:attribute>
540
				</field>
541
				<field name = "funding_level_1" indexId = "fundinglevel1_id" multiplicity = "false">
542
                    <xsl:if test="not(starts-with(./funding/funding_level_1, 'ec__________::EC::FP7::'))">
543
                        <xsl:attribute name="value_original">
544
                            <xsl:value-of select="./funding/funding_level_1"/>
545
                        </xsl:attribute>
546
                        <xsl:attribute name = "value">
547
                            <xsl:call-template name="getExtension">
548
                                <xsl:with-param name="filename" select="./funding/funding_level_1"/>
549
                            </xsl:call-template>
550
                        </xsl:attribute>
551
                    </xsl:if>
552
                    <xsl:if test="starts-with(./funding/funding_level_1, 'ec__________::EC::FP7::')">
553
                        <xsl:attribute name="value">
554
                            <xsl:value-of select="./funding/funding_level_1"/>
555
                        </xsl:attribute>
556
                    </xsl:if>
557
					<!--<xsl:attribute name = "value">
558
						<xsl:call-template name="getExtension">
559
							<xsl:with-param name="filename" select="./funding/funding_level_1"/>
560
						</xsl:call-template>	
561
						&lt;!&ndash;xsl:value-of select='./funding/funding_level_1'/&ndash;&gt;
562
					</xsl:attribute>-->
563
				</field>
564
				<field name = "funding_level_2" indexId = "fundinglevel2_id" multiplicity = "false">
565
                    <xsl:if test="not(starts-with(./funding/funding_level_2, 'ec__________::EC::FP7::'))">
566
                        <xsl:attribute name="value_original">
567
                            <xsl:value-of select="./funding/funding_level_2"/>
568
                        </xsl:attribute>
569
                        <xsl:attribute name = "value">
570
                            <xsl:call-template name="getExtension">
571
                                <xsl:with-param name="filename" select="./funding/funding_level_2"/>
572
                            </xsl:call-template>
573
                        </xsl:attribute>
574
                    </xsl:if>
575
                    <xsl:if test="starts-with(./funding/funding_level_2, 'ec__________::EC::FP7::')">
576
                        <xsl:attribute name="value">
577
                            <xsl:value-of select="./funding/funding_level_2"/>
578
                        </xsl:attribute>
579
                    </xsl:if>
580
				<!-- <xsl:attribute name = "value">
581
						<xsl:call-template name="getExtension">
582
							<xsl:with-param name="filename" select="./funding/funding_level_2"/>
583
						</xsl:call-template>
584
					</xsl:attribute>
585
				-->
586
				</field>
587
			</field>
588
		</field>
589
	</xsl:if>
590
<!--RESULT-->
591
	<xsl:if test="./to/@type='result'">
592
		<field indexId = "objIdentifier"  multiplicity="true">
593
			<xsl:attribute name="name"><xsl:value-of select='./to/@class'/></xsl:attribute>
594
			<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
595
			<field name = "resultid" indexId ="objIdentifier" multiplicity="false" label="Result id">		
596
				<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
597
			</field>
598
			<field name = "title" indexId = "resulttitle" multiplicity = "false" label = "Title">
599
				<xsl:attribute name="value">
600
					<xsl:value-of select="./title"/>
601
				</xsl:attribute>
602
			</field>
603
			<field name = "dateofacceptance" indexId = "resultdateofacceptance" multiplicity = "false" label = "Date of acceptance">
604
				<xsl:attribute name="value">
605
					<xsl:value-of select="./dateofacceptance"/>
606
				</xsl:attribute>
607
			</field>
608
			<field name = "resulttypeid" indexId = "resulttypeid" multiplicity = "false" label = "type id">
609
				<xsl:attribute name="value">
610
					<xsl:value-of select="./resulttype/@classid"/>
611
				</xsl:attribute>
612
			</field>
613
			<field name = "resulttypename" indexId = "resulttypename" multiplicity = "false" label = "type name">
614
				<xsl:attribute name="value">
615
					<xsl:value-of select="./resulttype/@classname"/>
616
				</xsl:attribute>
617
			</field>
618
			<field name = "inferred" indexId="" multiplicity = "false" label="inferred">		
619
				<xsl:attribute name="value">
620
					<xsl:choose>
621
						<xsl:when test="@inferred !=''">
622
							<xsl:value-of select="@inferred"/>
623
						</xsl:when>
624
						<xsl:otherwise>
625
							<xsl:text>false</xsl:text>
626
						</xsl:otherwise>
627
					</xsl:choose>
628
				</xsl:attribute>
629
			</field>
630
			<field name = "trust" indexId="" multiplicity = "false" label="trust level">
631
				<xsl:attribute name="value">
632
					<xsl:choose>
633
						<xsl:when test="@trust !=''">
634
							<xsl:value-of select="@trust"/>
635
						</xsl:when>
636
						<xsl:otherwise>
637
							<xsl:text>NEUTRAL</xsl:text>
638
						</xsl:otherwise>
639
					</xsl:choose>
640
				</xsl:attribute>
641
			</field>
642
			<field name = "provenance" indexId="" multiplicity = "false" label="provenance">
643
				<xsl:attribute name="value">
644
				<xsl:choose>
645
						<xsl:when test="@provenanceaction !=''">
646
							<xsl:value-of select="@provenanceaction"/>
647
						</xsl:when>
648
						<xsl:otherwise>
649
							<xsl:text></xsl:text>
650
						</xsl:otherwise>
651
					</xsl:choose>
652
				</xsl:attribute>
653
			</field>
654
            <xsl:if test="./to/@class = 'hasAmongTopNSimilarDocuments'">
655
                <field name="similarity" label="similarity" multiplicity="false" indexId="">
656
                    <xsl:attribute name="value">
657
                        <xsl:value-of select="similarity"/>
658
                    </xsl:attribute>
659
                </field>
660
            </xsl:if>
661
		</field>
662
	</xsl:if>	
663
<!--ORGANIZATION-->
664
	<xsl:if test="./to/@type='organization'">
665
		<field name="organization" indexId = "objIdentifier"  multiplicity="true">
666
			<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
667
			<field name = "organizationid" indexId ="objIdentifier" multiplicity="false" label="Organization id">		
668
				<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
669
			</field>
670
			<field name = "role" indexId ="" multiplicity="false" label="role">		
671
				<xsl:attribute name="value"><xsl:value-of select='./to/@class'/> </xsl:attribute>
672
			</field>
673
			<field name = "legalshortname" indexId ="organizationlegalshortname" multiplicity="false" label="Organization short name">		
674
				<xsl:attribute name="value"><xsl:value-of select='./legalshortname'/> </xsl:attribute>
675
			</field>
676
			<field name = "websiteurl" indexId ="organizationwebsiteurl" multiplicity="false" label="Website">		
677
				<xsl:attribute name="value"><xsl:value-of select='./websiteurl'/> </xsl:attribute>
678
			</field>
679
			<field name = "countryid" indexId ="organizationcountryid" multiplicity="false" label="Country code">		
680
				<xsl:attribute name="value"><xsl:value-of select='./country/@classid'/> </xsl:attribute>
681
			</field>
682
			<field name = "countryname" indexId ="organizationcountryname" multiplicity="false" label="Country">		
683
				<xsl:attribute name="value"><xsl:value-of select='./country/@classname'/> </xsl:attribute>
684
			</field>
685
			<field name = "participantnumber" indexId ="" multiplicity="false" label="Participant Number">		
686
				<xsl:attribute name="value"><xsl:value-of select='./participantnumber'/> </xsl:attribute>
687
			</field>
688
			<field name = "contactperson" indexId ="" multiplicity="false" label="Contact Person">		
689
				<xsl:attribute name="value"><xsl:value-of select='./contactperson'/> </xsl:attribute>
690
			</field>
691
		</field>
692
	</xsl:if>
693

    
694
</xsl:template>
695
<!-- CHILDREN -->
696

    
697
    <xsl:template match="children/result">
698
        <field name="resultId" multiplicity="true" indexId="resultid" label="Result id">
699
            <xsl:attribute name="value">
700
                <xsl:value-of select='./@objidentifier'/>
701
            </xsl:attribute>
702
        </field>
703
    </xsl:template>
704

    
705
    <xsl:template match="children">
706

    
707
	<xsl:for-each select = "./instance">
708
		<field name = "datasource"  indexId = "resultcollectedfromdatasourceid" multiplicity="true">
709
			<xsl:attribute name = "value"> <xsl:value-of select="./@id"/> </xsl:attribute><!--??-->
710
			<field name = "instanceId" indexId = "objIdentifier" multiplicity = "false">
711
				<xsl:attribute name="value"><xsl:value-of select="./@id"/></xsl:attribute>
712
			</field>
713
			<field name = "hostedby" indexId = "resulthostingdatasourceid" multiplicity="false">
714
				<xsl:attribute name = "value"> <xsl:value-of select="./hostedby/@id"/> </xsl:attribute>
715
			</field> 
716
			<field name = "hostedbyname" indexId = "resulthostingdatasourcename" multiplicity="false">
717
				<xsl:attribute name = "value"> <xsl:value-of select="./hostedby/@name"/> </xsl:attribute>
718
			</field>
719
			<xsl:for-each select="./licence">
720
				<field name = "licenceid" indexId = "" multiplicity = "true">
721
					<xsl:attribute name = "value"> <xsl:value-of select="./@classid"/> </xsl:attribute>
722
				</field>
723
				<field name = "licencename" indexId = "resultrights" multiplicity = "true">
724
					<xsl:attribute name = "value"> <xsl:value-of select="./@classname"/> </xsl:attribute>
725
				</field>
726
			</xsl:for-each>
727
			<xsl:for-each select="./instancetype">			
728
				<field name = "typeid" indexId = "instancetypeid" multiplicity = "true">
729
					<xsl:attribute name = "value"> <xsl:value-of select="./@classid"/> </xsl:attribute>
730
				</field>
731
				<field name = "typename" indexId = "instancetypename" multiplicity = "true">
732
					<xsl:attribute name = "value"> <xsl:value-of select="./@classname"/> </xsl:attribute>
733
				</field>
734
			</xsl:for-each>
735

    
736
			<xsl:for-each select="./webresource">	
737
				<field name = "webresource" indexId = "" multiplicity="true">
738
					<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
739
				</field>
740
				<xsl:for-each select="./url">	
741
					<field name = "url" indexId = "" multiplicity="true">
742
						<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
743
					</field>
744
				</xsl:for-each>
745
			</xsl:for-each>
746
			<!--field name = "officialname" indexId = "" multiplicity="false">
747
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/officialname"/> </xsl:attribute>
748
			</field>
749
			<field name = "datasourcetypeid" indexId = "" multiplicity = "true">
750
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classid"/> </xsl:attribute>
751
			</field>
752
			<field name = "datasourcetypename" indexId = "" multiplicity = "true">
753
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classname"/> </xsl:attribute>
754
			</field-->
755
			
756
		</field>
757
	</xsl:for-each>
758

    
759
	<xsl:for-each select = "./externalreference">
760
		<field name="externalreference" multiplicity="true" indexId="">
761
			<field name="sitename" multiplicity="false" indexId="">
762
				<xsl:attribute name="value">
763
					<xsl:value-of select="./sitename"/>
764
				</xsl:attribute>
765
			</field>
766
			<field name="label" multiplicity="false" indexId="">
767
				<xsl:attribute name="value">
768
					<xsl:value-of select="./label"/>
769
				</xsl:attribute>
770
			</field>
771
			
772
			<field name="url" multiplicity="false" indexId="">
773
				<xsl:attribute name="value">
774
					<xsl:value-of select="./url"/>
775
				</xsl:attribute>
776
			</field>
777

    
778
			<field name="typeid" multiplicity="false" indexId="">
779
				<xsl:attribute name="value">
780
					<xsl:value-of select="./qualifier/@classid"/>
781
				</xsl:attribute>
782
			</field>
783
			<field name="refidentifier" multiplicity="false" indexId="">
784
				<xsl:attribute name="value">
785
					<xsl:value-of select="./refidentifier"/>
786
				</xsl:attribute>
787
			</field>
788
		</field>
789
	</xsl:for-each>
790
</xsl:template>
791

    
792
<xsl:template name="getExtension">
793
	<xsl:param name="filename"/>
794
	<xsl:choose>
795
		<xsl:when test="contains($filename, '::')">
796
			<xsl:call-template name="getExtension">
797
				<xsl:with-param name="filename" select="substring-after($filename, '::')"/>
798
			</xsl:call-template>
799
		</xsl:when>
800
		<xsl:otherwise>
801
			<xsl:value-of select="$filename"/>
802
		</xsl:otherwise>
803
	</xsl:choose>
804
</xsl:template>
805

    
806

    
807
</xsl:stylesheet>
808

    
809

    
(31-31/40)