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 = "funding_level_0" indexId = "fundinglevel0_id" multiplicity = "false">
513
					<xsl:attribute name="value_original">
514
						<xsl:value-of select="./funding/funding_level_0"/>
515
					</xsl:attribute>					
516
					<xsl:attribute name = "value">
517
						<xsl:call-template name="getExtension">
518
							<xsl:with-param name="filename" select="./funding/funding_level_0"/>
519
						</xsl:call-template>			
520
						<!--xsl:value-of select='./funding/funding_level_0'/-->
521
					</xsl:attribute>
522
				</field>
523
				<field name = "funding_level_1" indexId = "fundinglevel1_id" multiplicity = "false">
524
					<xsl:attribute name="value_original">
525
						<xsl:value-of select="./funding/funding_level_1"/>
526
					</xsl:attribute>					
527
					<xsl:attribute name = "value">
528
						<xsl:call-template name="getExtension">
529
							<xsl:with-param name="filename" select="./funding/funding_level_1"/>
530
						</xsl:call-template>	
531
						<!--xsl:value-of select='./funding/funding_level_1'/-->
532
					</xsl:attribute>
533
				</field>
534
				<field name = "funding_level_2" indexId = "fundinglevel2_id" multiplicity = "false">
535
					<xsl:attribute name="value_original">
536
						<xsl:value-of select="./funding/funding_level_2"/>
537
					</xsl:attribute>					
538
					<xsl:attribute name = "value">
539
						<xsl:call-template name="getExtension">
540
							<xsl:with-param name="filename" select="./funding/funding_level_2"/>
541
						</xsl:call-template>	
542
						<!--xsl:value-of select='./funding/funding_level_2'/-->
543
					</xsl:attribute>
544
				</field>
545
			</field>
546
		</field>
547
	</xsl:if>
548
<!--RESULT-->
549
	<xsl:if test="./to/@type='result'">
550
		<field indexId = "objIdentifier"  multiplicity="true">
551
			<xsl:attribute name="name"><xsl:value-of select='./to/@class'/></xsl:attribute>
552
			<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
553
			<field name = "resultid" indexId ="objIdentifier" multiplicity="false" label="Result id">		
554
				<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
555
			</field>
556
			<field name = "title" indexId = "resulttitle" multiplicity = "false" label = "Title">
557
				<xsl:attribute name="value">
558
					<xsl:value-of select="./title"/>
559
				</xsl:attribute>
560
			</field>
561
			<field name = "dateofacceptance" indexId = "resultdateofacceptance" multiplicity = "false" label = "Date of acceptance">
562
				<xsl:attribute name="value">
563
					<xsl:value-of select="./dateofacceptance"/>
564
				</xsl:attribute>
565
			</field>
566
			<field name = "resulttypeid" indexId = "resulttypeid" multiplicity = "false" label = "type id">
567
				<xsl:attribute name="value">
568
					<xsl:value-of select="./resulttype/@classid"/>
569
				</xsl:attribute>
570
			</field>
571
			<field name = "resulttypename" indexId = "resulttypename" multiplicity = "false" label = "type name">
572
				<xsl:attribute name="value">
573
					<xsl:value-of select="./resulttype/@classname"/>
574
				</xsl:attribute>
575
			</field>
576
			<field name = "inferred" indexId="" multiplicity = "false" label="inferred">		
577
				<xsl:attribute name="value">
578
					<xsl:choose>
579
						<xsl:when test="@inferred !=''">
580
							<xsl:value-of select="@inferred"/>
581
						</xsl:when>
582
						<xsl:otherwise>
583
							<xsl:text>false</xsl:text>
584
						</xsl:otherwise>
585
					</xsl:choose>
586
				</xsl:attribute>
587
			</field>
588
			<field name = "trust" indexId="" multiplicity = "false" label="trust level">
589
				<xsl:attribute name="value">
590
					<xsl:choose>
591
						<xsl:when test="@trust !=''">
592
							<xsl:value-of select="@trust"/>
593
						</xsl:when>
594
						<xsl:otherwise>
595
							<xsl:text>NEUTRAL</xsl:text>
