Project

General

Profile

1 26600 sandro.lab
<?xml version="1.0" encoding="UTF-8"?>
2 48139 alessia.ba
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="1.0">
4 40571 sandro.lab
5 40577 sandro.lab
	<xsl:param name="parentDatasourceId"/>
6
	<xsl:param name="namespacePrefix"/>
7 40571 sandro.lab
8 40577 sandro.lab
	<xsl:template match="/">
9 50489 michele.ar
		<record>
10 40571 sandro.lab
11 40577 sandro.lab
			<xsl:copy-of select=".//*[local-name()='header']"/>
12
			<metadata>
13
				<xsl:variable name="rid" select="normalize-space(//repository/@rID)"/>
14
				<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
15 50489 michele.ar
				<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
16 40577 sandro.lab
				<xsl:variable name="oUrl" select="normalize-space(//oUrl)"/>
17
				<xsl:variable name="oName" select="normalize-space(//oName)"/>
18
				<xsl:variable name="organizationId" select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/>
19
				<xsl:variable name="repositoryType">
20
					<xsl:choose>
21
						<xsl:when test="normalize-space(//repositoryType) = 'Institutional'">
22
							<xsl:value-of select="string('pubsrepository::institutional')"/>
23
						</xsl:when>
24
						<xsl:when test="normalize-space(//repositoryType) = 'Disciplinary'">
25
							<xsl:value-of select="string('pubsrepository::thematic')"/>
26
						</xsl:when>
27 44979 michele.ar
						<xsl:when test="normalize-space(//repositoryType) = 'Aggregating'">
28
							<xsl:value-of select="string('aggregator::pubsrepository::unknown')"/>
29
						</xsl:when>
30 40577 sandro.lab
						<xsl:otherwise>
31
							<xsl:value-of select="string('pubsrepository::unknown')"/>
32
						</xsl:otherwise>
33
					</xsl:choose>
34
				</xsl:variable>
35 40571 sandro.lab
36 40577 sandro.lab
				<xsl:variable name="contenttypes">
37
					<xsl:for-each select=".//contentType">
38 51516 claudio.at
						<xsl:if test="position() &gt; 1"> - </xsl:if>
39 40577 sandro.lab
						<xsl:value-of select="."/>
40
					</xsl:for-each>
41
				</xsl:variable>
42
				<xsl:variable name="languages">
43
					<xsl:for-each select=".//lName">
44 51516 claudio.at
						<xsl:if test="position() &gt; 1">, </xsl:if>
45 40577 sandro.lab
						<xsl:value-of select="."/>
46
					</xsl:for-each>
47
				</xsl:variable>
48 50489 michele.ar
49
				<xsl:variable name="subjects">
50
					<xsl:for-each select=".//clTitle">
51 51591 claudio.at
						<xsl:if test="position() &gt; 1"> @@ </xsl:if>
52
						<xsl:value-of select="."/>
53 50489 michele.ar
					</xsl:for-each>
54
				</xsl:variable>
55
56 40577 sandro.lab
				<ROWS>
57 50489 michele.ar
					<ROW table="dsm_datasources">
58
						<FIELD name="_dnet_resource_identifier_">
59 40577 sandro.lab
							<xsl:value-of select="$datasourceId"/>
60
						</FIELD>
61 50489 michele.ar
						<FIELD name="id">
62 40577 sandro.lab
							<xsl:value-of select="$datasourceId"/>
63
						</FIELD>
64
						<FIELD name="officialname">
65
							<xsl:value-of select="normalize-space(//rName)"/>
66
						</FIELD>
67
						<FIELD name="englishname">
68
							<xsl:value-of select="normalize-space(//rAcronym)"/>
69
						</FIELD>
70 50489 michele.ar
						<FIELD name="websiteurl">
71
							<xsl:value-of select="normalize-space(//rUrl)"/>
72 40577 sandro.lab
						</FIELD>
73 50489 michele.ar
						<FIELD name="contactemail">
74 40577 sandro.lab
							<xsl:value-of select="normalize-space(//pEmail)"/>
75
						</FIELD>
76
						<FIELD name="latitude" type="float">
77
							<xsl:value-of select="normalize-space(//paLatitude)"/>
78
						</FIELD>
79
						<FIELD name="longitude" type="float">
80
							<xsl:value-of select="normalize-space(//paLongitude)"/>
81
						</FIELD>
82
						<FIELD name="namespaceprefix">
83
							<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
84
						</FIELD>
85 50489 michele.ar
						<FIELD name="languages">
86
							<xsl:value-of select="normalize-space($languages)"/>
87 40577 sandro.lab
						</FIELD>
88 50489 michele.ar
						<FIELD name="od_contenttypes">
89
							<xsl:value-of select="normalize-space($contenttypes)"/>
90 40577 sandro.lab
						</FIELD>
91
						<FIELD name="collectedfrom">
92
							<xsl:value-of select="$parentDatasourceId"/>
93
						</FIELD>
