Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="bb8e0e1c-5b53-4af5-a783-e074336624f9_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>SGOV to DB</TITLE>
14
                <CODE>
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
                xmlns:fn="http://www.w3.org/2005/xpath-functions" version="2.0" exclude-result-prefixes="fn">
17

    
18
    <xsl:param name="varDataSourceId"/>
19
    <xsl:variable name="namespacePrefix" select="string('sgov________')"/>
20
    <xsl:template name="FirstLetterAndNumber">
21
        <xsl:param name="string" select="normalize-space(translate(., ', ', ' '))"/>
22

    
23
        <xsl:for-each select="tokenize($string, ' ')">
24
            <xsl:if test="string-length(.) != 0">
25
                <xsl:variable name="char" select="substring(., 1, 1)"/>
26
                <xsl:if test="fn:upper-case($char)=$char">
27
                    <xsl:value-of select="$char"/>
28
                </xsl:if>
29

    
30
            </xsl:if>
31
        </xsl:for-each>
32
    </xsl:template>
33

    
34

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

    
37
        <xsl:variable name="funderId" select="concat($namespacePrefix, '::SGOV')"/>
38
        <xsl:variable name="dateFormat" select="string('mm/DD/yyyy')"/>
39
        <xsl:variable name="stream">
40
            <xsl:call-template name="FirstLetterAndNumber">
41
                <xsl:with-param name="string" select=".//column[@name = 'Entidad Convocante']"/>
42
            </xsl:call-template>
43

    
44
        </xsl:variable>
45
        <xsl:variable name="streaml1">
46
            <xsl:call-template name="FirstLetterAndNumber">
47
                <xsl:with-param name="string" select=".//column[@name = 'Unidad Directiva']"/>
48
            </xsl:call-template>
49
        </xsl:variable>
50
        <xsl:variable name="fundingId">
51
            <xsl:choose>
52
                <xsl:when test="string-length($stream) &gt; 0">
53
                    <xsl:choose>
54
                        <xsl:when test="string-length($streaml1) &gt; 0">
55
                            <xsl:value-of select="concat($funderId, '::', $stream, '::', $streaml1)"
56
                            />
57
                        </xsl:when>
58
                        <xsl:otherwise>
59
                            <xsl:value-of select="concat($funderId, '::', $stream)"/>
60
                        </xsl:otherwise>
61
                    </xsl:choose>
62
                </xsl:when>
63
                <xsl:otherwise>
64
                    <xsl:value-of select="$funderId"/>
65
                </xsl:otherwise>
66
            </xsl:choose>
67
        </xsl:variable>
68

    
69

    
70
        <record>
71

    
72
            <xsl:copy-of select=".//*[local-name() = 'header']"/>
73

    
74
            <metadata>
75
                <ROWS>
76
                    <xsl:variable name="projectId"
77
                                  select="concat($namespacePrefix, '::', normalize-space(.//column[@name = 'Referencia Proyecto']))"/>
78
                    <xsl:variable name="startDate" select=".//column[@name = 'fecha convocatoria']"/>
79
                    <xsl:variable name="endDate" select=".//column[@name = 'fecha resolucion']"/>
80

    
81
                    <ROW table="projects">
82
                        <FIELD name="_dnet_resource_identifier_">
83
                            <xsl:value-of select="$projectId"/>
84
                        </FIELD>
85
                        <FIELD name="id">
86
                            <xsl:value-of select="$projectId"/>
87
                        </FIELD>
88
                        <FIELD name="code">
89
                            <xsl:value-of select=".//column[@name = 'Referencia Proyecto']"/>
90
                        </FIELD>
91
                        <FIELD name="title">
92
                            <xsl:value-of select=".//column[@name = 'Título Proyecto']"/>
93
                        </FIELD>
94

    
95
                        <xsl:if test="not($startDate = 'abierta')">
96
                            <FIELD name="startdate" type="date" format="{$dateFormat}">
97
                                <xsl:value-of select="$startDate"/>
98
                            </FIELD>
99
                        </xsl:if>
100
                        <xsl:if test="not($endDate = 'abierta')">
101
                            <FIELD name="enddate" type="date" format="{$dateFormat}">
102
                                <xsl:value-of select="$endDate"/>
103
                            </FIELD>
104
                        </xsl:if>
105
                        <FIELD name="collectedfrom">
106
                            <xsl:value-of select="$varDataSourceId"/>
107
                        </FIELD>
108
                        <FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
109
                        <FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
110
                        <FIELD name="collectedfrom">
111
                            <xsl:value-of select="$varDataSourceId"/>
112
                        </FIELD>
113

    
114
                        <FIELD name="oa_mandate_for_publications" type="boolean">false</FIELD>
115
                        <FIELD name="lastupdate" type="date"><xsl:value-of select="current-dateTime()"/></FIELD>
116
                    </ROW>
117

    
118
                    <ROW table="project_fundingpath">
119
                        <FIELD name="_dnet_resource_identifier_">
120
                            <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
121
                        </FIELD>
122
                        <FIELD name="funding">
123
                            <xsl:value-of select="$fundingId"/>
124
                        </FIELD>
125
                        <FIELD name="project">
126
                            <xsl:value-of select="$projectId"/>
127
                        </FIELD>
128
                        <xsl:if test="not($startDate = 'abierta')">
129
                            <FIELD name="startdate" type="date" format="{$dateFormat}">
130
                                <xsl:value-of select="$startDate"/>
131
                            </FIELD>
132
                        </xsl:if>
133
                        <xsl:if test="not($endDate = 'abierta')">
134
                            <FIELD name="enddate" type="date" format="{$dateFormat}">
135
                                <xsl:value-of select="$endDate"/>
136
                            </FIELD>
137
                        </xsl:if>
138

    
139
                    </ROW>
140

    
141

    
142

    
143

    
144
                </ROWS>
145
            </metadata>
146
        </record>
147
    </xsl:template>
148

    
149
</xsl:stylesheet>
150
        </CODE>
151
        </SCRIPT>
152
        </CONFIGURATION>
153
<STATUS/>
154
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
155
        </BODY>
156
        </RESOURCE_PROFILE>
(18-18/22)