596
						</xsl:otherwise>
597
					</xsl:choose>
598
				</xsl:attribute>
599
			</field>
600
			<field name = "provenance" indexId="" multiplicity = "false" label="provenance">
601
				<xsl:attribute name="value">
602
				<xsl:choose>
603
						<xsl:when test="@provenanceaction !=''">
604
							<xsl:value-of select="@provenanceaction"/>
605
						</xsl:when>
606
						<xsl:otherwise>
607
							<xsl:text></xsl:text>
608
						</xsl:otherwise>
609
					</xsl:choose>
610
				</xsl:attribute>
611
			</field>
612
            <xsl:if test="./to/@class = 'hasAmongTopNSimilarDocuments'">
613
                <field name="similarity" label="similarity" multiplicity="false" indexId="">
614
                    <xsl:attribute name="value">
615
                        <xsl:value-of select="similarity"/>
616
                    </xsl:attribute>
617
                </field>
618
            </xsl:if>
619
		</field>
620
	</xsl:if>	
621
<!--ORGANIZATION-->
622
	<xsl:if test="./to/@type='organization'">
623
		<field name="organization" indexId = "objIdentifier"  multiplicity="true">
624
			<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
625
			<field name = "organizationid" indexId ="objIdentifier" multiplicity="false" label="Organization id">		
626
				<xsl:attribute name="value"><xsl:value-of select='./to'/> </xsl:attribute>
627
			</field>
628
			<field name = "role" indexId ="" multiplicity="false" label="role">		
629
				<xsl:attribute name="value"><xsl:value-of select='./to/@class'/> </xsl:attribute>
630
			</field>
631
			<field name = "legalshortname" indexId ="organizationlegalshortname" multiplicity="false" label="Organization short name">		
632
				<xsl:attribute name="value"><xsl:value-of select='./legalshortname'/> </xsl:attribute>
633
			</field>
634
			<field name = "websiteurl" indexId ="organizationwebsiteurl" multiplicity="false" label="Website">		
635
				<xsl:attribute name="value"><xsl:value-of select='./websiteurl'/> </xsl:attribute>
636
			</field>
637
			<field name = "countryid" indexId ="organizationcountryid" multiplicity="false" label="Country code">		
638
				<xsl:attribute name="value"><xsl:value-of select='./country/@classid'/> </xsl:attribute>
639
			</field>
640
			<field name = "countryname" indexId ="organizationcountryname" multiplicity="false" label="Country">		
641
				<xsl:attribute name="value"><xsl:value-of select='./country/@classname'/> </xsl:attribute>
642
			</field>
643
			<field name = "participantnumber" indexId ="" multiplicity="false" label="Participant Number">		
644
				<xsl:attribute name="value"><xsl:value-of select='./participantnumber'/> </xsl:attribute>
645
			</field>
646
			<field name = "contactperson" indexId ="" multiplicity="false" label="Contact Person">		
647
				<xsl:attribute name="value"><xsl:value-of select='./contactperson'/> </xsl:attribute>
648
			</field>
649
		</field>
650
	</xsl:if>
651

    
652
</xsl:template>
653
<!-- CHILDREN -->
654

    
655
    <xsl:template match="children/result">
656
        <field name="resultId" multiplicity="true" indexId="resultid" label="Result id">
657
            <xsl:attribute name="value">
658
                <xsl:value-of select='./@objidentifier'/>
659
            </xsl:attribute>
660
        </field>
661
    </xsl:template>
662

    
663
    <xsl:template match="children">
664

    
665
	<xsl:for-each select = "./instance">
666
		<field name = "datasource"  indexId = "resultcollectedfromdatasourceid" multiplicity="true">
667
			<xsl:attribute name = "value"> <xsl:value-of select="./@id"/> </xsl:attribute><!--??-->
668
			<field name = "instanceId" indexId = "objIdentifier" multiplicity = "false">
669
				<xsl:attribute name="value"><xsl:value-of select="./@id"/></xsl:attribute>
670
			</field>
671
			<field name = "hostedby" indexId = "resulthostingdatasourceid" multiplicity="false">
