Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
                exclude-result-prefixes="xs" version="1.0">
5

    
6
	<xsl:param name="parentDatasourceId"/>
7
	<xsl:param name="namespacePrefix"/>
8
	<xsl:param name="quote">"</xsl:param>
9

    
10
	<xsl:template name="getJson">
11
		<xsl:param name="varName"/>
12
		<xsl:param name="value"/>
13
		<xsl:value-of select="concat($quote, $varName, $quote, ':', $quote, $value, $quote)"/>
14
	</xsl:template>
15

    
16

    
17
	<xsl:template match="/">
18

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

    
21
		<record
22
		>
23

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

    
26
			<metadata>
27
				<ROWS>
28
					<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='ProjectID']))"/>
29
					<xsl:variable name="startDate" select=".//column[@name='Werk startdat']"/>
30
					<xsl:variable name="endDate" select=".//column[@name='Werk einddat']"/>
31
					<xsl:variable name="dossiernr">
32
						<xsl:call-template name="getJson">
33
							<xsl:with-param name="varName">dossiernr</xsl:with-param>
34
							<xsl:with-param name="value">
35
								<xsl:value-of select=".//column[@name='Dossiernr']"/>
36
							</xsl:with-param>
37
						</xsl:call-template>
38
					</xsl:variable>
39
					<xsl:variable name="NWOgebied">
40
						<xsl:call-template name="getJson">
41
							<xsl:with-param name="varName">NWOgebied</xsl:with-param>
42
							<xsl:with-param name="value">
43
								<xsl:value-of select=".//column[@name='NWO gebied']"/>
44
							</xsl:with-param>
45
						</xsl:call-template>
46
					</xsl:variable>
47

    
48
					<xsl:variable name="jsonExtra">
49
						<xsl:value-of select="concat('{', $dossiernr, ',', $NWOgebied, '}')"/>
50
					</xsl:variable>
51
					<ROW table="projects">
52
						<FIELD name="_dnet_resource_identifier_">
53
							<xsl:value-of select="$projectId"/>
54
						</FIELD>
55
						<FIELD name="id">
56
							<xsl:value-of select="$projectId"/>
57
						</FIELD>
58
						<FIELD name="code">
59
							<xsl:value-of select=".//column[@name='ProjectID']"/>
60
						</FIELD>
61
						<FIELD name="title">
62
							<xsl:value-of select=".//column[@name='Proj titel']"/>
63
						</FIELD>
64
						<FIELD name="startdate" type="date" format="dd/MM/yyyy">
65
							<xsl:value-of select="$startDate"/>
66
						</FIELD>
67
						<FIELD name="enddate" type="date" format="dd/MM/yyyy">
68
							<xsl:value-of select="$endDate"/>
69
						</FIELD>
70
						<FIELD name="collectedfrom">
71
							<xsl:value-of select="$parentDatasourceId"/>
72
						</FIELD>
73
						<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
74
						<FIELD name="optional1">
75
							<xsl:value-of select=".//column[@name='Dossiernr']"/>
76
						</FIELD>
77
						<FIELD name="optional2">
78
							<xsl:value-of select=".//column[@name='NWO gebied']"/>
79
						</FIELD>
80
						<FIELD name="jsonextrainfo">
81
							<xsl:value-of select="$jsonExtra"/>
82
						</FIELD>
83
					</ROW>
84

    
85
					<xsl:variable name="funderId" select="concat($prefix, '::NWO')"/>
86
					<ROW table="project_fundingpath">
87
						<FIELD name="_dnet_resource_identifier_">
88
							<xsl:value-of select="concat($funderId, '@@', $projectId)"/>
89
						</FIELD>
90
						<FIELD name="funding">
91
							<xsl:value-of select="$funderId"/>
92
						</FIELD>
93
						<FIELD name="project">
94
							<xsl:value-of select="$projectId"/>
95
						</FIELD>
96
						<FIELD name="startdate" type="date" format="dd/MM/yyyy">
97
							<xsl:value-of select="$startDate"/>
98
						</FIELD>
99
						<FIELD name="enddate" type="date" format="dd/MM/yyyy">
100
							<xsl:value-of select="$endDate"/>
101
						</FIELD>
102
					</ROW>
103

    
104
				</ROWS>
105
			</metadata>
106
		</record>
107
	</xsl:template>
108

    
109
</xsl:stylesheet>
(18-18/29)