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/" xmlns:datetime="http://exslt.org/dates-and-times"
4
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
5
                xmlns:md="http://www.pangaea.de/MetaData"
6
                xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf"
7
                xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
8
                xmlns:stringUtils="org.apache.commons.lang.StringUtils"
9
                version="1.0"
10
                exclude-result-prefixes="xsl dnet oaa fn stringUtils datetime">
11
	<xsl:param name="namespacePrefix"/>
12
	<xsl:param name="dataSourceId"/>
13
	<xsl:param name="parentDatasourceId"/>
14
	<xsl:param name="dataprovider_name"/>
15
	<xsl:param name="dataprovider_id"/>
16
	<xsl:template match="/">
17

    
18
		<xsl:variable name="identifier_datacite">
19
			<xsl:value-of select="oai:record/oai:header/dri:objIdentifier"/>
20
		</xsl:variable>
21

    
22
		<xsl:variable name="dataset_identifier">
23
			<xsl:value-of
24
					select="stringUtils:substringAfter(//md:citation/md:URI,'doi:')"/>
25
		</xsl:variable>
26
		<xsl:variable name="openaire_dataset_identifier">
27
			<xsl:value-of
28
					select="concat($namespacePrefix,'::', dnet:md5($dataset_identifier))"/>
29
		</xsl:variable>
30

    
31
		<xsl:variable name="parentURI">
32
			<xsl:value-of select="//md:citation/md:parentURI"/>
33
		</xsl:variable>
34

    
35
		<xsl:call-template name="CreateRecord">
36
			<xsl:with-param name="openaire_dataset_identifier" select="$openaire_dataset_identifier"/>
37
			<xsl:with-param name="dataset_identifier" select="$dataset_identifier"/>
38
			<xsl:with-param name="parent_uri" select="$parentURI"/>
39
		</xsl:call-template>
40

    
41

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

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

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

    
183
				<xsl:choose>
184
					<xsl:when test="string-length($parent_uri) &gt; 0">
185
						<xsl:variable name="dataset_relate_ID">
186
							<xsl:value-of select="stringUtils:substringAfter($parent_uri,'doi:')"/>
187
						</xsl:variable>
188
						<xsl:choose>
189
							<xsl:when test="string-length($dataset_relate_ID) &gt; 0">
190
								<oaf:relatedDataSet>
191
									<xsl:attribute name="id">
192
										<xsl:value-of
193
												select="concat($namespacePrefix,'::', dnet:md5($dataset_relate_ID))"/>
194
									</xsl:attribute>
195
								</oaf:relatedDataSet>
196
							</xsl:when>
197
						</xsl:choose>
198

    
199
					</xsl:when>
200
				</xsl:choose>
201

    
202
				<oaf:about>
203
					<oaf:datainfo>
204
						<oaf:inferred>false</oaf:inferred>
205
						<oaf:deletedbyinference>false</oaf:deletedbyinference>
206
						<oaf:trust>0.9</oaf:trust>
207
						<oaf:inferenceprovenance/>
208
						<oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
209
						                      classname="sysimport:crosswalk:datasetarchive"
210
						                      schemeid="dnet:provenanceActions"
211
						                      schemename="dnet:provenanceActions"/>
212
					</oaf:datainfo>
213
				</oaf:about>
214
			</oai:metadata>
215
		</oai:record>
216
	</xsl:template>
217
</xsl:stylesheet>
(1-1/3)