672
				<xsl:attribute name = "value"> <xsl:value-of select="./hostedby/@id"/> </xsl:attribute>
673
			</field> 
674
			<field name = "hostedbyname" indexId = "resulthostingdatasourcename" multiplicity="false">
675
				<xsl:attribute name = "value"> <xsl:value-of select="./hostedby/@name"/> </xsl:attribute>
676
			</field>
677
			<xsl:for-each select="./licence">
678
				<field name = "licenceid" indexId = "" multiplicity = "true">
679
					<xsl:attribute name = "value"> <xsl:value-of select="./@classid"/> </xsl:attribute>
680
				</field>
681
				<field name = "licencename" indexId = "resultrights" multiplicity = "true">
682
					<xsl:attribute name = "value"> <xsl:value-of select="./@classname"/> </xsl:attribute>
683
				</field>
684
			</xsl:for-each>
685
			<xsl:for-each select="./instancetype">			
686
				<field name = "typeid" indexId = "instancetypeid" multiplicity = "true">
687
					<xsl:attribute name = "value"> <xsl:value-of select="./@classid"/> </xsl:attribute>
688
				</field>
689
				<field name = "typename" indexId = "instancetypename" multiplicity = "true">
690
					<xsl:attribute name = "value"> <xsl:value-of select="./@classname"/> </xsl:attribute>
691
				</field>
692
			</xsl:for-each>
693

    
694
			<xsl:for-each select="./webresource">	
695
				<field name = "webresource" indexId = "" multiplicity="true">
696
					<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
697
				</field>
698
				<xsl:for-each select="./url">	
699
					<field name = "url" indexId = "" multiplicity="true">
700
						<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
701
					</field>
702
				</xsl:for-each>
703
			</xsl:for-each>
704
			<!--field name = "officialname" indexId = "" multiplicity="false">
705
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/officialname"/> </xsl:attribute>
706
			</field>
707
			<field name = "datasourcetypeid" indexId = "" multiplicity = "true">
708
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classid"/> </xsl:attribute>
709
			</field>
710
			<field name = "datasourcetypename" indexId = "" multiplicity = "true">
711
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classname"/> </xsl:attribute>
712
			</field-->
713
			
714
		</field>
715
	</xsl:for-each>
716

    
717
	<xsl:for-each select = "./externalreference">
718
		<field name="externalreference" multiplicity="true" indexId="">
719
			<field name="sitename" multiplicity="false" indexId="">
720
				<xsl:attribute name="value">
721
					<xsl:value-of select="./sitename"/>
722
				</xsl:attribute>
723
			</field>
724
			<field name="label" multiplicity="false" indexId="">
725
				<xsl:attribute name="value">
726
					<xsl:value-of select="./label"/>
727
				</xsl:attribute>
728
			</field>
729
			
730
			<field name="url" multiplicity="false" indexId="">
731
				<xsl:attribute name="value">
732
					<xsl:value-of select="./url"/>
733
				</xsl:attribute>
734
			</field>
735

    
736
			<field name="typeid" multiplicity="false" indexId="">
737
				<xsl:attribute name="value">
738
					<xsl:value-of select="./qualifier/@classid"/>
739
				</xsl:attribute>
740
			</field>
741
			<field name="refidentifier" multiplicity="false" indexId="">
742
				<xsl:attribute name="value">
743
					<xsl:value-of select="./refidentifier"/>
744
				</xsl:attribute>
745
			</field>
746
		</field>
747
	</xsl:for-each>
748
</xsl:template>
749

    
750
<xsl:template name="getExtension">
751
	<xsl:param name="filename"/>
752
	<xsl:choose>
753
		<xsl:when test="contains($filename, '::')">
754
			<xsl:call-template name="getExtension">
755
				<xsl:with-param name="filename" select="substring-after($filename, '::')"/>
756
			</xsl:call-template>
757
		</xsl:when>
758
		<xsl:otherwise>
759
			<xsl:value-of select="$filename"/>
760
		</xsl:otherwise>
761
	</xsl:choose>
762
</xsl:template>
763

    
764

    
765
</xsl:stylesheet>
766

    
767

    
(22-22/30)