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
	<test_the></test_the>
12
	<xsl:apply-templates select="//header"/>
13
    <xsl:apply-templates select="//children/result"/>
14
	<xsl:apply-templates select="//oaf:result"/>
15
	<xsl:apply-templates select="//rel"/>
16
	<xsl:apply-templates select="//children"/>
17
    <xsl:apply-templates select="//extraInfo"/>
18
</result>
19
</xsl:template>
20

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

    
34
	<field name="underCuration" multiplicity="false" indexId="" label="Under Curation">
35
		<xsl:attribute name="value">
36
			<xsl:value-of select='./dri:status'/>
37
		</xsl:attribute>
38
	</field>
39

    
40
	<!--<field name="repositoryId" multiplicity="false" indexId="???" label="???">
41
		<xsl:attribute name="value">
42
			<xsl:value-of select='./dri:repositoryId'/>
43
		</xsl:attribute>
44
	</field>-->
45
	<!--<field name="dateOfCollection" multiplicity="false" indexId="???" label="???">
46
		<xsl:attribute name="value">
47
			<xsl:value-of select='./dri:dateOfCollection'/>
48
		</xsl:attribute>
49
	</field>-->
50
</xsl:template>
51

    
52

    
53
<xsl:template match = "oaf:result">
54

    
55
	<xsl:for-each select = "./title">
56
		<field name="title" indexId = "resulttitle" multiplicity="true" label="Title">
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 = "./dateofacceptance">
64
		<field name="dateofacceptance" indexId = "resultdateofacceptance" multiplicity="true" label="Date of acceptance">
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 = "./storagedate">
72
		<field name="storagedate" indexId = "resultstoragedate" multiplicity="true" label="Date of storage">
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 = "./description">
80
		<field name="description" indexId = "resultdescription" multiplicity="true" label="Description">
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 = "./publisher">
88
		<field name="publisher" indexId = "resultpublisher" multiplicity="true" label="Publisher(s)">
89
			<xsl:attribute name="value">
90
				<xsl:value-of select='.'/>
91
			</xsl:attribute>
92
		</field>
93
	</xsl:for-each>
94

    
95
	<xsl:for-each select = "./language">
96
		<field name="languageid" indexId = "resultlanguageid" multiplicity="true" label="Language(s)">
97
			<xsl:attribute name="value">
98
				<xsl:value-of select='./@classid'/>
99
			</xsl:attribute>
100
		</field>
101
		<field name="languagename" indexId = "resultlanguagename" multiplicity="true" label="Language(s)">
102
			<xsl:attribute name="value">
103
				<xsl:value-of select='./@classname'/>
104
			</xsl:attribute>
105
		</field>
106
		<field name="language" indexId = "" multiplicity="true" label="Language(s)">
107
			<xsl:attribute name="value">
108
				<xsl:value-of select='./@classname'/>
109
			</xsl:attribute>
110
			<xsl:attribute name="value_original">
111
				<xsl:value-of select='./@classid'/>
112
			</xsl:attribute>
113
		</field>
114
	</xsl:for-each>
115

    
116
	<xsl:for-each select = "./resulttype">
117
		<field name="resulttypeid" indexId = "resulttypeid" multiplicity="true" label="Type">
118
			<xsl:attribute name="value">
119
				<xsl:value-of select='./@classid'/>
120
			</xsl:attribute>
121
		</field>
122
		<field name="resulttypename" indexId = "resulttypename" multiplicity="true" label="Type">
123
			<xsl:attribute name="value">
124
				<xsl:value-of select='./@classname'/>
125
			</xsl:attribute>
126
		</field>
127
	</xsl:for-each>
128

    
129
	<xsl:for-each select = "./resourcetype">
130
		<field name="resourcetypeid" indexId = "" multiplicity="true" label="Resource Type">
131
			<xsl:attribute name="value">
132
				<xsl:value-of select='./@classid'/>
133
			</xsl:attribute>
134
		</field>
135
		<field name="resourcetypename" indexId = "" multiplicity="true" label="Resource Type">
136
			<xsl:attribute name="value">
137
				<xsl:value-of select='./@classname'/>
138
			</xsl:attribute>
139
		</field>
140
	</xsl:for-each>
141

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

    
198
	<xsl:for-each select = "./relevantdate">
199
		<field name="relevantyear" indexId = "" multiplicity="true" label="Relevant year">
200
			<xsl:attribute name="value">
201
				<xsl:value-of select='substring-before(.,"-")'/>
202
			</xsl:attribute>
203
		</field>
204
		<field name="relevantdate" indexId = "resultdate" multiplicity="true" label="Relevant date">
205
			<xsl:attribute name="value">
206
				<xsl:value-of select='.'/>
207
			</xsl:attribute>
208
		</field>
209
	</xsl:for-each>
