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:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
4
                version="1.0">
5

    
6
	<xsl:param name="parentDatasourceId"/>
7
	<xsl:param name="namespacePrefix"/>
8

    
9
	<xsl:variable name="dsId" select="concat($namespacePrefix, '::', normalize-space(.//*[local-name()='re3data.orgIdentifier']))"/>
10
	<xsl:variable name="subjects">
11
		<xsl:for-each select="//*[local-name()='subject']">
12
			<xsl:if test="position() &gt; 1"> @@ </xsl:if>
13
			<xsl:value-of select="substring-after(., ' ')"/>
14
		</xsl:for-each>
15
	</xsl:variable>
16

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

    
20
			<xsl:copy-of select=".//*[local-name()='header']"/>
21
			<metadata>
22
				<ROWS>
23
					<ROW table="dsm_datasources">
24
						<FIELD name="_dnet_resource_identifier_">
25
							<xsl:value-of select="$dsId"/>
26
						</FIELD>
27
						<FIELD name="id">
28
							<xsl:value-of select="$dsId"/>
29
						</FIELD>
30
						<FIELD name="officialName">
31
							<xsl:value-of select=".//*[local-name()='repositoryName']"/>
32
						</FIELD>
33
						<FIELD name="englishName">
34
							<xsl:value-of select=".//*[local-name()='additionalName'][@language='eng']"/>
35
						</FIELD>
36
						<FIELD name="websiteurl">
37
							<xsl:value-of select=".//*[local-name()='repositoryURL']"/>
38
						</FIELD>
39
						<FIELD name="namespaceprefix">
40
							<xsl:value-of select="dnet:generateNsPrefix('r3', dnet:md5(normalize-space(.//*[local-name()='re3data.orgIdentifier'])))"/>
41
						</FIELD>
42
						<FIELD name="collectedfrom">
43
							<xsl:value-of select="$parentDatasourceId"/>
44
						</FIELD>
45
						<FIELD name="typology">datarepository::unknown</FIELD>
46
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
47
						<FIELD name="platform">
48
							<xsl:value-of select=".//*[local-name()='software']/*[local-name()='softwareName']"/>
49
						</FIELD>
50
						<FIELD name="description">
51
							<xsl:value-of select="./*[local-name()='description']"/>
52
						</FIELD>
53
						<FIELD name="releasestartdate" type="date">
54
							<xsl:value-of select=".//*[local-name()='startDate']"/>
55
						</FIELD>
56
						<FIELD name="releaseenddate" type="date">
57
							<xsl:value-of select=".//*[local-name()='endDate']"/>
58
						</FIELD>
59
						<FIELD name="missionstatementurl">
60
							<xsl:value-of select=".//*[local-name()='missionStatementURL']"/>
61
						</FIELD>
62

    
63
						<xsl:choose>
64
							<xsl:when test=".//*[local-name()='providerType'] = 'dataProvider'">
65
								<FIELD name="dataprovider" type="boolean">true</FIELD>
66
							</xsl:when>
67
							<xsl:otherwise>
68
								<FIELD name="dataprovider" type="boolean">false</FIELD>
69
							</xsl:otherwise>
70
						</xsl:choose>
71
						<xsl:choose>
72
							<xsl:when test=".//*[local-name()='providerType'] = 'serviceProvider'">
73
								<FIELD name="serviceprovider" type="boolean">true</FIELD>
74
							</xsl:when>
75
							<xsl:otherwise>
76
								<FIELD name="serviceprovider" type="boolean">false</FIELD>
77
							</xsl:otherwise>
78
						</xsl:choose>
79
						<FIELD name="databaseaccesstype">
80
							<xsl:value-of select=".//*[local-name()='databaseAccessType']"/>
81
						</FIELD>
82
						<FIELD name="datauploadtype">
83
							<xsl:value-of select=".//*[local-name()='dataUploadType']"/>
84
						</FIELD>
85
						<FIELD name="databaseaccessrestriction">
86
							<xsl:value-of select=".//*[local-name()='databaseAccessRestriction']"/>
87
						</FIELD>
88
						<FIELD name="datauploadrestriction">
89
							<xsl:value-of select=".//*[local-name()='dataUploadRestriction']"/>
90
						</FIELD>
91
						<xsl:choose>
92
							<xsl:when test=".//*[local-name()='versioning'] = 'yes'">
93
								<FIELD name="versioning" type="boolean">true</FIELD>
94
							</xsl:when>
95
							<xsl:otherwise>
96
								<FIELD name="versioning" type="boolean">false</FIELD>
97
							</xsl:otherwise>
98
						</xsl:choose>
99
						<FIELD name="citationguidelineurl">
