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

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

    
43

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

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

    
54
	<xsl:for-each select = "./dateofacceptance">
55
		<field name="dateofacceptance" indexId = "resultdateofacceptance" multiplicity="true" label="Date of acceptance">
56
			<xsl:attribute name="value">
57
				<xsl:value-of select='.'/>
58
			</xsl:attribute>
59
		</field>
60
	</xsl:for-each>
61
	
62
	<xsl:for-each select = "./storagedate">
63
		<field name="storagedate" indexId = "resultstoragedate" multiplicity="true" label="Date of storage">
64
			<xsl:attribute name="value">
65
				<xsl:value-of select='.'/>
66
			</xsl:attribute>
67
		</field>
68
	</xsl:for-each>
69

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

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

    
86
	<xsl:for-each select = "./language">
87
		<field name="languageid" indexId = "resultlanguageid" multiplicity="true" label="Language(s)">
88
			<xsl:attribute name="value">
89
				<xsl:value-of select='./@classid'/>
90
			</xsl:attribute>
91
		</field>
92
		<field name="languagename" indexId = "resultlanguagename" multiplicity="true" label="Language(s)">
93
			<xsl:attribute name="value">
94
				<xsl:value-of select='./@classname'/>
95
			</xsl:attribute>
96
		</field>
97
		<field name="language" indexId = "" multiplicity="true" label="Language(s)">
98
			<xsl:attribute name="value">
99
				<xsl:value-of select='./@classname'/>
100
			</xsl:attribute>
101
			<xsl:attribute name="value_original">
102
				<xsl:value-of select='./@classid'/>
103
			</xsl:attribute>
104
		</field>
105
	</xsl:for-each>
106
	
107
	<xsl:for-each select = "./resulttype">
108
		<field name="resulttypeid" indexId = "resulttypeid" multiplicity="true" label="Type">
109
			<xsl:attribute name="value">
110
				<xsl:value-of select='./@classid'/>
111
			</xsl:attribute>
112
		</field>
113
		<field name="resulttypename" indexId = "resulttypename" multiplicity="true" label="Type">
114
			<xsl:attribute name="value">
115
				<xsl:value-of select='./@classname'/>
116
			</xsl:attribute>
117
		</field>
118
	</xsl:for-each>
119
	
120
	<xsl:for-each select = "./resourcetype">
121
		<field name="resourcetypeid" indexId = "" multiplicity="true" label="Resource Type">
122
			<xsl:attribute name="value">
123
				<xsl:value-of select='./@classid'/>
124
			</xsl:attribute>
125
		</field>
126
		<field name="resourcetypename" indexId = "" multiplicity="true" label="Resource Type">
127
			<xsl:attribute name="value">
128
				<xsl:value-of select='./@classname'/>
129
			</xsl:attribute>
130
		</field>
131
	</xsl:for-each>
132

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
320
	<xsl:for-each select = "./context">
321
		<field indexId="context" multiplicity="true" name="context" >
322
		
323
			<xsl:attribute name="value">
324
				<xsl:value-of select='./@value'/>
325
			</xsl:attribute>
326
			<xsl:attribute name="value_original">
327
				<xsl:value-of select='./@id'/>
328
			</xsl:attribute>
329
			
330
			<field name="contexttype" indexId="contexttype" multiplicity="false" label="Context Type">
331
				<xsl:attribute name="value">
332
					<xsl:value-of select="@type"></xsl:value-of>
333
				</xsl:attribute>
334
			</field>
335
			
336
			<xsl:for-each select = "./category">
337
				<field name="category" indexId="category" multiplicity="true" label="Category" >
338
					<xsl:attribute name="value">
339
						<xsl:value-of select='./@label' />
340
					</xsl:attribute>
341
					<xsl:attribute name="value_original">
342
						<xsl:value-of select='./@id'/>
343
					</xsl:attribute>
344

    
345
					<xsl:for-each select = ".//concept">
346
						<field name="concept" indexId="concept" multiplicity="true" label="Concept" >
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
						</field>
354
					</xsl:for-each>
355
				</field>
356
			</xsl:for-each>
357
		</field>
358
	</xsl:for-each>
359
</xsl:template>
360

    
361

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

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

    
651
</xsl:template>
652
<!-- CHILDREN -->
653
<xsl:template match="children">
654

    
655
	<xsl:for-each select = "./instance">
656
		<field name = "datasource"  indexId = "resultcollectedfromdatasourceid" multiplicity="true">
657
			<xsl:attribute name = "value"> <xsl:value-of select="./@id"/> </xsl:attribute><!--??-->
