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
			<xsl:copy-of select=".//*[local-name()='header']"/>
24

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

    
47
					<xsl:variable name="jsonExtra">
48
						<xsl:value-of select="concat('{', $dossiernr, ',', $NWOgebied, '}')"/>
49
					</xsl:variable>
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=".//column[@name='ProjectID']"/>
59
						</FIELD>
60
						<FIELD name="title">
61
							<xsl:value-of select=".//column[@name='Proj titel']"/>
62
						</FIELD>
63
						<FIELD name="startdate" type="date" format="dd/MM/yyyy">
64
							<xsl:value-of select="$startDate"/>
65
						</FIELD>
66
						<FIELD name="enddate" type="date" format="dd/MM/yyyy">
67
							<xsl:value-of select="$endDate"/>
68
						</FIELD>
69
						<FIELD name="collectedfrom">
70
							<xsl:value-of select="$parentDatasourceId"/>
71
						</FIELD>
72
						<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
73
						<FIELD name="provenanceActionScheme">dnet:provenanceActions</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>
(20-20/31)