dnet45/modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/datasources/opendoar2dbrest_TMP.xml @ 59665
1 |
<RESOURCE_PROFILE>
|
---|---|
2 |
<HEADER>
|
3 |
<RESOURCE_IDENTIFIER value="5e845f47-7731-40a1-9f25-3f4419f8e403_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/> |
4 |
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/> |
5 |
<RESOURCE_KIND value="TransformationRuleDSResources"/> |
6 |
<RESOURCE_URI value=""/> |
7 |
<DATE_OF_CREATION value="2019-11-11T10:35:54+00:00"/> |
8 |
</HEADER>
|
9 |
<BODY>
|
10 |
<CONFIGURATION>
|
11 |
<IMPORTED/>
|
12 |
<SCRIPT>
|
13 |
<TITLE>OPENDOAR FIX ORGS</TITLE> |
14 |
<CODE>
|
15 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
16 |
xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="2.0"> |
17 |
<xsl:param name="varDataSourceId"/> |
18 |
<xsl:variable name="namespacePrefix" select="string('opendoar____')"/> |
19 |
|
20 |
<xsl:template match="/"> |
21 |
<record>
|
22 |
<xsl:copy-of select=".//*[local-name() = 'header']"/> |
23 |
<metadata>
|
24 |
<xsl:variable name="rid" select="normalize-space(//items/system_metadata/id)"/> |
25 |
<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/> |
26 |
<ROWS>
|
27 |
<xsl:for-each select="//organisation"> |
28 |
<xsl:variable name="oUrl" select="normalize-space(./url)"/> |
29 |
<xsl:variable name="preferredNameLanguage" |
30 |
select="./name/preferred_phrases[./value='name'][1]/language[1]"/> |
31 |
<xsl:variable name="oName"> |
32 |
<xsl:choose>
|
33 |
<xsl:when test="string-length($preferredNameLanguage[1]/text()) > 0 and ./name[./language = $preferredNameLanguage]/name"> |
34 |
<xsl:value-of
|
35 |
select="./name[./language = $preferredNameLanguage]/name/text()"/> |
36 |
</xsl:when>
|
37 |
<xsl:otherwise>
|
38 |
<xsl:value-of select="./name[1]/name/text()"/> |
39 |
</xsl:otherwise>
|
40 |
</xsl:choose>
|
41 |
</xsl:variable>
|
42 |
<xsl:variable name="oAcronym"> |
43 |
<xsl:choose>
|
44 |
<xsl:when test="string-length($preferredNameLanguage[1]/text()) > 0 and ./name[./language = $preferredNameLanguage]/acronym"> |
45 |
<xsl:value-of
|
46 |
select="./name[./language = $preferredNameLanguage]/acronym"/> |
47 |
</xsl:when>
|
48 |
<xsl:otherwise>
|
49 |
<xsl:value-of select="./name[1]/acronym"/> |
50 |
</xsl:otherwise>
|
51 |
</xsl:choose>
|
52 |
</xsl:variable>
|
53 |
<xsl:variable name="oCountry" |
54 |
select="upper-case(normalize-space(./country))"/> |
55 |
<xsl:variable name="organizationId" |
56 |
select="translate(concat($namespacePrefix, '::', $oName, '_', $oCountry), ' ', '_')"/> |
57 |
<xsl:if test="string-length($oName) > 0"> |
58 |
<ROW table="dsm_organizations"> |
59 |
<FIELD name="_dnet_resource_identifier_"> |
60 |
<xsl:value-of select="$organizationId"/> |
61 |
</FIELD>
|
62 |
<FIELD name="id"> |
63 |
<xsl:value-of select="$organizationId"/> |
64 |
</FIELD>
|
65 |
<FIELD name="legalname"> |
66 |
<xsl:value-of select="$oName"/> |
67 |
</FIELD>
|
68 |
<FIELD name="legalshortname"> |
69 |
<xsl:value-of select="normalize-space($oAcronym)"/> |
70 |
</FIELD>
|
71 |
<FIELD name="websiteurl"> |
72 |
<xsl:choose>
|
73 |
<xsl:when test="starts-with(normalize-space($oUrl), 'http')"> |
74 |
<xsl:value-of select="normalize-space($oUrl)"/> |
75 |
</xsl:when>
|
76 |
<xsl:when test="string-length(normalize-space($oUrl)) > 0"> |
77 |
<xsl:value-of
|
78 |
select="concat('http://', normalize-space($oUrl))"/> |
79 |
</xsl:when>
|
80 |
</xsl:choose>
|
81 |
</FIELD>
|
82 |
|
83 |
<FIELD name="country"> |
84 |
<xsl:choose>
|
85 |
<xsl:when test="$oCountry = 'UK'">GB</xsl:when> |
86 |
<xsl:otherwise>
|
87 |
<xsl:value-of select="$oCountry"/> |
88 |
</xsl:otherwise>
|
89 |
</xsl:choose>
|
90 |
</FIELD>
|
91 |
|
92 |
<FIELD name="collectedfrom"> |
93 |
<xsl:value-of select="$varDataSourceId"/> |
94 |
</FIELD>
|
95 |
<FIELD name="provenanceaction" |
96 |
>sysimport:crosswalk:entityregistry</FIELD> |
97 |
</ROW>
|
98 |
|
99 |
<ROW table="dsm_datasource_organization"> |
100 |
<FIELD name="_dnet_resource_identifier_"> |
101 |
<xsl:value-of select="concat($datasourceId, '@@', $organizationId)" |
102 |
/>
|
103 |
</FIELD>
|
104 |
<FIELD name="datasource"> |
105 |
<xsl:value-of select="$datasourceId"/> |
106 |
</FIELD>
|
107 |
<FIELD name="organization"> |
108 |
<xsl:value-of select="$organizationId"/> |
109 |
</FIELD>
|
110 |
</ROW>
|
111 |
</xsl:if>
|
112 |
</xsl:for-each>
|
113 |
</ROWS>
|
114 |
</metadata>
|
115 |
</record>
|
116 |
</xsl:template>
|
117 |
|
118 |
</xsl:stylesheet>
|
119 |
|
120 |
|
121 |
</CODE>
|
122 |
</SCRIPT>
|
123 |
</CONFIGURATION>
|
124 |
<STATUS/>
|
125 |
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS> |
126 |
</BODY>
|
127 |
</RESOURCE_PROFILE>
|