Project

General

Profile

« Previous | Next » 

Revision 62727

Added by Alessia Bardi over 1 year ago

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/noncompliant/d4science-gCat2datacite.xml
12 12
			<SCRIPT>
13 13
				<TITLE>xslt_d4science-catalog_datacite</TITLE>
14 14
				<CODE>
15

  
15 16
					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16 17
									xmlns:date="http://exslt.org/dates-and-times" xmlns:oaf="http://namespace.openaire.eu/oaf"
17 18
									xmlns:oai="http://www.openarchives.org/OAI/2.0/"
......
19 20
									xmlns:dr="http://www.driver-repository.eu/namespace/dr" exclude-result-prefixes="xsl"
20 21
									extension-element-prefixes="date" version="2.0">
21 22

  
23

  
22 24
						<xsl:output indent="yes"/>
23 25
						<xsl:param name="varOfficialName"/>
24 26
						<xsl:param name="varDataSourceId"/>
......
29 31

  
30 32
						<xsl:template name="createRecord">
31 33
							<xsl:variable name="type" select="//extras[./key = 'system:type']/value"/>
34
							<xsl:variable name="publishedDate">
35
								<xsl:choose>
36
									<xsl:when test="$type = 'Experiment'">
37
										<xsl:value-of select="//metadata_created"/>
38
									</xsl:when>
39
									<xsl:otherwise>
40
										<xsl:value-of select="//extras[./key = 'CreationDate']/value"/>
41
									</xsl:otherwise>
42
								</xsl:choose>
43
							</xsl:variable>
32 44
							<oai:record>
33 45
								<oai:header>
34 46
									<xsl:copy-of copy-namespaces="no" select="//*[local-name() = 'header']/*"/>
......
41 53
													   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
42 54
													   xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
43 55
										<datacite:identifier identifierType="URL">
44
											<xsl:value-of select="//extras[./key = 'Item URL']/value"/>
56
											<xsl:value-of select="//data/extras[./key = 'Item URL']/value"/>
45 57
										</datacite:identifier>
46
										<datacite:alternateIdentifiers>
47
											<xsl:for-each select="//resources">
48
												<alternateIdentifier>
49
													<xsl:attribute name="alternateIdentifierType">
50
														<xsl:value-of select="URL"/>
51
													</xsl:attribute>
52
													<xsl:value-of select="./url"/>
53
												</alternateIdentifier>
54
											</xsl:for-each>
55
										</datacite:alternateIdentifiers>
58
										<datacite:alternateIdentifiers/>
59
										<datacite:creators>
60
											<xsl:choose>
61
												<xsl:when test="$type = 'Experiment'">
62
													<xsl:for-each
63
															select="//data/extras[./key = 'Involved People']/value">
64
														<xsl:variable name="tokenizedCreator" select="tokenize(., ',')"/>
65
														<datacite:creator>
66
															<datacite:creatorName>
67
																<xsl:value-of
68
																		select="concat($tokenizedCreator[1], ',', $tokenizedCreator[2])"
69
																/>
70
															</datacite:creatorName>
71
															<datacite:affiliation/>
72
															<xsl:if test="count($tokenizedCreator) = 4">
73
																<datacite:nameIdentifier nameIdentifierScheme="ORCID"
74
																						 schemeURI="http://orcid.org">
75
																	<xsl:value-of
76
																			select="tokenize($tokenizedCreator[4], '/')[last()]"
77
																	/>
78
																</datacite:nameIdentifier>
79
															</xsl:if>
80
														</datacite:creator>
81
													</xsl:for-each>
82
												</xsl:when>
83
												<xsl:otherwise>
84
													<xsl:for-each select="//data/extras[./key = 'Creator']/value">
85
														<xsl:variable name="tokenizedCreator" select="tokenize(., ',')"/>
86
														<datacite:creator>
87
															<datacite:creatorName>
88
																<xsl:value-of
89
																		select="concat($tokenizedCreator[1], ',', $tokenizedCreator[2])"
90
																/>
91
															</datacite:creatorName>
92
															<datacite:affiliation/>
93
															<xsl:if test="count($tokenizedCreator) = 4">
94
																<datacite:nameIdentifier nameIdentifierScheme="ORCID"
95
																						 schemeURI="http://orcid.org">
96
																	<xsl:value-of
97
																			select="tokenize($tokenizedCreator[4], '/')[last()]"/>
98
																</datacite:nameIdentifier>
99
															</xsl:if>
100
														</datacite:creator>
101
													</xsl:for-each>
102
												</xsl:otherwise>
103
											</xsl:choose>
56 104

  
57
										<datacite:creators>
58
											<xsl:for-each select="TODO">
