Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="42569418-ac28-4e77-a38f-78b168def51a_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2017-06-30T17:01:32+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>claims_datacite_2_ODF</TITLE>
14
                <CODE><![CDATA[
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
16
    xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:oaf="http://namespace.openaire.eu/oaf"
17
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
18
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
    xmlns:dc="http://purl.org/dc/elements/1.1/"
20
    xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"
21
    exclude-result-prefixes="xsl">
22

    
23
    <xsl:output indent="yes"/>
24

    
25
     <xsl:template match="/">
26
        <xsl:choose>
27
            <xsl:when test="string-length(//*[local-name() ='objIdentifier']) = 46 and matches(//*[local-name() ='objIdentifier'], '\w{12}')">
28
                <xsl:call-template name="createRecord"/>
29
            </xsl:when>
30
            <xsl:otherwise>
31
                <xsl:call-template name="skipRecord"/>
32
            </xsl:otherwise>
33
        </xsl:choose>
34

    
35
    </xsl:template>
36

    
37
    <xsl:template name="skipRecord">
38
        <oai:record>
39
            <oai:header>
40
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
41
                    copy-namespaces="no"/>
42
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
43
                    copy-namespaces="no"/>
44
                <dri:recordIdentifier>
45
                    <xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/>
46
                </dri:recordIdentifier>
47
                <dr:dateOfTransformation>
48
                   <xsl:value-of select="date:date-time()"/>
49
                </dr:dateOfTransformation>
50
            </oai:header>
51
            <oai:metadata>
52
                <xsl:copy-of select="//*[local-name() = 'metadata']/*"/>
53
            </oai:metadata>
54
        </oai:record>
55
    </xsl:template>
56

    
57
    <xsl:template name="createRecord">
58
        <oai:record>
59
            <oai:header>
60
                <xsl:copy-of select="//*[local-name() = 'header']/dri:recordIdentifier" copy-namespaces="no"/>
61
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection" copy-namespaces="no"/>
62
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix" copy-namespaces="no"/>
63
                <dri:objIdentifier><xsl:value-of select="//*[local-name() = 'header']/*[local-name() ='objIdentifier']"/></dri:objIdentifier>
64
                <dr:dateOfTransformation>
65
                    <xsl:value-of select="date:date-time()"/>
66
                </dr:dateOfTransformation>
67
            </oai:header>
68
            <oai:metadata>
69
                <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
70
                    xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
71
                    xmlns="http://datacite.org/schema/kernel-3">
72
                    <identifier identifierType="URL">
73
                        <xsl:value-of select="//metadata/data/id"/>
74
                    </identifier>
75
                    <alternateIdentifiers>
76
                            <alternateIdentifier alternateIdentifierType="doi">
77
                                <xsl:value-of select="//metadata/data/attributes/doi"/>
78
                            </alternateIdentifier>
79
                    </alternateIdentifiers>
80
                   <creators>
81
                        <xsl:for-each select="//metadata/data/attributes/author">
82
                            <xsl:choose>
83
                                <xsl:when test="string-length(concat(./family, ./given)) &gt; 0">
84
                                    <creator>
85
                                        <creatorName>
86
                                            <xsl:value-of select="concat(./family, ', ', ./given)"/>
87
                                        </creatorName>
88
                                    </creator>
89
                                </xsl:when>
90
                                <xsl:otherwise>
91
                                    <creator>
92
                                        <creatorName>
93
                                            <xsl:value-of select="./literal"/>
94
                                        </creatorName>
95
                                    </creator>
96
                                </xsl:otherwise>
97
                            </xsl:choose>
98
                        </xsl:for-each>
99
                    </creators>
100
                    <titles>
101
                        <xsl:for-each select="//metadata/data/attributes/title">
102
                            <title><xsl:value-of select="./text()"/></title>
103
                        </xsl:for-each>
104
                    </titles>
105
                    <publisher><xsl:value-of select="//metadata/data/attributes/container-title"/></publisher>
106
                    <dates>
107
                        <date dateType="Accepted"><xsl:value-of select="//metadata/data/attributes/deposited"/></date>
108
                    </dates>
109
                    <resourceType resourceTypeGeneral="Dataset">dataset</resourceType>
110
                    <!-- No description for now -->
111
                    <descriptions>
112
                        <xsl:for-each select="//metadata/data/attributes/description">
113
                            <description descriptionType="Abstract"><xsl:value-of select="./text()"/></description>
114
                        </xsl:for-each>
115
                    </descriptions>
116
                </resource>
117
                <oaf:accessrights>
118
                    <xsl:choose>
119
                        <xsl:when test="//*[local-name() = 'metadata']/oaf:accessrights/text() != ''"><xsl:value-of select="//*[local-name() = 'metadata']/oaf:accessrights/text()"/></xsl:when>
120
                        <xsl:otherwise><xsl:value-of select="string('UNKNOWN')"/></xsl:otherwise>
121
                    </xsl:choose>
122
                </oaf:accessrights>
123
                <dr:CobjCategory>0021</dr:CobjCategory>
124
                <xsl:copy-of select="//*[local-name() = 'metadata']/oaf:*" copy-namespaces="no"></xsl:copy-of>
125
            </oai:metadata>
126
            <xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
127
        </oai:record>
128
    </xsl:template>
129
</xsl:stylesheet>
130
]]></CODE>
131
            </SCRIPT>
132
        </CONFIGURATION>
133
        <STATUS/>
134
        <SECURITY_PARAMETERS/>
135
    </BODY>
136
</RESOURCE_PROFILE>
(2-2/5)