Project

General

Profile

« Previous | Next » 

Revision 44658

WT transformation adds alias project code in jsonextrainfo and remove the UNKNOWN funding path

View differences:

modules/dnet-openaireplus-workflows/trunk/src/main/resources/eu/dnetlib/msro/openaireplus/workflows/repo-hi/xslt/wellcometrust_2_db_NEW.xsl
1 1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
3
>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4 3

  
5 4
	<xsl:param name="parentDatasourceId"/>
6 5
	<xsl:param name="namespacePrefix"/>
6
	<xsl:param name="quote">"</xsl:param>
7 7

  
8 8
	<xsl:variable name="funderID" select="concat($namespacePrefix, '::WT')"/>
9 9

  
10
	<xsl:variable name="fundingIDtemp">
10
	<xsl:variable name="fundingID">
11 11
		<xsl:choose>
12 12
			<xsl:when test="string-length(normalize-space(.//Grant/Stream)) &gt; 0">
13 13
				<xsl:value-of select="concat($funderID, '::', normalize-space(.//Grant/Stream))"/>
14 14
			</xsl:when>
15 15
			<xsl:otherwise>
16
				<xsl:value-of select="concat($funderID, '::UNKNOWN')"/>
16
				<xsl:value-of select="$funderID"/>
17 17
			</xsl:otherwise>
18 18
		</xsl:choose>
19 19
	</xsl:variable>
20 20

  
21
	<xsl:variable name="fundingID" select="normalize-space($fundingIDtemp)"/>
22 21
	<xsl:variable name="projectID" select="concat($namespacePrefix, '::', .//Grant/Id)"/>
22
	<xsl:variable name="projectAlias">
23
		<xsl:call-template name="getJson">
24
			<xsl:with-param name="varName">alias</xsl:with-param>
25
			<xsl:with-param name="value"><xsl:value-of select=".//Grant/Alias"/></xsl:with-param>
26
		</xsl:call-template>
27
	</xsl:variable>
28

  
29
	<xsl:variable name="jsonExtra">
30
		<xsl:value-of select="concat('{', $projectAlias, '}')"/>
31
	</xsl:variable>
32

  
23 33
	<xsl:variable name="orgID" select="concat($namespacePrefix, '::', translate(.//Institution/Name, ' ,', '__'))"/>
24 34
	<!--
25 35
		personID is fine as long as WT gives us one person per project. If they fix their export, we might have 2 persons (or more).
......
31 41

  
32 42
	<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/>
33 43

  
44
	<xsl:template name="getJson">
45
		<xsl:param name="varName"/>
46
		<xsl:param name="value"/>
47
		<xsl:value-of select="concat($quote, $varName, $quote, ':', $quote, $value, $quote)"/>
48
	</xsl:template>
49

  
34 50
	<xsl:template match="/">
35
		<record
36
		>
51
		<record>
37 52

  
38 53
			<xsl:copy-of select=".//*[local-name()='header']"/>
39 54
			<metadata>
......
60 75
							</FIELD>
61 76
							<FIELD name="contracttypeclass">UNKNOWN</FIELD>
62 77
							<FIELD name="contracttypescheme">wt:contractTypes</FIELD>
78

  
63 79
							<FIELD name="acronym"></FIELD>
64
							<FIELD name="keywords">
65
								<xsl:value-of select=".//Grant/Type"/>
66
							</FIELD>
80
							<FIELD name="keywords"><xsl:value-of select="normalize-space(.//Grant/Type)"/></FIELD>
67 81
							<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
68 82
							<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
69 83
							<FIELD name="collectedfrom">
......
72 86
							<FIELD name="optional1">
73 87
								<xsl:value-of select="concat(.//Grant/Amount, ' ', .//Grant/Amount/@Currency)"/>
74 88
							</FIELD>
89
							<FIELD name="jsonextrainfo"><xsl:value-of select="$jsonExtra"/></FIELD>
75 90
						</ROW>
91

  
76 92
						<ROW table="project_fundingpath">
77 93
							<FIELD name="_dnet_resource_identifier_">
78 94
								<xsl:value-of select="concat($fundingID,'@@', $projectID)"/>

Also available in: Unified diff