Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="e29e2faf-9ae1-42c3-a722-3e7a116886b6_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2018-06-04T11:15:30+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>FCT to DB</TITLE>
14
				<CODE>
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
17
                exclude-result-prefixes="xs" version="2.0">
18

    
19
	<xsl:param name="varDataSourceId"/>
20
	<xsl:variable name="namespacePrefix" select="string('fct_________')"/>
21

    
22
	<xsl:variable name="invalid" select="' ,-'"/>
23
	<xsl:variable name="valid" select="'___'"/>
24

    
25
	<xsl:variable name="prefix" select="string('fct_________')"/>
26
	<xsl:variable name="funderID" select="concat($prefix, '::FCT')"/>
27

    
28
	<xsl:template match="/">
29
		<record>
30
			<xsl:copy-of select=".//*[local-name()='header']"/>
31
			<metadata>
32
				<ROWS>
33
					<xsl:for-each select="//project">
34
						<xsl:call-template name="projectTemplate"/>
35
					</xsl:for-each>
36
				</ROWS>
37
			</metadata>
38

    
39
		</record>
40
	</xsl:template>
41

    
42
	<xsl:template name="projectTemplate">
43

    
44
		<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  ./id)"/>
45
		<xsl:variable name="projectAcronym" select="./reference"/>
46
		<xsl:variable name="tokens" select="tokenize(./reference,'/')"/>
47
		<xsl:variable name="callID" select="concat($tokens[1], '/', $tokens[last()])"/>
48

    
49
		<ROW table="projects">
50
			<FIELD name="_dnet_resource_identifier_">
51
				<xsl:value-of select="$projectId"/>
52
			</FIELD>
53
			<FIELD name="id">
54
				<xsl:value-of select="$projectId"/>
55
			</FIELD>
56
			<FIELD name="code">
57
				<xsl:value-of select="./id"/>
58
			</FIELD>
59
			<FIELD name="call_identifier">
60
				<xsl:value-of select="$callID"/>
61
			</FIELD>
62
			<FIELD name="websiteurl">
63
				<xsl:value-of select="./refUri"/>
64
			</FIELD>
65
			<FIELD name="acronym">
66
				<xsl:value-of select="./reference"/>
67
			</FIELD>
68
			<FIELD name="title">
69
				<xsl:value-of select="./name"/>
70
			</FIELD>
71
			<FIELD name="startdate" type="date" format="dd/MM/yyyy">
72
				<xsl:value-of select="./startDate"/>
73
			</FIELD>
74
			<FIELD name="enddate" type="date" format="dd/MM/yyyy">
75
				<xsl:value-of select="./endDate"/>
76
			</FIELD>
77
			<FIELD name="keywords">
78
				<xsl:for-each select="./classification/elem">
79
					<xsl:if test="position() &gt; 1">,</xsl:if>
80
					<xsl:value-of select="."/>
81
				</xsl:for-each>
82
			</FIELD>
83
			<FIELD name="collectedfrom">
84
				<xsl:value-of select="$varDataSourceId"/>
85
			</FIELD>
86
			<FIELD name="contracttypeclass">UNKNOWN</FIELD>
87
			<FIELD name="contracttypescheme">fct:contractTypes</FIELD>
88
			<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
89
			<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
90
			<xsl:if test="string-length(normalize-space(./oaMandate)) &gt; 0">
91
				<FIELD name="oa_mandate_for_publications" type="boolean">
92
					<xsl:value-of select="./oaMandate"/>
93
				</FIELD>
94
			</xsl:if>
95
			<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
96
		</ROW>
97

    
98
		<xsl:for-each select="./funding">
99
			<xsl:variable name="p1" select="normalize-space(./program)"/>
100
			<xsl:variable name="p2" select="normalize-space(./program2)"/>
101

    
102
			<xsl:variable name="tmpFundingId">
103
				<xsl:choose>
104
					<xsl:when test="string-length($p1) &gt; 0 and string-length($p2) &gt; 0">
105
						<xsl:value-of select="concat($funderID, '::', $p1, '::', $p2)"/>
106
					</xsl:when>
107
					<xsl:when test="string-length($p1) &gt; 0">
108
						<xsl:value-of select="concat($funderID, '::', $p1)"/>
109
					</xsl:when>
110
					<xsl:otherwise></xsl:otherwise>
111
				</xsl:choose>
112
			</xsl:variable>
113

    
114
			<xsl:variable name="fundingId" select="normalize-space($tmpFundingId)"/>
115

    
116
			<xsl:if test="string-length($fundingId) &gt; 0">
117
				<ROW table="project_fundingpath">
118
					<FIELD name="_dnet_resource_identifier_">
119
						<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
120
					</FIELD>
121
					<FIELD name="funding">
122
						<xsl:value-of select="$fundingId"/>
123
					</FIELD>
124
					<FIELD name="project">
125
						<xsl:value-of select="$projectId"/>
126
					</FIELD>
127
					<FIELD name="startdate" type="date" format="dd/MM/yyyy">
128
						<xsl:value-of select="../startDate"/>
129
					</FIELD>
130
					<FIELD name="enddate" type="date" format="dd/MM/yyyy">
131
						<xsl:value-of select="../endDate"/>
132
					</FIELD>
133
					<FIELD name="optional1">
134
						<xsl:value-of select="./amount"/>
135
					</FIELD>
136
					<FIELD name="optional2">
137
						<xsl:value-of select="./dateAwarded"/>
138
					</FIELD>
139
				</ROW>
140
			</xsl:if>
141
		</xsl:for-each>
142

    
143
	</xsl:template>
144
</xsl:stylesheet>
145
				</CODE>
146
			</SCRIPT>
147
		</CONFIGURATION>
148
		<STATUS/>
149
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
150
	</BODY>
151
</RESOURCE_PROFILE>
(9-9/22)