59
												<datacite:creator>TODO</datacite:creator>
60
											</xsl:for-each>
61 105
										</datacite:creators>
62 106
										<datacite:titles>
63 107
											<xsl:for-each select="//data/title">
......
67 111
											</xsl:for-each>
68 112
										</datacite:titles>
69 113
										<datacite:publisher>
70
											<xsl:value-of select="TODO"/>
114
											<xsl:value-of select="string('SoBigData++')"/>
71 115
										</datacite:publisher>
72
										<datacite:publicationYear>
73
											<xsl:value-of select="TODO"/>
74
										</datacite:publicationYear>
116
										<datacite:publicationYear/>
75 117
										<datacite:dates>
76 118
											<datacite:date dateType="Issued">
77
												<xsl:value-of select="//metadata_created"/>
119
												<xsl:value-of select="$publishedDate"/>
78 120
											</datacite:date>
79 121
										</datacite:dates>
80 122

  
......
82 124
											<xsl:value-of select="$type"/>
83 125
										</datacite:resourceType>
84 126
										<datacite:descriptions>
85
											<xsl:for-each select="//notes">
127
											<xsl:for-each select="//data/notes">
86 128
												<xsl:if test="string-length(.) &gt; 0">
87 129
													<datacite:description descriptionType="Abstract">
88 130
														<xsl:value-of select="."/>
......
92 134
										</datacite:descriptions>
93 135

  
94 136
										<datacite:subjects>
95
											<xsl:for-each select="//tags">
137
											<xsl:for-each select="//data/tags">
96 138
												<datacite:subject>
97 139
													<xsl:value-of select="./name"/>
98 140
												</datacite:subject>
......
108 150

  
109 151
									</datacite:resource>
110 152
									<xsl:choose>
111
										<xsl:when test="//isopen = 'true'">
153
										<xsl:when test="//data/private = 'false'">
112 154
											<oaf:accessrights>OPEN</oaf:accessrights>
113 155
										</xsl:when>
114 156
										<xsl:otherwise>
......
116 158
										</xsl:otherwise>
117 159
									</xsl:choose>
118 160
									<xsl:choose>
119
										<xsl:when test="$type = 'Experiment'">
120
											<dr:CobjCategory type="software">Workflow</dr:CobjCategory>
161
										<xsl:when test="$type = ('Experiment', ' Method')">
162
											<dr:CobjCategory type="software">0029</dr:CobjCategory>
121 163
										</xsl:when>
122
										<xsl:when test="$type = 'Method'">
123
											<dr:CobjCategory type="software">Workflow</dr:CobjCategory>
124
										</xsl:when>
125 164
										<xsl:when test="$type = 'Application'">
126
											<dr:CobjCategory type="software">Software</dr:CobjCategory>
165
											<dr:CobjCategory type="software">0029</dr:CobjCategory>
127 166
										</xsl:when>
128 167
										<xsl:when test="$type = 'Dataset'">
129
											<dr:CobjCategory type="dataset">Dataset</dr:CobjCategory>
168
											<dr:CobjCategory type="dataset">0021</dr:CobjCategory>
130 169
										</xsl:when>
131 170
										<xsl:otherwise>
132 171
											<dr:CobjCategory type="other">0020</dr:CobjCategory>
......
134 173
									</xsl:choose>
135 174

  
136 175
									<oaf:dateAccepted>
137
										<!--<xsl:value-of select="/metadata_created"/>-->
176
										<xsl:value-of select="$publishedDate"/>
138 177
									</oaf:dateAccepted>
139 178
									<oaf:hostedBy>
140
										<!-- Unknown repo? -->
141 179
										<xsl:attribute name="name">
142 180
											<xsl:value-of select="$varOfficialName"/>
143 181
										</xsl:attribute>
......
153 191
											<xsl:value-of select="$varDataSourceId"/>
154 192
										</xsl:attribute>
155 193
									</oaf:collectedFrom>
156
									<xsl:for-each select="//license_url">
194
									<xsl:for-each select="//data/license_id">
157 195
										<oaf:license>
158 196
											<xsl:value-of select="."/>
159 197
										</oaf:license>
160 198
									</xsl:for-each>
161 199

  
162
									<xsl:for-each select="TODO">
163
										<oaf:language>
164
											<xsl:value-of select="TODO"/>
165
										</oaf:language>
166
									</xsl:for-each>
200
									<oaf:projectid>corda__h2020::871042</oaf:projectid>
167 201
									<xsl:for-each select="//resources/url">
168 202
										<xsl:if test="starts-with(., 'https://doi.org/')">
169 203
											<oaf:identifier identifierType="doi">

Also available in: Unified diff