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
					<![CDATA[
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
18
                exclude-result-prefixes="xs" version="2.0">
19

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

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

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

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

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

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

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

    
50
		<ROW table="projects">
51
			<FIELD name="_dnet_resource_identifier_">
52
				<xsl:value-of select="$projectId"/>
53
			</FIELD>
54
			<FIELD name="id">
55
				<xsl:value-of select="$projectId"/>
56
			</FIELD>
57
			<FIELD name="code">
58
				<xsl:value-of select="./id"/>
59
			</FIELD>
60
			<FIELD name="call_identifier">
61
				<xsl:value-of select="$callID"/>
62
			</FIELD>
63
			<FIELD name="websiteurl">
64
				<xsl:value-of select="./refUri"/>
65
			</FIELD>
66
			<FIELD name="acronym">
67
				<xsl:value-of select="./reference"/>
68
			</FIELD>
69
			<FIELD name="title">
70
				<xsl:value-of select="./name"/>
71
			</FIELD>
72
			<FIELD name="startdate" type="date" format="dd/MM/yyyy">
73
				<xsl:value-of select="./startDate"/>
74
			</FIELD>
75
			<FIELD name="enddate" type="date" format="dd/MM/yyyy">
76
				<xsl:value-of select="./endDate"/>
77
			</FIELD>
78
			<FIELD name="keywords">
79
				<xsl:for-each select="./classification/elem">
80
					<xsl:if test="position() &gt; 1">,</xsl:if>
81
					<xsl:value-of select="."/>
82
				</xsl:for-each>
83
			</FIELD>
84
			<FIELD name="collectedfrom">
85
				<xsl:value-of select="$varDataSourceId"/>
86
			</FIELD>
87

    
88

    
89
			<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
90
			<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
91
			<xsl:if test="string-length(normalize-space(./oaMandate)) &gt; 0">
92
				<FIELD name="oa_mandate_for_publications" type="boolean">
93
					<xsl:value-of select="./oaMandate"/>
94
				</FIELD>
95
			</xsl:if>
96
			<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
97
		</ROW>
98

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

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

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

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

    
144
	</xsl:template>
145
</xsl:stylesheet>
146
]]>
147
				</CODE>
148
			</SCRIPT>
149
		</CONFIGURATION>
150
		<STATUS/>
151
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
152
	</BODY>
153
</RESOURCE_PROFILE>
(11-11/29)