Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="a9649911-1697-47df-922a-23ac4c1e593a_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2014-07-17T10:41:08+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>xslt_cleaning_pangaea_datacite</TITLE>
14
                <CODE><![CDATA[
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
16
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17
    xmlns:oaf="http://namespace.openaire.eu/oaf"
18
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
    xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
20
    extension-element-prefixes="TransformationFunction"
21
    exclude-result-prefixes="TransformationFunction">
22
    <xsl:param name="varOfficialName"/>
23
    <xsl:param name="varDsType"/>
24
    <xsl:param name="varDataSourceId"/>
25
    <xsl:param name="varCorda" select="'corda_______::'"/>
26
    <xsl:param name="index" select="0"/>
27
    <xsl:param name="transDate" select="current-dateTime()"/>
28
    <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
29
    <xsl:template match="/">
30
        <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
31
        <xsl:call-template name="validRecord"/>
32
    </xsl:template>
33
    <xsl:template name="validRecord">
34
        <record>
35
            <xsl:apply-templates select="//*[local-name() = 'header']"/>
36
            <metadata>
37
                <xsl:copy-of select="//*[local-name() = 'metadata']/*[local-name() = 'resource']"/>
38
                <xsl:copy-of
39
                    select="//*[local-name() = 'metadata']/*[local-name() = 'relatedPublication']"
40
                    copy-namespaces="no"/>
41
                <xsl:copy-of
42
                    select="//*[local-name() = 'metadata']/*[local-name() = 'relatedDataSet']"
43
                    copy-namespaces="no"/>
44
                <xsl:if test="//*[local-name() = 'date']/@dateType = 'Available'">
45
                    <xsl:variable name="varEmbargoEndDate"
46
                        select="TransformationFunction:convertString($tf, normalize-space(//*[local-name() = 'date'][@dateType = 'Available']), 'DateISO8601')"/>
47
                    <xsl:choose>
48
                        <xsl:when test="string-length($varEmbargoEndDate) > 0">
49
                            <oaf:embargoenddate>
50
                                <xsl:value-of select="$varEmbargoEndDate"/>
51
                            </oaf:embargoenddate>
52
                        </xsl:when>
53
                        <xsl:otherwise>
54
                            <oaf:skip>
55
                                <xsl:value-of
56
                                    select="TransformationFunction:skipRecord($tf, $index)"/>
57
                            </oaf:skip>
58
                        </xsl:otherwise>
59
                    </xsl:choose>
60
                </xsl:if>
61
                <dr:CobjCategory>
62
                    <xsl:value-of
63
                        select="TransformationFunction:convertString($tf, //*[local-name() = 'resourceType']/@resourceTypeGeneral, 'TextTypologies')"
64
                    />
65
                </dr:CobjCategory>
66
                <oaf:dateAccepted>
67
                    <xsl:value-of
68
                        select="TransformationFunction:convertString($tf, normalize-space(//*[local-name() = 'publicationYear']), 'DateISO8601')"
69
                    />
70
                </oaf:dateAccepted>
71
                <xsl:choose>
72
                    <xsl:when
73
                        test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
74
                        <oaf:accessrights>
75
                            <xsl:value-of
76
                                select="TransformationFunction:convertString($tf, //*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"
77
                            />
78
                        </oaf:accessrights>
79
                    </xsl:when>
80
                    <xsl:when
81
                        test="//*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
82
                        <oaf:accessrights>
83
                            <xsl:value-of
84
                                select="TransformationFunction:convertString($tf, //*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"
85
                            />
86
                        </oaf:accessrights>
87
                    </xsl:when>
88
                    <xsl:otherwise>
89
                        <xsl:choose>
90
                            <xsl:when
91
                                test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'http://creativecommons.org')]">
92
                                <oaf:accessrights>
93
                                    <xsl:text>OPEN</xsl:text>
94
                                </oaf:accessrights>
95
                            </xsl:when>
96
                            <xsl:otherwise>
97
                                <oaf:accessrights>
98
                                    <xsl:text>CLOSED</xsl:text>
99
                                </oaf:accessrights>
100
                            </xsl:otherwise>
101
                        </xsl:choose>
102
                    </xsl:otherwise>
103
                </xsl:choose>
104
                <oaf:language>
105
                    <xsl:value-of
106
                        select="TransformationFunction:convert($tf, //*[local-name() = 'language'], 'Languages')"
107
                    />
108
                </oaf:language>
109
                <!--
110
<xsl:if test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics/embargoedAccess')]">
111
<oaf:embargoenddate>
112
<xsl:value-of select="//*[local-name()='date']/@dateType='Available'"/>
113
</oaf:embargoenddate>
114
</xsl:if>
115
-->
116
                <xsl:for-each select="//*[local-name() = 'nameIdentifier']">
117
                    <xsl:if
118
                        test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6">
119
                        <oaf:projectid>
120
                            <xsl:value-of
121
                                select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')"
122
                            />
123
                        </oaf:projectid>
124
                    </xsl:if>
125
                </xsl:for-each>
126
                <oaf:hostedBy>
127
                    <xsl:attribute name="name">
128
                        <xsl:value-of select="$varOfficialName"/>
129
                    </xsl:attribute>
130
                    <xsl:attribute name="id">
131
                        <xsl:value-of select="$varDataSourceId"/>
132
                    </xsl:attribute>
133
                </oaf:hostedBy>
134
                <oaf:collectedFrom>
135
                    <xsl:attribute name="name">
136
                        <xsl:value-of select="$varOfficialName"/>
137
                    </xsl:attribute>
138
                    <xsl:attribute name="id">
139
                        <xsl:value-of select="$varDataSourceId"/>
140
                    </xsl:attribute>
141
                </oaf:collectedFrom>
142
            </metadata>
143
            <xsl:copy-of select="//*[local-name() = 'about']"/>
144
        </record>
145
    </xsl:template>
146
    <!--
147
<xsl:template match="//*[local-name()='language']">
148
<oaf:language>
149
<xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
150
</oaf:language>
151
</xsl:template>
152
-->
153
    <xsl:template match="node() | @*">
154
        <xsl:copy>
155
            <xsl:apply-templates select="node() | @*"/>
156
        </xsl:copy>
157
    </xsl:template>
158
    <xsl:template match="//*[local-name() = 'header']">
159
        <xsl:copy>
160
            <xsl:apply-templates select="node() | @*"/>
161
            <xsl:element name="dr:dateOfTransformation">
162
                <xsl:value-of select="$transDate"/>
163
            </xsl:element>
164
        </xsl:copy>
165
    </xsl:template>
166
</xsl:stylesheet>
167
]]></CODE>
168
            </SCRIPT>
169
        </CONFIGURATION>
170
        <STATUS/>
171
        <SECURITY_PARAMETERS/>
172
    </BODY>
173
</RESOURCE_PROFILE>
(80-80/84)