Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:oai="http://www.openarchives.org/OAI/2.0/"
4
                xmlns:datetime="http://exslt.org/dates-and-times"
5
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
6
                xmlns:md="http://www.pangaea.de/MetaData"
7
                xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf"
8
                xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
9
                xmlns:stringUtils="org.apache.commons.lang.StringUtils"
10
                version="1.0"
11
                exclude-result-prefixes="xsl dnet oaa fn stringUtils datetime">
12
	<xsl:param name="namespacePrefix"/>
13
	<xsl:param name="dataSourceId"/>
14
	<xsl:param name="parentDatasourceId"/>
15
	<xsl:param name="dataprovider_name"/>
16
	<xsl:param name="dataprovider_id"/>
17

    
18
	<xsl:template match="/">
19

    
20

    
21
		<xsl:variable name="identifier_datacite">
22
			<xsl:value-of select="oai:record/oai:header/dri:objIdentifier"/>
23
		</xsl:variable>
24

    
25
		<xsl:variable name="dataset_identifier">
26
			<xsl:value-of
27
					select="//md:citation/md:URI"/>
28
		</xsl:variable>
29
		<xsl:variable name="openaire_dataset_identifier">
30
			<xsl:value-of
31
					select="concat($namespacePrefix,'::', dnet:md5($dataset_identifier))"/>
32
		</xsl:variable>
33

    
34
		<xsl:variable name="parentURI">
35
			<xsl:value-of select="//md:citation/md:parentURI"/>
36
		</xsl:variable>
37

    
38
		<xsl:call-template name="CreateRecord">
39
			<xsl:with-param name="openaire_dataset_identifier" select="$openaire_dataset_identifier"/>
40
			<xsl:with-param name="dataset_identifier" select="$dataset_identifier"/>
41
			<xsl:with-param name="parent_uri" select="$parentURI"/>
42
		</xsl:call-template>
43

    
44

    
45
	</xsl:template>
46
	<xsl:template name="CreateRecord">
47
		<xsl:param name="openaire_dataset_identifier"/>
48
		<xsl:param name="dataset_identifier"/>
49
		<xsl:param name="parent_uri"/>
50
		<xsl:variable name="doi">
51
			<xsl:value-of
52
					select="replace(replace($dataset_identifier, 'https://doi.org/', ''), 'https://doi.pangaea.de/', '')"/>
53
		</xsl:variable>
54
		<oai:record>
55
			<oai:header>
56
				<dri:objIdentifier>
57
					<xsl:value-of select="$openaire_dataset_identifier"/>
58
				</dri:objIdentifier>
59
				<dri:recordIdentifier>
60
					<xsl:value-of select="$dataset_identifier"/>
61
				</dri:recordIdentifier>
62
				<dri:dateOfCollection>
63
					<xsl:value-of select="datetime:dateTime()"/>
64
				</dri:dateOfCollection>
65
				<dri:repositoryId>
66
					<xsl:value-of select="$dataprovider_id"/>
67
				</dri:repositoryId>
68
				<oaf:datasourceprefix>
69
					<xsl:value-of select="$namespacePrefix"/>
70
				</oaf:datasourceprefix>
71
			</oai:header>
72
			<oai:metadata>
73
				<resource
74
						xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
75
						xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
76
						xmlns="http://datacite.org/schema/kernel-3">
77
					<identifier identifierType="DOI">
78
						<xsl:value-of select="$doi"/>
79
					</identifier>
80
					<creators>
81
						<xsl:for-each select="//md:citation/md:author">
82
							<creator>
83
								<creatorName>
84
									<xsl:value-of select="concat(./md:firstName, ' ', ./md:lastName)"/>
85
								</creatorName>
86
								<nameIdentifier schemeURI="http://www.pangaea.de"
87
								                nameIdentifierScheme="PANGAEA">
88
									<xsl:value-of select="./@id"/>
89
								</nameIdentifier>
90

    
91
							</creator>
92
						</xsl:for-each>
93
					</creators>
94
					<titles>
95
						<xsl:for-each select="//md:citation/md:title">
96
							<title xml:lang="en-us">
97
								<xsl:value-of select="."/>
98
							</title>
99
						</xsl:for-each>
100
					</titles>
101
					<publisher>PANGAEA</publisher>
102
					<publicationYear>
103
						<xsl:value-of select="//md:citation/md:year"/>
