Project

General

Profile

« Previous | Next » 

Revision 48139

integrated (hopefully) all required changes from dnet40

View differences:

croatian_projects_2_db.xsl
1 1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet 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" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
3
                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions" version="1.0">
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                version="1.0">
4 4

  
5
	<xsl:param name="parentDatasourceId" />
6
	<xsl:param name="funderAcronym" />
5
	<xsl:param name="parentDatasourceId"/>
6
	<xsl:param name="funderAcronym"/>
7 7

  
8 8
	<xsl:template name="formatDate">
9
		<xsl:param name="datename" />
10
		<xsl:param name="datevalue" />
9
		<xsl:param name="datename"/>
10
		<xsl:param name="datevalue"/>
11 11
		<xsl:choose>
12 12
			<xsl:when test="string-length($datevalue) = 4 and $datename = 'startdate'">
13
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd"><xsl:value-of select="concat($datevalue, '-01-01')" /></FIELD>
13
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
14
					<xsl:value-of select="concat($datevalue, '-01-01')"/>
15
				</FIELD>
14 16
			</xsl:when>
15 17
			<xsl:when test="string-length($datevalue) = 4 and $datename = 'enddate'">
16
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd"><xsl:value-of select="concat($datevalue, '-12-31')" /></FIELD>
18
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
19
					<xsl:value-of select="concat($datevalue, '-12-31')"/>
20
				</FIELD>
17 21
			</xsl:when>
18 22
			<xsl:when test="string-length($datevalue) = 10">
19
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd"><xsl:value-of select="$datevalue" /></FIELD>
23
				<FIELD name="{$datename}" type="date" format="yyyy-MM-dd">
24
					<xsl:value-of select="$datevalue"/>
25
				</FIELD>
20 26
			</xsl:when>
21 27
		</xsl:choose>
22 28
	</xsl:template>
23 29

  
24
	<xsl:variable name="namespacePrefix" select="string('irb_hr______')" />
30
	<xsl:variable name="namespacePrefix" select="string('irb_hr______')"/>
25 31

  
26 32
	<xsl:template match="/">
27
		<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
28
		        xmlns:dri="http://www.driver-repository.eu/namespace/dri"
29
		        xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
30
		        xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
33
		<record
34
		>
31 35
			<xsl:if test="contains(//column[@name='FUNDER_NAME'], $funderAcronym)">
32 36

  
33
				<xsl:variable name="fundingId" select="normalize-space(concat($namespacePrefix, '::', $funderAcronym))" />
37
				<xsl:variable name="fundingId" select="normalize-space(concat($namespacePrefix, '::', $funderAcronym))"/>
34 38
				<xsl:copy-of select=".//*[local-name()='header']"/>
35 39
				<metadata>
36 40
					<ROWS>
37 41
						<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'PROJECT_IDENTIFIER']))"/>
38 42
						<xsl:variable name="projectTitle">
39
								<xsl:choose>
40
										<xsl:when test="//column[@name = 'PROJECT_TITLE'] != ''"><xsl:value-of select="//column[@name = 'PROJECT_TITLE']" /></xsl:when>
41
										<xsl:otherwise><xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']" /></xsl:otherwise>
42
								</xsl:choose>
43
							<xsl:choose>
44
								<xsl:when test="//column[@name = 'PROJECT_TITLE'] != ''">
45
									<xsl:value-of select="//column[@name = 'PROJECT_TITLE']"/>
46
								</xsl:when>
47
								<xsl:otherwise>
48
									<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
49
								</xsl:otherwise>
50
							</xsl:choose>
43 51
						</xsl:variable>
44 52

  
45 53
						<ROW table="projects">
46
							<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
47
							<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
48
							<FIELD name="code"><xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']" /></FIELD>
49
							<FIELD name="title"><xsl:value-of select="$projectTitle" /></FIELD>
54
							<FIELD name="_dnet_resource_identifier_">
55
								<xsl:value-of select="$projectId"/>
56
							</FIELD>
57
							<FIELD name="id">
58
								<xsl:value-of select="$projectId"/>
59
							</FIELD>
60
							<FIELD name="code">
61
								<xsl:value-of select="//column[@name = 'PROJECT_IDENTIFIER']"/>
62
							</FIELD>
63
							<FIELD name="title">
64
								<xsl:value-of select="$projectTitle"/>
65
							</FIELD>
50 66
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
51 67
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
52 68
							<FIELD name="collectedfrom">
......
62 78
							</xsl:call-template>
63 79
						</ROW>
64 80
						<xsl:if test="string-length(normalize-space(//column[@name = 'ORGANIZATION_INVOLVED'])) &gt; 0">
65
							<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))" />
81
							<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(//column[@name = 'ORGANIZATION_INVOLVED']))"/>
66 82
							<ROW table="organizations">
67
								<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$organizationId" /></FIELD>
68
								<FIELD name="id"><xsl:value-of select="$organizationId" /></FIELD>
69
								<FIELD name="legalname"><xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']" /></FIELD>
83
								<FIELD name="_dnet_resource_identifier_">
84
									<xsl:value-of select="$organizationId"/>
85
								</FIELD>
86
								<FIELD name="id">
87
									<xsl:value-of select="$organizationId"/>
88
								</FIELD>
89
								<FIELD name="legalname">
90
									<xsl:value-of select="//column[@name = 'ORGANIZATION_INVOLVED']"/>
91
								</FIELD>
70 92
								<FIELD name="countryclass">HR</FIELD>
71 93
								<FIELD name="countryscheme">dnet:countries</FIELD>
72
								<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
94
								<FIELD name="collectedfrom">
95
									<xsl:value-of select="$parentDatasourceId"/>
96
								</FIELD>
73 97
								<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
74 98
								<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
75 99
							</ROW>
76 100
							<ROW table="project_organization">
77
								<FIELD name="_dnet_resource_identifier_"><xsl:value-of select='concat($projectId, "@@", $organizationId)' /></FIELD>
78
								<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
79
								<FIELD name="resporganization"><xsl:value-of select="$organizationId" /></FIELD>
101
								<FIELD name="_dnet_resource_identifier_">
102
									<xsl:value-of select='concat($projectId, "@@", $organizationId)'/>
103
								</FIELD>
104
								<FIELD name="project">
105
									<xsl:value-of select="$projectId"/>
106
								</FIELD>
107
								<FIELD name="resporganization">
108
									<xsl:value-of select="$organizationId"/>
109
								</FIELD>
80 110
								<FIELD name="participantnumber" type="int">1</FIELD>
81 111
								<FIELD name="semanticclass">coordinator</FIELD>
82 112
								<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
......
84 114
						</xsl:if>
85 115
						<xsl:if test="string-length($fundingId) &gt; 0">
86 116
							<ROW table="project_fundingpath">
87
								<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@', $projectId)" /></FIELD>
88
								<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
89
								<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
117
								<FIELD name="_dnet_resource_identifier_">
118
									<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
119
								</FIELD>
120
								<FIELD name="funding">
121
									<xsl:value-of select="$fundingId"/>
122
								</FIELD>
123
								<FIELD name="project">
124
									<xsl:value-of select="$projectId"/>
125
								</FIELD>
90 126
								<xsl:call-template name="formatDate">
91 127
									<xsl:with-param name="datename">startdate</xsl:with-param>
92 128
									<xsl:with-param name="datevalue" select="//column[@name = 'START_DATE']"></xsl:with-param>

Also available in: Unified diff