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="stringUtils:substringAfter(//md:citation/md:URI,'doi:')"/>
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
	</xsl:template>
44

    
45

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

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

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

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

    
186
					</xsl:when>
187
				</xsl:choose>
188

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