Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="6455a552-0cf2-4011-b82e-258d485ab4ff_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>NWO 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="1.0">
19

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

    
24
	<xsl:template name="getJson">
25
		<xsl:param name="varName"/>
26
		<xsl:param name="value"/>
27
		<xsl:value-of select="concat($quote, $varName, $quote, ':', $quote, $value, $quote)"/>
28
	</xsl:template>
29

    
30

    
31
	<xsl:template match="/">
32

    
33
		<xsl:variable name="prefix" select="string('nwo_________')"/>
34

    
35
		<record>
36

    
37
			<xsl:copy-of select=".//*[local-name()='header']"/>
38

    
39
			<metadata>
40
				<ROWS>
41
					<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='ProjectID']))"/>
42
					<xsl:variable name="startDate" select=".//column[@name='Werk startdat']"/>
43
					<xsl:variable name="endDate" select=".//column[@name='Werk einddat']"/>
44
					<xsl:variable name="dossiernr">
45
						<xsl:call-template name="getJson">
46
							<xsl:with-param name="varName">dossiernr</xsl:with-param>
47
							<xsl:with-param name="value">
48
								<xsl:value-of select=".//column[@name='Dossiernr']"/>
49
							</xsl:with-param>
50
						</xsl:call-template>
51
					</xsl:variable>
52
					<xsl:variable name="NWOgebied">
53
						<xsl:call-template name="getJson">
54
							<xsl:with-param name="varName">NWOgebied</xsl:with-param>
55
							<xsl:with-param name="value">
56
								<xsl:value-of select=".//column[@name='NWO gebied']"/>
57
							</xsl:with-param>
58
						</xsl:call-template>
59
					</xsl:variable>
60

    
61
					<xsl:variable name="jsonExtra">
62
						<xsl:value-of select="concat('{', $dossiernr, ',', $NWOgebied, '}')"/>
63
					</xsl:variable>
64
					<ROW table="projects">
65
						<FIELD name="_dnet_resource_identifier_">
66
							<xsl:value-of select="$projectId"/>
67
						</FIELD>
68
						<FIELD name="id">
69
							<xsl:value-of select="$projectId"/>
70
						</FIELD>
71
						<FIELD name="code">
72
							<xsl:value-of select=".//column[@name='ProjectID']"/>
73
						</FIELD>
74
						<FIELD name="title">
75
							<xsl:value-of select=".//column[@name='Proj titel']"/>
76
						</FIELD>
77
						<FIELD name="startdate" type="date" format="dd/MM/yyyy">
78
							<xsl:value-of select="$startDate"/>
79
						</FIELD>
80
						<FIELD name="enddate" type="date" format="dd/MM/yyyy">
81
							<xsl:value-of select="$endDate"/>
82
						</FIELD>
83
						<FIELD name="collectedfrom">
84
							<xsl:value-of select="$varDataSourceId"/>
85
						</FIELD>
86
						<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
87
						<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
88
						<FIELD name="optional1">
89
							<xsl:value-of select=".//column[@name='Dossiernr']"/>
90
						</FIELD>
91
						<FIELD name="optional2">
92
							<xsl:value-of select=".//column[@name='NWO gebied']"/>
93
						</FIELD>
94
						<FIELD name="jsonextrainfo">
95
							<xsl:value-of select="$jsonExtra"/>
96
						</FIELD>
97
						<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
98
					</ROW>
99

    
100
					<xsl:variable name="funderId" select="concat($prefix, '::NWO')"/>
101
					<ROW table="project_fundingpath">
102
						<FIELD name="_dnet_resource_identifier_">
103
							<xsl:value-of select="concat($funderId, '@@', $projectId)"/>
104
						</FIELD>
105
						<FIELD name="funding">
106
							<xsl:value-of select="$funderId"/>
107
						</FIELD>
108
						<FIELD name="project">
109
							<xsl:value-of select="$projectId"/>
110
						</FIELD>
111
						<FIELD name="startdate" type="date" format="dd/MM/yyyy">
112
							<xsl:value-of select="$startDate"/>
113
						</FIELD>
114
						<FIELD name="enddate" type="date" format="dd/MM/yyyy">
115
							<xsl:value-of select="$endDate"/>
116
						</FIELD>
117
					</ROW>
118

    
119
				</ROWS>
120
			</metadata>
121
		</record>
122
	</xsl:template>
123

    
124
</xsl:stylesheet>
125
]]>
126
				</CODE>
127
			</SCRIPT>
128
		</CONFIGURATION>
129
		<STATUS/>
130
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
131
	</BODY>
132
</RESOURCE_PROFILE>
(17-17/26)