100
							<xsl:value-of select=".//*[local-name()='citationGuidelineURL']"/>
101
						</FIELD>
102
						<FIELD name="qualitymanagementkind">
103
							<xsl:value-of select=".//*[local-name()='qualityManagement']"/>
104
						</FIELD>
105
						<FIELD name="pidsystems">
106
							<xsl:value-of select=".//*[local-name()='pidSystem']"/>
107
						</FIELD>
108
						<FIELD name="certificates">
109
							<xsl:value-of select=".//*[local-name()='certificate']"/>
110
						</FIELD>
111
						<FIELD name="subjects">
112
							<xsl:value-of select="normalize-space($subjects)"/>
113
						</FIELD>
114
					</ROW>
115

    
116
					<xsl:for-each select="//*[local-name()='api']">
117
						<xsl:variable name="apiId" select="concat('api_________::', $dsId, '::', position())"/>
118
						<xsl:variable name="baseURL" select="normalize-space(.)"/>
119
						<ROW table="dsm_api">
120
							<FIELD name="_dnet_resource_identifier_">
121
								<xsl:value-of select="$apiId"/>
122
							</FIELD>
123
							<FIELD name="id">
124
								<xsl:value-of select="$apiId"/>
125
							</FIELD>
126
							<FIELD name="protocol">
127
								<xsl:value-of select="normalize-space(@apiType)"/>
128
							</FIELD>
129
							<FIELD name="datasource">
130
								<xsl:value-of select="$dsId"/>
131
							</FIELD>
132
							<FIELD name="contentdescription">metadata</FIELD>
133
							<FIELD name="typology">datarepository::unknown</FIELD>
134

    
135
							<FIELD name="baseurl">
136
								<xsl:value-of select="$baseURL"/>
137
							</FIELD>
138
						</ROW>
139

    
140
						<!-- CANNOT ASSUME THE FORMAT IS oai_dc
141
						<ROW table="dsm_apiparams">
142
							<FIELD name="api">
143
								<xsl:value-of select="$apiId"/>
144
							</FIELD>
145
							<FIELD name="param">format</FIELD>
146
							<FIELD name="value">oai_dc</FIELD>
147
						</ROW>
148
						-->
149
					</xsl:for-each>
150

    
151
					<xsl:for-each select="//*[local-name()='institution']">
152
						<xsl:variable name="orgId" select="concat($namespacePrefix, '::', dnet:md5(normalize-space(./*[local-name()='institutionName'])))"/>
153
						<ROW table="dsm_organizations">
154
							<FIELD name="_dnet_resource_identifier_">
155
								<xsl:value-of select="$orgId"/>
156
							</FIELD>
157
							<FIELD name="id">
158
								<xsl:value-of select="$orgId"/>
159
							</FIELD>
160
							<FIELD name="legalname">
161
								<xsl:value-of select="./*[local-name()='institutionName']"/>
162
							</FIELD>
163
							<FIELD name="legalshortname">
164
								<xsl:value-of select="./*[local-name()='institutionAdditionalName'][1]"/>
165
							</FIELD>
166
							<FIELD name="websiteurl">
167
								<xsl:choose>
168
									<xsl:when test="starts-with(normalize-space(./*[local-name()='institutionURL']), 'http')">
169
										<xsl:value-of select="./*[local-name()='institutionURL']"/>
170
									</xsl:when>
171
									<xsl:when test="string-length(normalize-space(./*[local-name()='institutionURL'])) &gt; 0">
172
										<xsl:value-of select="concat('http://', normalize-space(./*[local-name()='institutionURL']))"/>
173
									</xsl:when>
174
								</xsl:choose>
175
							</FIELD>
176
							<FIELD name="country">
177
								<xsl:value-of select="./*[local-name()='institutionCountry']"/>
178
							</FIELD>
179
							<FIELD name="collectedfrom">
180
								<xsl:value-of select="$parentDatasourceId"/>
181
							</FIELD>
182
							<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
183
						</ROW>
184

    
185
						<ROW table="dsm_datasource_organization">
186
							<FIELD name="_dnet_resource_identifier_">
187
								<xsl:value-of select="concat($dsId, '@@', $orgId)"/>
188
							</FIELD>
189
							<FIELD name="datasource">
190
								<xsl:value-of select="$dsId"/>
191
							</FIELD>
192
							<FIELD name="organization">
193
								<xsl:value-of select="$orgId"/>
194
							</FIELD>
195
						</ROW>
196
					</xsl:for-each>
197

    
198
				</ROWS>
199
			</metadata>
200
		</record>
201
	</xsl:template>
202
</xsl:stylesheet>
203

    
(4-4/5)