210

    
211
	<xsl:for-each select = "./pid">
212
		<field name="pid" multiplicity="true" label="Pid">
213
			<field name="value" indexId = "pid" multiplicity="false" label="Pid">
214
				<xsl:attribute name="value">
215
					<xsl:value-of select='.'/>
216
				</xsl:attribute>
217
			</field>
218
			<field name="classid" indexId = "pidclassid" multiplicity="false" label="Pid class id">
219
				<xsl:attribute name="value">
220
					<xsl:value-of select='./@classid'/>
221
				</xsl:attribute>
222
			</field>
223
			<field name="classname" indexId = "pidclassname" multiplicity="false" label="Pid class name">
224
				<xsl:attribute name="value">
225
					<xsl:value-of select='./@classname'/>
226
				</xsl:attribute>
227
			</field>
228
		</field>
229
	</xsl:for-each>
230

    
231
    <xsl:for-each select="./bestlicense">
232
        <field name="bestlicense" indexId="resultbestlicense" multiplicity="false" label="Best License">
233
            <xsl:attribute name="value">
234
                <xsl:value-of select="@classid" />
235
            </xsl:attribute>
236
        </field>
237
    </xsl:for-each>
238

    
239
	<xsl:for-each select = "./embargoenddate">
240
		<field name="embargoendyear" indexId = "" multiplicity="true" label="Embargo end year">
241
			<xsl:attribute name="value">
242
				<xsl:value-of select='substring-before(.,"-")'/>
243
			</xsl:attribute>
244
		</field>
245
		<field name="embargoenddate" indexId = "resultembargoenddate" multiplicity="true" label="Embargo end date">
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 = "./journal">
253
		<field name="journal" indexId = "" multiplicity="true" label="Journal">
254
			<xsl:attribute name="value">
255
				<xsl:value-of select='.'/>
256
			</xsl:attribute>
257
		</field>
258
	</xsl:for-each>
259

    
260
	<xsl:for-each select = "./collectedfrom">
261
		<field name="collectedfrom" indexId = "resultcollectedfromdatasourceid" multiplicity="true" label="Collected from">
262
                <xsl:attribute name="value">
263
                        <xsl:value-of select='./@id'/>
264
                </xsl:attribute>
265
        </field>
266
        <!--field name="collectedfromname" indexId = "" multiplicity="true" label="Collected from">
267
                <xsl:attribute name="value">
268
                        <xsl:value-of select='./@name'/>
269
                </xsl:attribute>
270
        </field-->
271
	</xsl:for-each>
272

    
273
	<xsl:for-each select = "./device">
274
		<field name="device" indexId = "" multiplicity="true" label="Device">
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 = "./size">
282
		<field name="size" indexId = "" multiplicity="true" label="Size">
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 = "./format">
290
		<field name="format" indexId = "" multiplicity="true" label="Format">
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 = "./version">
298
		<field name="version" indexId = "" multiplicity="true" label="Version">
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 = "./lastmetadataupdate">
306
		<field name="lastmetadataupdate" indexId = "" multiplicity="true" label="Last metadata update">
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 = "./metadataversionnumber">
314
		<field name="metadataversionnumber" indexId = "" multiplicity="true" label="Metadata version number">
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 = "./source">
322
		<field name="source" indexId = "" multiplicity="true" label="source">
323
			<xsl:attribute name="value">
324
				<xsl:value-of select='.'/>
325
			</xsl:attribute>
326
		</field>
327
	</xsl:for-each>
328

    
329
	<xsl:for-each select = "./context">
330
		<field indexId="context" multiplicity="true" name="context" >
331

    
332
			<xsl:attribute name="value">
333
				<xsl:value-of select='./@value'/>
334
			</xsl:attribute>
335
			<xsl:attribute name="value_original">
336
				<xsl:value-of select='./@id'/>
337
			</xsl:attribute>
338

    
339
			<field name="contexttype" indexId="contexttype" multiplicity="false" label="Context Type">
340
				<xsl:attribute name="value">
341
					<xsl:value-of select="@type"></xsl:value-of>
342
				</xsl:attribute>
343
			</field>
344

    
345
			<xsl:for-each select = "./category">
346
				<field name="category" indexId="category" multiplicity="true" label="Category" >
347
					<xsl:attribute name="value">
348
						<xsl:value-of select='./@label' />
349
					</xsl:attribute>
350
					<xsl:attribute name="value_original">
351
						<xsl:value-of select='./@id'/>
352
					</xsl:attribute>
353

    
354
					<xsl:for-each select = ".//concept">
355
						<field name="concept" indexId="concept" multiplicity="true" label="Concept" >
356
							<xsl:attribute name="value">
357
								<xsl:value-of select='./@label'/>
358
							</xsl:attribute>
359
							<xsl:attribute name="value_original">