658
			<field name = "instanceId" indexId = "objIdentifier" multiplicity = "false">
659
				<xsl:attribute name="value"><xsl:value-of select="./@id"/></xsl:attribute>
660
			</field>
661
			<field name = "hostedby" indexId = "resulthostingdatasourceid" multiplicity="false">
662
				<xsl:attribute name = "value"> <xsl:value-of select="./hostedby/@id"/> </xsl:attribute>
663
			</field> 
664
			<field name = "hostedbyname" indexId = "resulthostingdatasourcename" multiplicity="false">
665
				<xsl:attribute name = "value"> <xsl:value-of select="./hostedby/@name"/> </xsl:attribute>
666
			</field>
667
			<xsl:for-each select="./licence">
668
				<field name = "licenceid" indexId = "" multiplicity = "true">
669
					<xsl:attribute name = "value"> <xsl:value-of select="./@classid"/> </xsl:attribute>
670
				</field>
671
				<field name = "licencename" indexId = "resultrights" multiplicity = "true">
672
					<xsl:attribute name = "value"> <xsl:value-of select="./@classname"/> </xsl:attribute>
673
				</field>
674
			</xsl:for-each>
675
			<xsl:for-each select="./instancetype">			
676
				<field name = "typeid" indexId = "instancetypeid" multiplicity = "true">
677
					<xsl:attribute name = "value"> <xsl:value-of select="./@classid"/> </xsl:attribute>
678
				</field>
679
				<field name = "typename" indexId = "instancetypename" multiplicity = "true">
680
					<xsl:attribute name = "value"> <xsl:value-of select="./@classname"/> </xsl:attribute>
681
				</field>
682
			</xsl:for-each>
683

    
684
			<xsl:for-each select="./webresource">	
685
				<field name = "webresource" indexId = "" multiplicity="true">
686
					<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
687
				</field>
688
				<xsl:for-each select="./url">	
689
					<field name = "url" indexId = "" multiplicity="true">
690
						<xsl:attribute name = "value"> <xsl:value-of select="."/> </xsl:attribute>
691
					</field>
692
				</xsl:for-each>
693
			</xsl:for-each>
694
			<!--field name = "officialname" indexId = "" multiplicity="false">
695
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/officialname"/> </xsl:attribute>
696
			</field>
697
			<field name = "datasourcetypeid" indexId = "" multiplicity = "true">
698
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classid"/> </xsl:attribute>
699
			</field>
700
			<field name = "datasourcetypename" indexId = "" multiplicity = "true">
701
				<xsl:attribute name = "value"> <xsl:value-of select="./datasource/datasourcetype/@classname"/> </xsl:attribute>
702
			</field-->
703
			
704
		</field>
705
	</xsl:for-each>
706

    
707
	<xsl:for-each select = "./externalreference">
708
		<field name="externalreference" multiplicity="true" indexId="">
709
			<field name="sitename" multiplicity="false" indexId="">
710
				<xsl:attribute name="value">
711
					<xsl:value-of select="./sitename"/>
712
				</xsl:attribute>
713
			</field>
714
			<field name="label" multiplicity="false" indexId="">
715
				<xsl:attribute name="value">
716
					<xsl:value-of select="./label"/>
717
				</xsl:attribute>
718
			</field>
719
			
720
			<field name="url" multiplicity="false" indexId="">
721
				<xsl:attribute name="value">
722
					<xsl:value-of select="./url"/>
723
				</xsl:attribute>
724
			</field>
725

    
726
			<field name="typeid" multiplicity="false" indexId="">
727
				<xsl:attribute name="value">
728
					<xsl:value-of select="./qualifier/@classid"/>
729
				</xsl:attribute>
730
			</field>
731
			<field name="refidentifier" multiplicity="false" indexId="">
732
				<xsl:attribute name="value">
733
					<xsl:value-of select="./refidentifier"/>
734
				</xsl:attribute>
735
			</field>
736
		</field>
737
	</xsl:for-each>
738
</xsl:template>
739

    
740
<xsl:template name="getExtension">
741
	<xsl:param name="filename"/>
742
	<xsl:choose>
743
		<xsl:when test="contains($filename, '::')">
744
			<xsl:call-template name="getExtension">
745
				<xsl:with-param name="filename" select="substring-after($filename, '::')"/>
746
			</xsl:call-template>
747
		</xsl:when>
748
		<xsl:otherwise>
749
			<xsl:value-of select="$filename"/>
750
		</xsl:otherwise>
751
	</xsl:choose>
752
</xsl:template>
753

    
754

    
755
</xsl:stylesheet>
756

    
757

    
(20-20/27)