Project

General

Profile

« Previous | Next » 

Revision 48738

Transformation for Tubitak funder

View differences:

modules/dnet-openaireplus-workflows/trunk/src/main/resources/eu/dnetlib/msro/openaireplus/workflows/repo-hi/xslt/tubitakf_2_db.xsl
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"
4
				exclude-result-prefixes="xs" version="2.0">
5

  
6
	<xsl:param name="parentDatasourceId"/>
7
	<xsl:variable name="namespacePrefix" select="xs:string('tubitakf____')"/>
8
	<xsl:param name="quote">"</xsl:param>
9

  
10
	<xsl:variable name="funderID" select="concat('tubitakf_____', '::tubitak')"/>
11

  
12

  
13
	<xsl:variable name="stream" select="normalize-space(.//column[@name='FUNDING STREAM(S)'])"/>
14
	<xsl:variable name="fundingID">
15
		<xsl:choose>
16
			<xsl:when test="string-length($stream) &gt; 0">
17
				<xsl:value-of select="concat($funderID, '::', $stream)"/>
18
			</xsl:when>
19
			<xsl:otherwise>
20
				<xsl:value-of select="$funderID"/>
21
			</xsl:otherwise>
22
		</xsl:choose>
23
	</xsl:variable>
24

  
25
	<xsl:variable name="projectId" select="concat($namespacePrefix, '::',  normalize-space(.//column[@name='PROJECT IDENTIFIER']))"/>
26

  
27

  
28
	<xsl:variable name="startDate" select="translate(.//column[@name='START DATE'],'/\','--')"/>
29
	<xsl:variable name="endDate" select="translate(.//column[@name='END DATE'],'/\','--')"/>
30

  
31
	<xsl:variable name="dateFormat" select="string('dd-MM-yyyy')"/>
32
	<xsl:variable name="projectTitle" select="normalize-space(.//column[@name='PROJECT TITLE or ACRONYM'])"/>
33

  
34
	<xsl:template match="/">
35
		<record>
36

  
37
			<xsl:copy-of select=".//*[local-name()='header']"/>
38
			<metadata>
39
				<ROWS>
40
					<xsl:if test="string-length($projectTitle) &gt; 0 and string-length($projectId) &gt; 0">
41
						<ROW table="projects">
42
							<FIELD name="_dnet_resource_identifier_">
43
								<xsl:value-of select="$projectId"/>
44
							</FIELD>
45
							<FIELD name="id">
46
								<xsl:value-of select="$projectId"/>
47
							</FIELD>
48
							<FIELD name="code">
49
								<xsl:value-of select="normalize-space(.//column[@name='PROJECT IDENTIFIER'])"/>
50
							</FIELD>
51
							<FIELD name="startdate" type="date" format="{$dateFormat}">
52
								<xsl:value-of select="$startDate"/>
53
							</FIELD>
54
							<FIELD name="enddate" type="date" format="{$dateFormat}">
55
								<xsl:value-of select="$endDate"/>
56
							</FIELD>
57
							<FIELD name="title">
58
								<xsl:value-of select="$projectTitle"/>
59
							</FIELD>
60

  
61

  
62
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
63
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
64
							<FIELD name="collectedfrom">
65
								<xsl:value-of select="$parentDatasourceId"/>
66
							</FIELD>
67

  
68
							<FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
69

  
70
						</ROW>
71
					</xsl:if>
72
					<ROW table="project_fundingpath">
73
						<FIELD name="_dnet_resource_identifier_">
74
							<xsl:value-of select="concat($fundingID,'@@', $projectId)"/>
75
						</FIELD>
76
						<FIELD name="funding">
77
							<xsl:value-of select="$fundingID"/>
78
						</FIELD>
79
						<FIELD name="project">
80
							<xsl:value-of select="$projectId"/>
81
						</FIELD>
82
						<FIELD name="startdate" type="date" format="{$dateFormat}">
83
							<xsl:value-of select="$startDate"/>
84
						</FIELD>
85
						<FIELD name="enddate" type="date" format="{$dateFormat}">
86
							<xsl:value-of select="$endDate"/>
87
						</FIELD>
88
					</ROW>
89

  
90

  
91
				</ROWS>
92
			</metadata>
93
		</record>
94
	</xsl:template>
95
</xsl:stylesheet>

Also available in: Unified diff