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

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

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