1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
3
|
|
4
|
<xsl:param name="parentDatasourceId" />
|
5
|
<xsl:param name="namespacePrefix" select="string('snsf_________')" />
|
6
|
<xsl:param name="quote">"</xsl:param>
|
7
|
|
8
|
<xsl:template match="/">
|
9
|
<record>
|
10
|
|
11
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
12
|
<metadata>
|
13
|
<ROWS>
|
14
|
<xsl:if test="string-length(normalize-space(.//column[@name='Project Title'])) > 0 and string-length(normalize-space(.//column[@name='Project Number'])) > 0">
|
15
|
|
16
|
<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(.//column[@name='Project Number']))" />
|
17
|
|
18
|
<xsl:variable name="orgId" select="concat($namespacePrefix, '::', translate(normalize-space(.//column[@name='Institution']), ' ,.', '___'))" />
|
19
|
|
20
|
<xsl:variable name="startDate" select=".//column[@name='Start Date']"/>
|
21
|
<xsl:variable name="endDate" select=".//column[@name='End Date']"/>
|
22
|
|
23
|
<ROW table="projects">
|
24
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
|
25
|
<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
|
26
|
<FIELD name="code"><xsl:value-of select="normalize-space(.//column[@name='Project Number String'])"/></FIELD>
|
27
|
<FIELD name="startdate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
28
|
<FIELD name="enddate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$endDate"/></FIELD>
|
29
|
<FIELD name="title"><xsl:value-of select=".//column[@name='Project Title']" /></FIELD>
|
30
|
<FIELD name="acronym"> </FIELD>
|
31
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
32
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
33
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
34
|
<!-- <FIELD name="???"><xsl:value-of select=".//AbstractNarration" /></FIELD> -->
|
35
|
</ROW>
|
36
|
|
37
|
<ROW table="organizations">
|
38
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD>
|
39
|
<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD>
|
40
|
<FIELD name="legalname"><xsl:value-of select=".//column[@name='Institution']" /></FIELD>
|
41
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
42
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
43
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
44
|
<FIELD name="optional1"><xsl:value-of select=".//column[@name='University']" /></FIELD>
|
45
|
</ROW>
|
46
|
|
47
|
<!-- personId built from projectId to handle homonyms -->
|
48
|
<xsl:variable name="personName" select="normalize-space(.//column[@name='Responsible Applicant'])"/>
|
49
|
<xsl:variable name="personId" select="concat($projectId, '::', translate($personName, ' ,.', '___'))" />
|
50
|
|
51
|
<xsl:if test="string-length($personName) > 0">
|
52
|
<ROW table="persons">
|
53
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personId" /></FIELD>
|
54
|
<FIELD name="id"><xsl:value-of select="$personId" /></FIELD>
|
55
|
<FIELD name="firstname"><xsl:value-of select="$personName" /></FIELD>
|
56
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
57
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
58
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
59
|
</ROW>
|
60
|
</xsl:if>
|
61
|
|
62
|
<ROW table="project_organization">
|
63
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($projectId, '@@', $orgId)" /></FIELD>
|
64
|
<FIELD name="participantnumber" type="int">1</FIELD>
|
65
|
<FIELD name="startdate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$startDate" /></FIELD>
|
66
|
<FIELD name="enddate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$endDate" /></FIELD>
|
67
|
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
|
68
|
<FIELD name="resporganization"><xsl:value-of select="$orgId" /></FIELD>
|
69
|
<xsl:if test="string-length($personName) > 0">
|
70
|
<FIELD name="contactperson"><xsl:value-of select="concat($projectId, '::', translate($personName, ' ,.', '___'))" /></FIELD>
|
71
|
</xsl:if>
|
72
|
<FIELD name="semanticclass">coordinator</FIELD>
|
73
|
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD>
|
74
|
</ROW>
|
75
|
|
76
|
<xsl:variable name="p0" select="normalize-space(.//column[@name='Funding Instrument Hierarchy'])" />
|
77
|
<xsl:variable name="p1" select="normalize-space(.//column[@name='Funding Instrument'])" />
|
78
|
|
79
|
<xsl:variable name="fundingId">
|
80
|
<xsl:choose>
|
81
|
<xsl:when test="(string-length($p0) > 0) and (string-length($p1) > 0)">
|
82
|
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p0, '::', $p1)" />
|
83
|
</xsl:when>
|
84
|
<xsl:when test="string-length($p0) > 0">
|
85
|
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p0)" />
|
86
|
</xsl:when>
|
87
|
<xsl:when test="string-length($p1) > 0">
|
88
|
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p1)" />
|
89
|
</xsl:when>
|
90
|
</xsl:choose>
|
91
|
</xsl:variable>
|
92
|
|
93
|
<ROW table="project_fundingpath">
|
94
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat(normalize-space($fundingId),'@@', $projectId)" /></FIELD>
|
95
|
<FIELD name="funding"><xsl:value-of select="normalize-space($fundingId)" /></FIELD>
|
96
|
<FIELD name="project"><xsl:value-of select="$projectId"/></FIELD>
|
97
|
<FIELD name="startdate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$startDate"/></FIELD>
|
98
|
<FIELD name="enddate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$endDate"/></FIELD>
|
99
|
</ROW>
|
100
|
|
101
|
</xsl:if>
|
102
|
</ROWS>
|
103
|
</metadata>
|
104
|
</record>
|
105
|
</xsl:template>
|
106
|
|
107
|
</xsl:stylesheet>
|