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

    
7
	<xsl:variable name="invalid" select="' ,-'" />
8
	<xsl:variable name="valid"   select="'___'" />
9
		
10
	<xsl:template match="/">
11
		<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
12
			xmlns:dri="http://www.driver-repository.eu/namespace/dri"
13
			xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
14
			xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
15
			
16
			<xsl:copy-of select=".//*[local-name()='header']"/>
17
			
18
			<metadata>
19
				<ROWS>
20
					<xsl:variable name="prefix" select="string('ands________')" />
21
					<xsl:variable name="projectId" select="concat($prefix, '::',  //project/id)" />
22
					<xsl:variable name="parentDatasourceId" select="string('openaire____::ands')"/>
23
					<xsl:variable name="startDate" select="//project/startDate" />
24
					<xsl:variable name="endDate" select="//project/endDate" />
25
									
26
					<ROW table="projects">
27
						<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
28
						<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
29
						<FIELD name="code"><xsl:value-of select="//project/id" /></FIELD>
30
						<FIELD name="title">
31
							<xsl:choose>
32
								<xsl:when test="normalize-space(//project/title)"><xsl:value-of select="//project/title" /></xsl:when>
33
								<xsl:when test="normalize-space(//project/shortTitle)"><xsl:value-of select="//project/shortTitle" /></xsl:when>
34
								<xsl:otherwise><xsl:value-of select="concat('Project ', //project/id)"/></xsl:otherwise>
35
							</xsl:choose>
36
						</FIELD>
37
						<xsl:if test="normalize-space($startDate)">
38
							<FIELD name="startdate" type="date" format="dd-MM-yyyy"><xsl:value-of select="$startDate" /></FIELD>
39
						</xsl:if>
40
						<xsl:if test="normalize-space($endDate)">
41
							<FIELD name="enddate" type="date" format="dd-MM-yyyy"><xsl:value-of select="$endDate" /></FIELD>
42
						</xsl:if>
43
						<FIELD name="keywords"><xsl:value-of select="//project/keywords" /></FIELD>
44
						<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId"/></FIELD>
45
						<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
46
					</ROW>
47
					
48
					<xsl:for-each select="//organization">
49
						<xsl:variable name="orgId" select="concat($prefix,'::',.)"/>					
50
						<ROW table="organizations">
51
							<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD>
52
							<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD>
53
							<FIELD name="legalname"><xsl:value-of select="." /></FIELD>
54
							<FIELD name="countryclass">AU</FIELD>
55
						</ROW>
56
						<ROW table="project_organization">
57
							<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($projectId,'@@',$orgId)" /></FIELD>
58
							<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
59
							<FIELD name="resporganization"><xsl:value-of select="$orgId" /></FIELD>
60
							<FIELD name="participantnumber" type="int">1</FIELD>
61
							<xsl:if test="normalize-space($startDate)">
62
								<FIELD name="startdate" type="date" format="dd-MM-yyyy"><xsl:value-of select="$startDate" /></FIELD>
63
							</xsl:if>
64
							<xsl:if test="normalize-space($endDate)">
65
								<FIELD name="enddate" type="date" format="dd-MM-yyyy"><xsl:value-of select="$endDate" /></FIELD>
66
							</xsl:if>
67
						</ROW>
68
					</xsl:for-each>
69
					
70
					<xsl:for-each select="//funding">
71
						<xsl:variable name="fundingId" select="concat('ands________::NHMRC::', ./mainFundingGroup, '::', ./higherGrantType, '::', ./subType)" />
72
						<ROW table="project_fundingpath">
73
							<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@', $projectId)" /></FIELD>
74
							<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
75
							<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
76
							<xsl:if test="normalize-space($startDate)">
77
								<FIELD name="startdate" type="date" format="dd-MM-yyyy"><xsl:value-of select="$startDate" /></FIELD>
78
							</xsl:if>
79
							<xsl:if test="normalize-space($endDate)">
80
								<FIELD name="enddate" type="date" format="dd-MM-yyyy"><xsl:value-of select="$endDate" /></FIELD>
81
							</xsl:if>
82
						</ROW>
83
					</xsl:for-each>
84
					
85
				</ROWS>
86
			</metadata>
87
		</record>
88
	</xsl:template>
89

    
90
</xsl:stylesheet>
(1-1/13)