360
								<xsl:value-of select='./@id'/>
361
							</xsl:attribute>
362
						</field>
363
					</xsl:for-each>
364
				</field>
365
			</xsl:for-each>
366
		</field>
367
	</xsl:for-each>
368
</xsl:template>
369

    
370

    
371
<xsl:template match="extraInfo">
372
    <xsl:for-each select="./citations/citation">
373
        <field name="citation" multiplicity="true" indexId="" label="Citation">
374
            <field name="rawText" multiplicity="false" indexId="" label="Citation Text">
375
                <xsl:attribute name="value">
376
                    <xsl:value-of select="rawText"/>
377
                </xsl:attribute>
378
            </field>
379
            <xsl:for-each select="id">
380
            <field name="citationId" indexId="" multiplicity="true" label="Citation id details">
381
                <field name="id" multiplicity="false" indexId="" label="Citation id">
382
                    <xsl:attribute name="value">
383
                        <xsl:value-of select="@value"/>
384
                    </xsl:attribute>
385
                </field>
386
                <field name="type" multiplicity="false" indexId="" label="Citation id type">
387
                    <xsl:attribute name="value">
388
                        <xsl:value-of select="@type"/>
389
                    </xsl:attribute>
390
                </field>
391
                <field name="confidenceLevel" multiplicity="false" indexId="" label="Citation id confidence">
392
                    <xsl:attribute name="value">
393
                        <xsl:value-of select="@confidenceLevel"/>
394
                    </xsl:attribute>
395
                </field>
396
            </field>
397
            </xsl:for-each>
398
        </field>
399
    </xsl:for-each>
400
</xsl:template>
401

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

    
702
</xsl:template>
703
<!-- CHILDREN -->
704

    
705
    <xsl:template match="children/result">
706
        <field name="resultId" multiplicity="true" indexId="resultid" label="Result id">
707
            <xsl:attribute name="value">
708
                <xsl:value-of select='./@objidentifier'/>
709
            </xsl:attribute>
710
        </field>
711
    </xsl:template>
712

    
713
    <xsl:template match="children">
714

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

    
744
			<xsl:for-each select="./webresource">	
745
				<field name = "webresource" indexId = "" multiplicity="true">
746
					<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
747
				</field>
748
				<xsl:for-each select="./url">	
749
					<field name = "url" indexId = "" multiplicity="true">
750
						<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
751
					</field>
752
				</xsl:for-each>
753
			</xsl:for-each>
754
			<!--field name = "officialname" indexId = "" multiplicity="false">
755
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/officialname"/> </xsl:attribute>
756
			</field>
757
			<field name = "datasourcetypeid" indexId = "" multiplicity = "true">
758
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classid"/> </xsl:attribute>
759
			</field>
760
			<field name = "datasourcetypename" indexId = "" multiplicity = "true">
761
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classname"/> </xsl:attribute>
762
			</field-->
763
			
764
		</field>
765
	</xsl:for-each>
766

    
767
	<xsl:for-each select = "./externalreference">
768
		<field name="externalreference" multiplicity="true" indexId="">
769
			<field name="sitename" multiplicity="false" indexId="">
770
				<xsl:attribute name="value">
771
					<xsl:value-of select="./sitename"/>
772
				</xsl:attribute>
773
			</field>
774
			<field name="label" multiplicity="false" indexId="">
775
				<xsl:attribute name="value">
776
					<xsl:value-of select="./label"/>
777
				</xsl:attribute>
778
			</field>
779
			
780
			<field name="url" multiplicity="false" indexId="">
781
				<xsl:attribute name="value">
782
					<xsl:value-of select="./url"/>
783
				</xsl:attribute>
784
			</field>
785

    
786
			<field name="typeid" multiplicity="false" indexId="">
787
				<xsl:attribute name="value">
788
					<xsl:value-of select="./qualifier/@classid"/>
789
				</xsl:attribute>
790
			</field>
791
			<field name="refidentifier" multiplicity="false" indexId="">
792
				<xsl:attribute name="value">
793
					<xsl:value-of select="./refidentifier"/>
794
				</xsl:attribute>
795
			</field>
796
		</field>
797
	</xsl:for-each>
798
</xsl:template>
799

    
800
<xsl:template name="getExtension">
801
	<xsl:param name="filename"/>
802
	<xsl:choose>
803
		<xsl:when test="contains($filename, '::')">
804
			<xsl:call-template name="getExtension">
805
				<xsl:with-param name="filename" select="substring-after($filename, '::')"/>
806
			</xsl:call-template>
807
		</xsl:when>
808
		<xsl:otherwise>
809
			<xsl:value-of select="$filename"/>
810
		</xsl:otherwise>
811
	</xsl:choose>
812
</xsl:template>
813

    
814

    
815
</xsl:stylesheet>
816

    
817

    
(39-39/48)