104
					</publicationYear>
105
					<resourceType resourceTypeGeneral="Dataset"/>
106
					<xsl:variable name="description">
107
						<xsl:value-of select="//md:citation/md:abstract"/>
108
					</xsl:variable>
109
					<xsl:if test="$description">
110
						<descriptions>
111
							<description descriptionType="Abstract">
112
								<xsl:value-of select="$description"/>
113
							</description>
114
						</descriptions>
115
					</xsl:if>
116
					<rights>info:eu-repo/semantics/openAccess</rights>
117
					<contributors>
118
						<contributor contributorType="Funder">
119
							<contributorName>European Commission</contributorName>
120
							<nameIdentifier nameIdentifierScheme="info">
121
								<xsl:value-of
122
										select="//oaf:projectid"/>
123
							</nameIdentifier>
124
						</contributor>
125
					</contributors>
126
				</resource>
127
				<xsl:variable name="journalName">
128
					<xsl:value-of select="//*[local-name() ='journal']/@name"/>
129
				</xsl:variable>
130
				<xsl:variable name="journalISSN">
131
					<xsl:value-of select="//*[local-name() ='journal']/@issn"/>
132
				</xsl:variable>
133
				<xsl:variable name="journalDSId">
134
					<xsl:value-of select="//*[local-name() ='journal']/@datasourceid"/>
135
				</xsl:variable>
136

    
137
				<xsl:choose>
138
					<xsl:when test="string-length($journalISSN) &gt; 0">
139
						<oaf:journal issn="{$journalISSN}" eissn="">
140
							<xsl:value-of select="$journalName"/>
141
						</oaf:journal>
142
						<oaf:hostedBy>
143
							<xsl:attribute name="id">
144
								<xsl:value-of select="$journalDSId"/>
145
							</xsl:attribute>
146
							<xsl:attribute name="name">
147
								<xsl:value-of select="$journalName"/>
148
							</xsl:attribute>
149
						</oaf:hostedBy>
150
					</xsl:when>
151
					<xsl:otherwise>
152
						<oaf:hostedBy
153
								id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
154
								name="Unknown Repository"/>
155
					</xsl:otherwise>
156
				</xsl:choose>
157
				<xsl:for-each select="//md:citation/md:supplementTo/@id">
158
					<xsl:variable name="publicationID">
159
						<xsl:value-of select="."/>
160
					</xsl:variable>
161
					<xsl:choose>
162
						<xsl:when test="string-length($publicationID) &gt; 0">
163
							<oaf:relatedPublication>
164
								<xsl:attribute name="id">
165
									<xsl:value-of
166
											select="concat($namespacePrefix,'::', dnet:md5($publicationID))"/>
167
								</xsl:attribute>
168
							</oaf:relatedPublication>
169
						</xsl:when>
170
					</xsl:choose>
171
				</xsl:for-each>
172

    
173
				<xsl:choose>
174
					<xsl:when test="string-length($parent_uri) &gt; 0">
175
						<xsl:variable name="dataset_relate_ID">
176
							<xsl:value-of select="stringUtils:substringAfter($parent_uri,'doi:')"/>
177
						</xsl:variable>
178
						<xsl:choose>
179
							<xsl:when test="string-length($dataset_relate_ID) &gt; 0">
180
								<oaf:relatedDataSet>
181
									<xsl:attribute name="id">
182
										<xsl:value-of
183
												select="concat($namespacePrefix,'::', dnet:md5($dataset_relate_ID))"/>
184
									</xsl:attribute>
185
								</oaf:relatedDataSet>
186
							</xsl:when>
187
						</xsl:choose>
188

    
189
					</xsl:when>
190
				</xsl:choose>
191

    
192
				<oaf:about>
193
					<oaf:datainfo>
194
						<oaf:inferred>false</oaf:inferred>
195
						<oaf:deletedbyinference>false</oaf:deletedbyinference>
196
						<oaf:trust>0.9</oaf:trust>
197
						<oaf:inferenceprovenance/>
198
						<oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
199
						                      classname="sysimport:crosswalk:datasetarchive"
200
						                      schemeid="dnet:provenanceActions"
201
						                      schemename="dnet:provenanceActions"/>
202
					</oaf:datainfo>
203
				</oaf:about>
204
			</oai:metadata>
205
		</oai:record>
206
	</xsl:template>
207
</xsl:stylesheet>
(1-1/3)