Revision 48139
Added by Alessia Bardi almost 7 years ago
nwo_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" |
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" |
|
3 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
|
6 | 4 |
exclude-result-prefixes="xs" version="1.0"> |
7 | 5 |
|
8 |
<xsl:param name="parentDatasourceId" />
|
|
9 |
<xsl:param name="namespacePrefix" />
|
|
10 |
<xsl:param name="quote">"</xsl:param>
|
|
6 |
<xsl:param name="parentDatasourceId"/>
|
|
7 |
<xsl:param name="namespacePrefix"/>
|
|
8 |
<xsl:param name="quote">"</xsl:param>
|
|
11 | 9 |
|
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>
|
|
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>
|
|
17 | 15 |
|
18 | 16 |
|
19 |
<xsl:template match="/">
|
|
17 |
<xsl:template match="/">
|
|
20 | 18 |
|
21 |
<xsl:variable name="prefix" select="string('nwo_________')" />
|
|
19 |
<xsl:variable name="prefix" select="string('nwo_________')"/>
|
|
22 | 20 |
|
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/"> |
|
21 |
<record |
|
22 |
> |
|
27 | 23 |
|
28 |
<xsl:copy-of select=".//*[local-name()='header']" />
|
|
24 |
<xsl:copy-of select=".//*[local-name()='header']"/>
|
|
29 | 25 |
|
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> |
|
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 | 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> |
|
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> |
|
64 | 84 |
|
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> |
|
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> |
|
73 | 103 |
|
74 |
</ROWS>
|
|
75 |
</metadata>
|
|
76 |
</record>
|
|
77 |
</xsl:template>
|
|
104 |
</ROWS>
|
|
105 |
</metadata>
|
|
106 |
</record>
|
|
107 |
</xsl:template>
|
|
78 | 108 |
|
79 | 109 |
</xsl:stylesheet> |
Also available in: Unified diff
integrated (hopefully) all required changes from dnet40