Project

General

Profile

1
    <RESOURCE_PROFILE>
2
        <HEADER>
3
            <RESOURCE_IDENTIFIER
4
                    value="59472c7d-3702-4b3e-b95c-8d16f1e68571_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
            <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
            <RESOURCE_KIND value="TransformationRuleDSResources"/>
7
            <RESOURCE_URI value=""/>
8
            <DATE_OF_CREATION value="2014-11-19T11:05:55+01:00"/>
9
        </HEADER>
10
        <BODY>
11
            <CONFIGURATION>
12
                <IMPORTED/>
13
                <SCRIPT>
14
                    <TITLE>WDS: OAI_DIF to DMF transform</TITLE>
15
                    <CODE><![CDATA[
16
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
                    xmlns:dnet="eu.dnetlib.wds.utils.WDSUtils"
18
                    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
19
                    xmlns:oaf="http://namespace.dnet.eu/oaf" version="2.0" exclude-result-prefixes="xsl dnet">
20
        <xsl:output indent="yes"/>
21
        <xsl:template match="/">
22
            <xsl:choose>
23
                <xsl:when test="count(//*[local-name()='metadata'] ) = 0 ">
24
                    <record/>
25
                </xsl:when>
26
                <xsl:otherwise>
27
                    <xsl:call-template name="createRecord"/>
28
                </xsl:otherwise>
29
            </xsl:choose>
30

    
31
        </xsl:template>
32

    
33
        <xsl:template name="createRecord">
34

    
35
            <oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
36
                        xmlns:dri="http://www.driver-repository.eu/namespace/dri"
37
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
38
                <oai:header>
39
                    <xsl:copy-of copy-namespaces="no" select="//*[local-name() = 'header']/*"/>
40

    
41
                </oai:header>
42
                <oai:metadata>
43
                    <resource xmlns="http://datacite.org/schema/kernel-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
44
                        <xsl:variable name="identifier" select="//*[local-name() = 'Issue_Identification']"/>
45
                         <xsl:for-each select="$identifier">
46
                             <xsl:variable name="pid" select="dnet:getDOI(.)"/>
47
                             <xsl:if test="$pid">
48
                                 <identifier identifierType="DOI">
49
                             <xsl:value-of select="$pid"/>
50
                         </identifier>
51
                             </xsl:if>
52
                         </xsl:for-each>
53

    
54

    
55
                        <xsl:variable name="creators" select="tokenize(//*[local-name() = 'Dataset_Creator'],';')"/>
56
                        <xsl:if test="$creators[1]">
57
                            <creators>
58
                                <xsl:for-each select="$creators">
59
                                    <creator>
60
                                        <creatorName>
61
                                            <xsl:value-of select="."/>
62
                                        </creatorName>
63
                                    </creator>
64
                                </xsl:for-each>
65
                            </creators>
66
                        </xsl:if>
67

    
68
                        <xsl:variable name="titles" select="//*[local-name() = 'Dataset_Title']"/>
69
                        <xsl:if test="$titles">
70
                            <titles>
71
                                <xsl:for-each select="$titles">
72
                                    <title>
73
                                        <xsl:value-of select="."/>
74
                                    </title>
75
                                </xsl:for-each>
76
                            </titles>
77
                        </xsl:if>
78
                        <xsl:variable name="publisher" select="//*[local-name() = 'Dataset_Publisher']"/>
79
                        <xsl:if test="$publisher">
80
                            <publisher><xsl:value-of select="$publisher"/></publisher>
81
                        </xsl:if>
82
                        <xsl:variable name ="date" select="//*[local-name() = 'Dataset_Release_Date']"/>
83
                        <xsl:if test="$date">
84
                            <dates>
85
                                <date dateType='available'>
86
                                    <xsl:value-of select="$date"/>
87
                                </date>
88
                            </dates>
89
                        </xsl:if>
90
                        <xsl:variable name="subjects" select="tokenize(//*[local-name() = 'ISO_Topic_Category'],'/')"/>
91
                        <xsl:if test="$subjects[1]">
92
                            <subjects>
93
                                <xsl:for-each select="$subjects">
94
                                    <subject>
95
                                        <xsl:value-of select="."/>
96
                                    </subject>
97
                                </xsl:for-each>
98
                            </subjects>
99
                        </xsl:if>
100

    
101
                        <xsl:variable name="descriptions" select="//*[local-name() = 'Summary']"/>
102
                        <xsl:if test="$descriptions">
103
                            <descriptions>
104
                                <xsl:for-each select="$descriptions">
105
                                    <description>
106
                                        <xsl:value-of select="."/>
107
                                    </description>
108
                                </xsl:for-each>
109
                            </descriptions>
110
                        </xsl:if>
111

    
112
                        <xsl:variable name="geoLocations" select="//*[local-name() = 'Spatial_Coverage']"/>
113
                        <xsl:if test="$geoLocations">
114
                            <geoLocations>
115
                                <xsl:for-each select="$geoLocations">
116
                                    <geoLocation>
117
                                        <geoLocationBox>
118
                                            <xsl:value-of select="concat(./*[local-name() = 'Westernmost_Longitude'],' ', ./*[local-name() = 'Southernmost_Latitude'],' ',./*[local-name() = 'Easternmost_Longitude'],' ', ./*[local-name() = 'Northernmost_Latitude'] )"/>
119
                                        </geoLocationBox>
120
                                    </geoLocation>
121

    
122

    
123
                                </xsl:for-each>
124
                            </geoLocations>
125
                        </xsl:if>
126
                        <resourceType resourceTypeGeneral="dataset"/>
127
                    </resource>
128
                </oai:metadata>
129
                <xsl:call-template name="about"/>
130
            </oai:record>
131
        </xsl:template>
132

    
133
        <xsl:template name="about">
134
            <oaf:about>
135

    
136
                <xsl:variable name="dsPrefix" select="//*[local-name()='datasourceprefix']"/>
137

    
138
                <oaf:datainfo>
139
                    <oaf:collectedFrom>
140
                             <xsl:attribute name="id"><xsl:value-of select="dnet:getIdFromDataSourcePrefix($dsPrefix)"/></xsl:attribute>
141
                             <xsl:attribute name="name"><xsl:value-of select="dnet:getNameFromDataSourcePrefix($dsPrefix)"/></xsl:attribute>
142

    
143
                    </oaf:collectedFrom>
144
                </oaf:datainfo>
145
            </oaf:about>
146
        </xsl:template>
147

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