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" xmlns:dc="http://purl.org/dc/elements/1.1/"
4
                xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
5
                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions"
6
                exclude-result-prefixes="xs" version="1.0">
7

    
8
    <xsl:param name="parentDatasourceId" />
9
    <xsl:param name="namespacePrefix" />
10
    <xsl:param name="quote">"</xsl:param>
11

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

    
18

    
19
    <xsl:template match="/">
20

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

    
23
        <record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
24
                xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dc="http://purl.org/dc/elements/1.1/"
25
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oaf="http://namespace.openaire.eu/oaf"
26
                xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
27

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

    
30
            <metadata>
31
                <ROWS>
32
                    <xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='ProjectID']))" />
33
                    <xsl:variable name="startDate" select=".//column[@name='Werk startdat']" />
34
                    <xsl:variable name="endDate" select=".//column[@name='Werk einddat']" />
35
                    <xsl:variable name="dossiernr">
36
                        <xsl:call-template name="getJson">
37
                            <xsl:with-param name="varName">dossiernr</xsl:with-param>
38
                            <xsl:with-param name="value"><xsl:value-of select=".//column[@name='Dossiernr']"/></xsl:with-param>
39
                        </xsl:call-template>
40
                    </xsl:variable>
41
                    <xsl:variable name="NWOgebied">
42
                        <xsl:call-template name="getJson">
43
                            <xsl:with-param name="varName">NWOgebied</xsl:with-param>
44
                            <xsl:with-param name="value"><xsl:value-of select=".//column[@name='NWO gebied']"/></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_"><xsl:value-of select="$projectId" /></FIELD>
53
                        <FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
54
                        <FIELD name="code"><xsl:value-of select=".//column[@name='ProjectID']" /></FIELD>
55
                        <FIELD name="title"><xsl:value-of select=".//column[@name='Proj titel']" /></FIELD>
56
                        <FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="$startDate" /></FIELD>
57
                        <FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="$endDate" /></FIELD>
58
                        <FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
59
                        <FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
60
                        <FIELD name="optional1"><xsl:value-of select=".//column[@name='Dossiernr']" /></FIELD>
61
                        <FIELD name="optional2"><xsl:value-of select=".//column[@name='NWO gebied']" /></FIELD>
62
                        <FIELD name="jsonextrainfo"><xsl:value-of select="$jsonExtra"/></FIELD>
63
                    </ROW>
64

    
65
                    <xsl:variable name="funderId" select="concat($prefix, '::NWO')" />
66
                    <ROW table="project_fundingpath">
67
                        <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($funderId, '@@', $projectId)" /></FIELD>
68
                        <FIELD name="funding"><xsl:value-of select="$funderId" /></FIELD>
69
                        <FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
70
                        <FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="$startDate" /></FIELD>
71
                        <FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="$endDate" /></FIELD>
72
                    </ROW>
73

    
74
                </ROWS>
75
            </metadata>
76
        </record>
77
    </xsl:template>
78

    
79
</xsl:stylesheet>
(16-16/26)