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" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
3
	xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions">
4

    
5
	<xsl:param name="parentDatasourceId" />
6
	<xsl:param name="namespacePrefix" />
7
	
8
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::WT')" />
9

    
10
	<xsl:variable name="fundingIDtemp">
11
		<xsl:choose>
12
			<xsl:when test="string-length(normalize-space(.//FundingStream)) &gt; 0">
13
				<xsl:value-of select="concat($funderID, '::', normalize-space(.//FundingStream))" />	
14
			</xsl:when>
15
			<xsl:otherwise>
16
				<xsl:value-of select="concat($funderID, '::UNKNOWN')" />
17
			</xsl:otherwise>
18
		</xsl:choose>
19
	</xsl:variable>
20
	
21
	<xsl:variable name="fundingID" select="normalize-space($fundingIDtemp)" />
22
	<xsl:variable name="projectID" select="concat($namespacePrefix, '::', .//Grant/Id)" />
23
	<xsl:variable name="orgID" select="concat($namespacePrefix, '::', translate(.//Institution, ' ,', '__'))" />
24
	<xsl:variable name="personID" select="concat($projectID, '::', translate(concat(.//PI/FirstName, ' ', .//PI/LastName), ' ,.', '___'))" />
25
	<xsl:variable name="startDate" select="translate(.//StartDate,'/\','--')" />
26
	<xsl:variable name="endDate" select="translate(.//EndDate,'/\','--')" />
27
	
28
	<xsl:variable name="dateFormat" select="string('dd-MM-yyyy')"/>
29

    
30
	<xsl:template match="/">
31
    	<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
32
			xmlns:dri="http://www.driver-repository.eu/namespace/dri"
33
			xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34
			xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
35

    
36
		<xsl:copy-of select=".//*[local-name()='header']"/>
37
		<metadata>
38
		<ROWS>
39
			<xsl:if test="string-length(normalize-space(.//Grant/Title)) &gt; 0 and string-length($projectID) &gt; 0">
40
				<ROW table="projects">
41
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectID" /></FIELD>
42
					<FIELD name="id"><xsl:value-of select="$projectID" /></FIELD>
43
					<FIELD name="code"><xsl:value-of select=".//Grant/Id"/></FIELD>
44
					<FIELD name="startdate" type="date" format="{$dateFormat}"><xsl:value-of select="$startDate" /></FIELD>
45
					<FIELD name="enddate" type="date" format="{$dateFormat}"><xsl:value-of select="$endDate" /></FIELD>
46
					<FIELD name="title"><xsl:value-of select=".//Grant/Title" /></FIELD>
47
					<FIELD name="contracttypeclass">UNKNOWN</FIELD>
48
					<FIELD name="contracttypescheme">wt:contractTypes</FIELD>
49
					<FIELD name="acronym"> </FIELD>
50
					<FIELD name="keywords"><xsl:value-of select=".//Grant/Type" /></FIELD>
51
					<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
52
					<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
53
					<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
54
					<FIELD name="optional1"><xsl:value-of select="concat(.//Grant/AmountAwarded, ' pounds')" /></FIELD>
55
				</ROW>
56
				<ROW table="project_fundingpath">
57
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingID,'@@', $projectID)" /></FIELD>
58
					<FIELD name="funding"><xsl:value-of select="$fundingID" /></FIELD>
59
					<FIELD name="project"><xsl:value-of select="$projectID" /></FIELD>
60
					<FIELD name="startdate" type="date" format="{$dateFormat}"><xsl:value-of select="$startDate" /></FIELD>
61
					<FIELD name="enddate" type="date" format="{$dateFormat}"><xsl:value-of select="$endDate" /></FIELD>
62
				</ROW>
63
				<ROW table="persons">
64
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personID" /></FIELD>
65
					<FIELD name="id"><xsl:value-of select="$personID" /></FIELD>
66
					<FIELD name="firstname"><xsl:value-of select=".//PI/FirstName" /></FIELD>
67
					<FIELD name="secondnames"><xsl:value-of select=".//PI/LastName" /></FIELD>
68
					<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
69
					<FIELD name="optional1"><xsl:value-of select=".//PI/Title" /></FIELD>
70
					<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
71
					<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
72
				</ROW>
73
				<xsl:if test="string-length($orgID) &gt; 4"> 
74
					<ROW table="organizations">
75
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgID" /></FIELD>
76
						<FIELD name="id"><xsl:value-of select="$orgID" /></FIELD>
77
						<FIELD name="legalname"><xsl:value-of select=".//Institution" /></FIELD>
78
						<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
79
						<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
80
						<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
81
						<FIELD name="trust" type="float">0.8</FIELD>
82
					</ROW>
83
					<ROW table="project_organization">
84
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($projectID, '@@', $orgID)" /></FIELD>
85
						<FIELD name="participantnumber" type="int">1</FIELD>
86
						<FIELD name="startdate" type="date" format="{$dateFormat}"><xsl:value-of select="$startDate" /></FIELD>
87
						<FIELD name="enddate" type="date" format="{$dateFormat}"><xsl:value-of select="$endDate" /></FIELD>
88
						<FIELD name="project"><xsl:value-of select="$projectID" /></FIELD>
89
						<FIELD name="resporganization"><xsl:value-of select="$orgID" /></FIELD>
90
						<FIELD name="contactperson"><xsl:value-of select="$personID" /></FIELD>
91
						<FIELD name="semanticclass">coordinator</FIELD>
92
						<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
93
					</ROW>
94
				</xsl:if>
95
			</xsl:if>
96
		</ROWS>
97
		</metadata>
98
		</record>
99
	</xsl:template>
100
</xsl:stylesheet>
(16-16/16)