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" version="1.0">
4

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

    
8
	<xsl:template match="/">
9
		<record>
10

    
11
			<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
				<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
16
				<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
						<xsl:when test="normalize-space(//repositoryType) = 'Aggregating'">
28
							<xsl:value-of select="string('aggregator::pubsrepository::unknown')"/>
29
						</xsl:when>
30
						<xsl:otherwise>
31
							<xsl:value-of select="string('pubsrepository::unknown')"/>
32
						</xsl:otherwise>
33
					</xsl:choose>
34
				</xsl:variable>
35

    
36
				<xsl:variable name="contenttypes">
37
					<xsl:for-each select=".//contentType">
38
						<xsl:if test="position() &gt; 1"> - </xsl:if>
39
						<xsl:value-of select="."/>
40
					</xsl:for-each>
41
				</xsl:variable>
42
				<xsl:variable name="languages">
43
					<xsl:for-each select=".//lName">
44
						<xsl:if test="position() &gt; 1">, </xsl:if>
45
						<xsl:value-of select="."/>
46
					</xsl:for-each>
47
				</xsl:variable>
48

    
49
				<xsl:variable name="subjects">
50
					<xsl:for-each select=".//clTitle">
51
						<xsl:if test="position() &gt; 1">, </xsl:if>
52
						<xsl:value-of select="concat('&quot;', ., '&quot;')"/>
53
					</xsl:for-each>
54
				</xsl:variable>
55

    
56
				<ROWS>
57
					<ROW table="dsm_datasources">
58
						<FIELD name="_dnet_resource_identifier_">
59
							<xsl:value-of select="$datasourceId"/>
60
						</FIELD>
61
						<FIELD name="id">
62
							<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
						<FIELD name="websiteurl">
71
							<xsl:value-of select="normalize-space(//rUrl)"/>
72
						</FIELD>
73
						<FIELD name="contactemail">
74
							<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
						<FIELD name="languages">
86
							<xsl:value-of select="normalize-space($languages)"/>
87
						</FIELD>
88
						<FIELD name="od_contenttypes">
89
							<xsl:value-of select="normalize-space($contenttypes)"/>
90
						</FIELD>
91
						<FIELD name="collectedfrom">
92
							<xsl:value-of select="$parentDatasourceId"/>
93
						</FIELD>
94
						<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
							<xsl:value-of select="concat('{', normalize-space($subjects), '}')"/>
107
						</FIELD>
108
					</ROW>
109

    
110
					<ROW table="dsm_api">
111
						<FIELD name="_dnet_resource_identifier_">
112
							<xsl:value-of select="$apiId"/>
113
						</FIELD>
114
						<FIELD name="id">
115
							<xsl:value-of select="$apiId"/>
116
						</FIELD>
117
						<FIELD name="protocol">oai</FIELD>
118
						<FIELD name="datasource">
119
							<xsl:value-of select="$datasourceId"/>
120
						</FIELD>
121
						<FIELD name="contentdescription">metadata</FIELD>
122
						<FIELD name="typology">
123
							<xsl:value-of select="$repositoryType"/>
124
						</FIELD>
125
						<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
					</ROW>
130

    
131
					<ROW table="dsm_apiparams">
132
						<FIELD name="_dnet_resource_identifier_">
133
							<xsl:value-of select="concat($apiId, '@@format')"/>
134
						</FIELD>
135
						<FIELD name="api">
136
							<xsl:value-of select="$apiId"/>
137
						</FIELD>
138
						<FIELD name="param">format</FIELD>
139
						<FIELD name="value">oai_dc</FIELD>
140
					</ROW>
141

    
142
					<ROW table="dsm_organizations">
143
						<FIELD name="_dnet_resource_identifier_">
144
							<xsl:value-of select="$organizationId"/>
145
						</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
							<xsl:choose>
157
								<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
158
									<xsl:value-of select="normalize-space($oUrl)"/>
159
								</xsl:when>
160
								<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0">
161
									<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
162
								</xsl:when>
163
							</xsl:choose>
164
						</FIELD>
165

    
166
						<FIELD name="country">
167
							<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

    
175
						<FIELD name="collectedfrom">
176
							<xsl:value-of select="$parentDatasourceId"/>
177
						</FIELD>
178
						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
179
					</ROW>
180

    
181
					<ROW table="dsm_datasource_organization">
182
						<FIELD name="_dnet_resource_identifier_">
183
							<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
184
						</FIELD>
185
						<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

    
193
				</ROWS>
194
			</metadata>
195
		</record>
196
	</xsl:template>
197

    
198
</xsl:stylesheet>
(22-22/31)