94 50489 michele.ar
						<FIELD name="typology">
95
							<xsl:value-of select="$repositoryType"/>
96
						</FIELD>
97
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
98
						<FIELD name="platform">
99
							<xsl:value-of select="normalize-space(//rSoftWareName)"/>
100
						</FIELD>
101
						<FIELD name="description">
102
							<xsl:value-of select="normalize-space(//rDescription)"/>
103
						</FIELD>
104
105
						<FIELD name="subjects">
106 51591 claudio.at
							<xsl:value-of select="normalize-space($subjects)"/>
107 50489 michele.ar
						</FIELD>
108 40577 sandro.lab
					</ROW>
109 40571 sandro.lab
110 50489 michele.ar
					<ROW table="dsm_api">
111
						<FIELD name="_dnet_resource_identifier_">
112 40577 sandro.lab
							<xsl:value-of select="$apiId"/>
113
						</FIELD>
114 50489 michele.ar
						<FIELD name="id">
115 40577 sandro.lab
							<xsl:value-of select="$apiId"/>
116
						</FIELD>
117 50489 michele.ar
						<FIELD name="protocol">oai</FIELD>
118 40577 sandro.lab
						<FIELD name="datasource">
119
							<xsl:value-of select="$datasourceId"/>
120
						</FIELD>
121 50489 michele.ar
						<FIELD name="contentdescription">metadata</FIELD>
122
						<FIELD name="typology">
123 40577 sandro.lab
							<xsl:value-of select="$repositoryType"/>
124
						</FIELD>
125 50489 michele.ar
						<FIELD name="baseurl">
126
							<xsl:value-of select="normalize-space(//rOaiBaseUrl)"/>
127
						</FIELD>
128
						<FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
129 40577 sandro.lab
					</ROW>
130 40571 sandro.lab
131 50489 michele.ar
					<ROW table="dsm_apiparams">
132 40577 sandro.lab
						<FIELD name="_dnet_resource_identifier_">
133 50489 michele.ar
							<xsl:value-of select="concat($apiId, '@@format')"/>
134 40577 sandro.lab
						</FIELD>
135
						<FIELD name="api">
136
							<xsl:value-of select="$apiId"/>
137
						</FIELD>
138
						<FIELD name="param">format</FIELD>
139 50489 michele.ar
						<FIELD name="value">oai_dc</FIELD>
140 40577 sandro.lab
					</ROW>
141 40571 sandro.lab
142 50489 michele.ar
					<ROW table="dsm_organizations">
143 40577 sandro.lab
						<FIELD name="_dnet_resource_identifier_">
144 50489 michele.ar
							<xsl:value-of select="$organizationId"/>
145 40577 sandro.lab
						</FIELD>
146
						<FIELD name="id">
147
							<xsl:value-of select="$organizationId"/>
148
						</FIELD>
149
						<FIELD name="legalname">
150
							<xsl:value-of select="$oName"/>
151
						</FIELD>
152
						<FIELD name="legalshortname">
153
							<xsl:value-of select="normalize-space(//oAcronym)"/>
154
						</FIELD>
155
						<FIELD name="websiteurl">
156 41330 michele.ar
							<xsl:choose>
157 50489 michele.ar
								<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
158
									<xsl:value-of select="normalize-space($oUrl)"/>
159 41330 michele.ar
								</xsl:when>
160 50489 michele.ar
								<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0">
161
									<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
162 41330 michele.ar
								</xsl:when>
163
							</xsl:choose>
164 40577 sandro.lab
						</FIELD>
165 50489 michele.ar
166
						<FIELD name="country">
167 40577 sandro.lab
							<xsl:choose>
168
								<xsl:when test="normalize-space(//cIsoCode) = 'GB'">UK</xsl:when>
169
								<xsl:otherwise>
170
									<xsl:value-of select="normalize-space(//cIsoCode)"></xsl:value-of>
171
								</xsl:otherwise>
172
							</xsl:choose>
173
						</FIELD>
174 50489 michele.ar
175 40577 sandro.lab
						<FIELD name="collectedfrom">
176
							<xsl:value-of select="$parentDatasourceId"/>
177
						</FIELD>
178 50489 michele.ar
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
179 40577 sandro.lab
					</ROW>
180 40571 sandro.lab
181 50489 michele.ar
					<ROW table="dsm_datasource_organization">
182
						<FIELD name="_dnet_resource_identifier_">
183
							<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
184
						</FIELD>
185 40577 sandro.lab
						<FIELD name="datasource">
186
							<xsl:value-of select="$datasourceId"/>
187
						</FIELD>
188
						<FIELD name="organization">
189
							<xsl:value-of select="$organizationId"/>
190
						</FIELD>
191
					</ROW>
192 40571 sandro.lab
193 40577 sandro.lab
				</ROWS>
194
			</metadata>
195
		</record>
196
	</xsl:template>
197 40571 sandro.lab
198 26600 sandro.lab
</xsl:stylesheet>