Revision 48139
Added by Alessia Bardi almost 7 years ago
snsf_2_db.xsl | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
3 | 3 |
|
4 |
<xsl:param name="parentDatasourceId" /> |
|
5 |
<xsl:param name="namespacePrefix" select="string('snsf_________')" /> |
|
6 |
|
|
4 |
<xsl:param name="parentDatasourceId"/> |
|
5 |
<xsl:param name="namespacePrefix" select="string('snsf_________')"/> |
|
6 |
<xsl:param name="quote">"</xsl:param> |
|
7 |
|
|
7 | 8 |
<xsl:template match="/"> |
8 | 9 |
<record> |
9 | 10 |
|
10 | 11 |
<xsl:copy-of select=".//*[local-name()='header']"/> |
11 | 12 |
<metadata> |
12 | 13 |
<ROWS> |
13 |
<xsl:if test="string-length(normalize-space(.//column[@name='Project Title'])) > 0 and string-length(normalize-space(.//column[@name='Project Number String'])) > 0">
|
|
14 |
|
|
15 |
<xsl:variable name="projectId" select="concat($namespacePrefix, '::', normalize-space(.//column[@name='Project Number String']))" />
|
|
16 |
|
|
17 |
<xsl:variable name="orgId" select="concat($namespacePrefix, '::', translate(normalize-space(.//column[@name='Institution']), ' ,.', '___'))" />
|
|
18 |
|
|
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 |
|
|
19 | 20 |
<xsl:variable name="startDate" select=".//column[@name='Start Date']"/> |
20 | 21 |
<xsl:variable name="endDate" select=".//column[@name='End Date']"/> |
21 |
|
|
22 |
|
|
22 | 23 |
<ROW table="projects"> |
23 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD> |
|
24 |
<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD> |
|
25 |
<FIELD name="code"><xsl:value-of select="normalize-space(.//column[@name='Project Number String'])"/></FIELD> |
|
26 |
<FIELD name="startdate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$startDate" /></FIELD> |
|
27 |
<FIELD name="enddate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$endDate"/></FIELD> |
|
28 |
<FIELD name="title"><xsl:value-of select=".//column[@name='Project Title']" /></FIELD> |
|
29 |
<FIELD name="acronym"> </FIELD> |
|
24 |
<FIELD name="_dnet_resource_identifier_"> |
|
25 |
<xsl:value-of select="$projectId"/> |
|
26 |
</FIELD> |
|
27 |
<FIELD name="id"> |
|
28 |
<xsl:value-of select="$projectId"/> |
|
29 |
</FIELD> |
|
30 |
<FIELD name="code"> |
|
31 |
<xsl:value-of select="normalize-space(.//column[@name='Project Number String'])"/> |
|
32 |
</FIELD> |
|
33 |
<FIELD name="startdate" type="date" format="dd.MM.yyyy"> |
|
34 |
<xsl:value-of select="$startDate"/> |
|
35 |
</FIELD> |
|
36 |
<FIELD name="enddate" type="date" format="dd.MM.yyyy"> |
|
37 |
<xsl:value-of select="$endDate"/> |
|
38 |
</FIELD> |
|
39 |
<FIELD name="title"> |
|
40 |
<xsl:value-of select=".//column[@name='Project Title']"/> |
|
41 |
</FIELD> |
|
42 |
<FIELD name="acronym"></FIELD> |
|
30 | 43 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
31 | 44 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
32 |
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD> |
|
45 |
<FIELD name="collectedfrom"> |
|
46 |
<xsl:value-of select="$parentDatasourceId"/> |
|
47 |
</FIELD> |
|
33 | 48 |
<!-- <FIELD name="???"><xsl:value-of select=".//AbstractNarration" /></FIELD> --> |
34 | 49 |
</ROW> |
35 |
|
|
50 |
|
|
36 | 51 |
<ROW table="organizations"> |
37 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD> |
|
38 |
<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD> |
|
39 |
<FIELD name="legalname"><xsl:value-of select=".//column[@name='Institution']" /></FIELD> |
|
40 |
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD> |
|
52 |
<FIELD name="_dnet_resource_identifier_"> |
|
53 |
<xsl:value-of select="$orgId"/> |
|
54 |
</FIELD> |
|
55 |
<FIELD name="id"> |
|
56 |
<xsl:value-of select="$orgId"/> |
|
57 |
</FIELD> |
|
58 |
<FIELD name="legalname"> |
|
59 |
<xsl:value-of select=".//column[@name='Institution']"/> |
|
60 |
</FIELD> |
|
61 |
<FIELD name="collectedfrom"> |
|
62 |
<xsl:value-of select="$parentDatasourceId"/> |
|
63 |
</FIELD> |
|
41 | 64 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
42 | 65 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
43 |
<FIELD name="optional1"><xsl:value-of select=".//column[@name='University']" /></FIELD> |
|
44 |
</ROW> |
|
66 |
<FIELD name="optional1"> |
|
67 |
<xsl:value-of select=".//column[@name='University']"/> |
|
68 |
</FIELD> |
|
69 |
</ROW> |
|
45 | 70 |
|
46 | 71 |
<!-- personId built from projectId to handle homonyms --> |
47 | 72 |
<xsl:variable name="personName" select="normalize-space(.//column[@name='Responsible Applicant'])"/> |
48 |
<xsl:variable name="personId" select="concat($projectId, '::', translate($personName, ' ,.', '___'))" />
|
|
49 |
|
|
73 |
<xsl:variable name="personId" select="concat($projectId, '::', translate($personName, ' ,.', '___'))"/> |
|
74 |
|
|
50 | 75 |
<xsl:if test="string-length($personName) > 0"> |
51 | 76 |
<ROW table="persons"> |
52 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$personId" /></FIELD> |
|
53 |
<FIELD name="id"><xsl:value-of select="$personId" /></FIELD> |
|
54 |
<FIELD name="firstname"><xsl:value-of select="$personName" /></FIELD> |
|
55 |
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD> |
|
77 |
<FIELD name="_dnet_resource_identifier_"> |
|
78 |
<xsl:value-of select="$personId"/> |
|
79 |
</FIELD> |
|
80 |
<FIELD name="id"> |
|
81 |
<xsl:value-of select="$personId"/> |
|
82 |
</FIELD> |
|
83 |
<FIELD name="firstname"> |
|
84 |
<xsl:value-of select="$personName"/> |
|
85 |
</FIELD> |
|
86 |
<FIELD name="collectedfrom"> |
|
87 |
<xsl:value-of select="$parentDatasourceId"/> |
|
88 |
</FIELD> |
|
56 | 89 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
57 | 90 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
58 | 91 |
</ROW> |
59 | 92 |
</xsl:if> |
60 |
|
|
93 |
|
|
61 | 94 |
<ROW table="project_organization"> |
62 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($projectId, '@@', $orgId)" /></FIELD> |
|
95 |
<FIELD name="_dnet_resource_identifier_"> |
|
96 |
<xsl:value-of select="concat($projectId, '@@', $orgId)"/> |
|
97 |
</FIELD> |
|
63 | 98 |
<FIELD name="participantnumber" type="int">1</FIELD> |
64 |
<FIELD name="startdate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$startDate" /></FIELD> |
|
65 |
<FIELD name="enddate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$endDate" /></FIELD> |
|
66 |
<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD> |
|
67 |
<FIELD name="resporganization"><xsl:value-of select="$orgId" /></FIELD> |
|
99 |
<FIELD name="startdate" type="date" format="dd.MM.yyyy"> |
|
100 |
<xsl:value-of select="$startDate"/> |
|
101 |
</FIELD> |
|
102 |
<FIELD name="enddate" type="date" format="dd.MM.yyyy"> |
|
103 |
<xsl:value-of select="$endDate"/> |
|
104 |
</FIELD> |
|
105 |
<FIELD name="project"> |
|
106 |
<xsl:value-of select="$projectId"/> |
|
107 |
</FIELD> |
|
108 |
<FIELD name="resporganization"> |
|
109 |
<xsl:value-of select="$orgId"/> |
|
110 |
</FIELD> |
|
68 | 111 |
<xsl:if test="string-length($personName) > 0"> |
69 |
<FIELD name="contactperson"><xsl:value-of select="concat($projectId, '::', translate($personName, ' ,.', '___'))" /></FIELD> |
|
112 |
<FIELD name="contactperson"> |
|
113 |
<xsl:value-of select="concat($projectId, '::', translate($personName, ' ,.', '___'))"/> |
|
114 |
</FIELD> |
|
70 | 115 |
</xsl:if> |
71 | 116 |
<FIELD name="semanticclass">coordinator</FIELD> |
72 | 117 |
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD> |
73 | 118 |
</ROW> |
74 |
|
|
75 |
<xsl:variable name="p0" select="normalize-space(.//column[@name='Funding Instrument Hierarchy'])" />
|
|
76 |
<xsl:variable name="p1" select="normalize-space(.//column[@name='Funding Instrument'])" />
|
|
77 |
|
|
119 |
|
|
120 |
<xsl:variable name="p0" select="normalize-space(.//column[@name='Funding Instrument Hierarchy'])"/>
|
|
121 |
<xsl:variable name="p1" select="normalize-space(.//column[@name='Funding Instrument'])"/> |
|
122 |
|
|
78 | 123 |
<xsl:variable name="fundingId"> |
79 | 124 |
<xsl:choose> |
80 | 125 |
<xsl:when test="(string-length($p0) > 0) and (string-length($p1) > 0)"> |
81 |
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p0, '::', $p1)" />
|
|
126 |
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p0, '::', $p1)"/> |
|
82 | 127 |
</xsl:when> |
83 | 128 |
<xsl:when test="string-length($p0) > 0"> |
84 |
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p0)" />
|
|
129 |
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p0)"/> |
|
85 | 130 |
</xsl:when> |
86 | 131 |
<xsl:when test="string-length($p1) > 0"> |
87 |
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p1)" />
|
|
132 |
<xsl:value-of select="concat($namespacePrefix, '::SNSF::', $p1)"/> |
|
88 | 133 |
</xsl:when> |
89 | 134 |
</xsl:choose> |
90 | 135 |
</xsl:variable> |
91 | 136 |
|
92 | 137 |
<ROW table="project_fundingpath"> |
93 |
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat(normalize-space($fundingId),'@@', $projectId)" /></FIELD> |
|
94 |
<FIELD name="funding"><xsl:value-of select="normalize-space($fundingId)" /></FIELD> |
|
95 |
<FIELD name="project"><xsl:value-of select="$projectId"/></FIELD> |
|
96 |
<FIELD name="startdate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$startDate"/></FIELD> |
|
97 |
<FIELD name="enddate" type="date" format="dd.MM.yyyy"><xsl:value-of select="$endDate"/></FIELD> |
|
138 |
<FIELD name="_dnet_resource_identifier_"> |
|
139 |
<xsl:value-of select="concat(normalize-space($fundingId),'@@', $projectId)"/> |
|
140 |
</FIELD> |
|
141 |
<FIELD name="funding"> |
|
142 |
<xsl:value-of select="normalize-space($fundingId)"/> |
|
143 |
</FIELD> |
|
144 |
<FIELD name="project"> |
|
145 |
<xsl:value-of select="$projectId"/> |
|
146 |
</FIELD> |
|
147 |
<FIELD name="startdate" type="date" format="dd.MM.yyyy"> |
|
148 |
<xsl:value-of select="$startDate"/> |
|
149 |
</FIELD> |
|
150 |
<FIELD name="enddate" type="date" format="dd.MM.yyyy"> |
|
151 |
<xsl:value-of select="$endDate"/> |
|
152 |
</FIELD> |
|
98 | 153 |
</ROW> |
99 |
|
|
154 |
|
|
100 | 155 |
</xsl:if> |
101 | 156 |
</ROWS> |
102 | 157 |
</metadata> |
103 | 158 |
</record> |
104 | 159 |
</xsl:template> |
105 | 160 |
|
106 |
</xsl:stylesheet> |
|
161 |
</xsl:stylesheet> |
Also available in: Unified diff
integrated (hopefully) all required changes from dnet40