1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="5a4dd0b9-412c-4b67-a2df-c376070f680e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2018-06-04T11:15:30+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<IMPORTED/>
|
12
|
<SCRIPT>
|
13
|
<TITLE>ANR to DB</TITLE>
|
14
|
<CODE>
|
15
|
<![CDATA[
|
16
|
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
17
|
xmlns:utils="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions">
|
18
|
|
19
|
<xsl:param name="varDataSourceId"/>
|
20
|
<xsl:variable name="namespacePrefix" select="string('anr_________')"/>
|
21
|
|
22
|
<!--<xsl:variable name="dateFormat" select="string('dd-MM-yyyy')"/>-->
|
23
|
<xsl:variable name="funderID" select="concat($namespacePrefix, '::ANR')"/>
|
24
|
|
25
|
<!--<xsl:variable name="fundingId">
|
26
|
<xsl:value-of
|
27
|
select="concat($funderID, '::', translate(.//column[@name = 'FUNDING STREAM'], ' ', ''))"
|
28
|
/>
|
29
|
</xsl:variable>
|
30
|
-->
|
31
|
<xsl:variable name="fundingId">
|
32
|
<xsl:value-of select="$funderID"/>
|
33
|
</xsl:variable>
|
34
|
<xsl:variable name="quot">"</xsl:variable>
|
35
|
<xsl:variable name="Id">
|
36
|
<xsl:value-of select="normalize-space(.//column[@isID='true'])"/>
|
37
|
</xsl:variable>
|
38
|
<xsl:template name="terminate">
|
39
|
<xsl:message terminate="yes"> record is not compliant, transformation is
|
40
|
interrupted. </xsl:message>
|
41
|
</xsl:template>
|
42
|
<xsl:template match="/">
|
43
|
<xsl:choose>
|
44
|
<xsl:when test=".//column[@name = 'TitreUk (SIM et autres sources complémentaires)'] | .//column[@name = 'TitreFr (SIM et autres sources complémentaires)'] | .//column[@name = 'Projet Nom Complet'] | .//column[@name = 'Acronyme (SIM)'] | .//column[@name = 'Acronyme']">
|
45
|
<record>
|
46
|
|
47
|
<xsl:copy-of select=".//*[local-name() = 'header']"/>
|
48
|
|
49
|
<metadata>
|
50
|
<ROWS>
|
51
|
<xsl:variable name="projectId"
|
52
|
select="concat($namespacePrefix, '::', $Id)"/>
|
53
|
<!-- <xsl:variable name="startDate"
|
54
|
select="replace(.//column[@name = 'PROJECT STARTING DATE'], '/', '-')"/>
|
55
|
<xsl:variable name="endDate"
|
56
|
select="replace(.//column[@name = 'PROJECT COMPLETION DATE'], '/', '-')"/>
|
57
|
-->
|
58
|
|
59
|
<ROW table="projects">
|
60
|
<FIELD name="_dnet_resource_identifier_">
|
61
|
<xsl:value-of select="$projectId"/>
|
62
|
</FIELD>
|
63
|
<FIELD name="id">
|
64
|
<xsl:value-of select="$projectId"/>
|
65
|
</FIELD>
|
66
|
<FIELD name="code">
|
67
|
<xsl:value-of
|
68
|
select="$Id"/>
|
69
|
</FIELD>
|
70
|
<xsl:choose>
|
71
|
<xsl:when test=".//column[@name = 'TitreUk (SIM et autres sources complémentaires)']">
|
72
|
<FIELD name="title">
|
73
|
<xsl:value-of select=".//column[@name = 'TitreUk (SIM et autres sources complémentaires)']"/>
|
74
|
</FIELD>
|
75
|
</xsl:when>
|
76
|
<xsl:when test=".//column[@name = 'TitreFr (SIM et autres sources complémentaires)']">
|
77
|
<FIELD name="title">
|
78
|
<xsl:value-of select=".//column[@name = 'TitreFr (SIM et autres sources complémentaires)']"/>
|
79
|
</FIELD>
|
80
|
</xsl:when>
|
81
|
<xsl:when test=".//column[@name = 'Projet Nom Complet']">
|
82
|
<FIELD name="title">
|
83
|
<xsl:value-of select=".//column[@name = 'Projet Nom Complet']"/>
|
84
|
</FIELD>
|
85
|
</xsl:when>
|
86
|
<xsl:otherwise>
|
87
|
<FIELD name="title">
|
88
|
<xsl:value-of select=".//column[@name = 'Acronyme (SIM)'] | .//column[@name = 'Acronyme']"/>
|
89
|
</FIELD>
|
90
|
</xsl:otherwise>
|
91
|
</xsl:choose>
|
92
|
|
93
|
|
94
|
<FIELD name="acronym">
|
95
|
<xsl:value-of select=".//column[@name = 'Acronyme (SIM)'] | .//column[@name = 'Acronyme']"/>
|
96
|
</FIELD>
|
97
|
<!-- <FIELD name="startdate" type="date" format="{$dateFormat}">
|
98
|
<xsl:value-of select="$startDate"/>
|
99
|
</FIELD>
|
100
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
101
|
<xsl:value-of select="$endDate"/>
|
102
|
</FIELD>-->
|
103
|
|
104
|
<FIELD name="collectedfrom">
|
105
|
<xsl:value-of select="$varDataSourceId"/>
|
106
|
</FIELD>
|
107
|
<FIELD name="provenanceactionclass"
|
108
|
>sysimport:crosswalk:entityregistry</FIELD>
|
109
|
<FIELD name="provenanceactionscheme">dnet:provenanceActions</FIELD>
|
110
|
<FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
|
111
|
<FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
|
112
|
</ROW>
|
113
|
<ROW table="project_fundingpath">
|
114
|
<FIELD name="_dnet_resource_identifier_">
|
115
|
<xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
|
116
|
</FIELD>
|
117
|
<FIELD name="funding">
|
118
|
<xsl:value-of select="$fundingId"/>
|
119
|
</FIELD>
|
120
|
<FIELD name="project">
|
121
|
<xsl:value-of select="$projectId"/>
|
122
|
</FIELD>
|
123
|
<!-- <FIELD name="startdate" type="date" format="{$dateFormat}">
|
124
|
<xsl:value-of select="$startDate"/>
|
125
|
</FIELD>
|
126
|
<FIELD name="enddate" type="date" format="{$dateFormat}">
|
127
|
<xsl:value-of select="$endDate"/>
|
128
|
</FIELD> -->
|
129
|
</ROW>
|
130
|
|
131
|
</ROWS>
|
132
|
</metadata>
|
133
|
</record>
|
134
|
</xsl:when>
|
135
|
<xsl:otherwise>
|
136
|
<xsl:call-template name="terminate"></xsl:call-template>
|
137
|
</xsl:otherwise>
|
138
|
</xsl:choose>
|
139
|
|
140
|
</xsl:template>
|
141
|
</xsl:stylesheet>
|
142
|
]]>
|
143
|
</CODE>
|
144
|
</SCRIPT>
|
145
|
</CONFIGURATION>
|
146
|
<STATUS/>
|
147
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
148
|
</BODY>
|
149
|
</RESOURCE_PROFILE>
|