Revision 51020
Added by Michele Artini about 6 years ago
people2dataciteTransform.xml | ||
---|---|---|
10 | 10 |
<CONFIGURATION> |
11 | 11 |
<IMPORTED/> |
12 | 12 |
<SCRIPT> |
13 |
<TITLE>People to datacite transformation</TITLE>
|
|
13 |
<TITLE>People to OpenPortalFormat</TITLE>
|
|
14 | 14 |
<CODE><![CDATA[ |
15 | 15 |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:transformExt="http://namespace.openaire.eu/java/org.apache.commons.codec.digest.DigestUtils" xmlns:datetime="http://exslt.org/dates-and-times" xmlns:exslt="http://exslt.org/common" xmlns:oai="http://www.openarchives.org/OAI/2.0/" |
16 |
xmlns:isti="http://www.isti.cnr.it/" xmlns:istiFunction="eu.dnetlib.xml.ISTIUtilityFunction"
|
|
17 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy" xmlns:dc="http://purl.org/dc/elements/1.1/" exclude-result-prefixes="xsl transformExt TransformationFunction istiFunction datetime exslt dc ">
|
|
16 |
xmlns:dnet="eu.dnetlib.data.utils.XsltFunctions"
|
|
17 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy" xmlns:dc="http://purl.org/dc/elements/1.1/" exclude-result-prefixes="xsl transformExt TransformationFunction dnet datetime exslt dc ">
|
|
18 | 18 |
<xsl:param name="varOfficialName"/> |
19 |
|
|
19 |
|
|
20 | 20 |
<xsl:variable name="tf" select="TransformationFunction:getInstance()" /> |
21 |
|
|
22 |
|
|
21 |
|
|
23 | 22 |
<xsl:template match="/"> |
24 |
|
|
25 |
<xsl:variable name="rights" select="'Unknown'" /> |
|
26 | 23 |
|
24 |
<xsl:variable name="rights" select="'Unknown'" /> |
|
25 |
|
|
27 | 26 |
<oai:record> |
28 | 27 |
<xsl:copy-of select="//*[local-name() = 'header']"/> |
29 | 28 |
<oai:metadata> |
30 |
<resource xmlns="http://datacite.org/schema/kernel-3" |
|
31 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
32 |
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"> |
|
33 |
|
|
34 |
<identifier identifierType="oai_people"> |
|
35 |
<xsl:value-of select="normalize-space(//dri:recordIdentifier)"/> |
|
36 |
</identifier> |
|
29 |
<record> |
|
30 |
|
|
31 |
<identifier><xsl:value-of select="normalize-space(//dri:recordIdentifier)"/></identifier> |
|
32 |
|
|
33 |
<title><xsl:value-of select="//dc:title[1]" /></title> |
|
34 |
|
|
37 | 35 |
<creators> |
38 |
<xsl:for-each select="//dc:creator"> |
|
39 |
<xsl:for-each select="tokenize(istiFunction:cleanNames(.), '#')"> |
|
40 |
<xsl:if test="string-length(.) > 0"> |
|
41 |
<creator> |
|
42 |
<creatorName><xsl:value-of select="."/></creatorName> |
|
43 |
</creator> |
|
44 |
</xsl:if> |
|
45 |
</xsl:for-each> |
|
46 |
</xsl:for-each> |
|
36 |
<xsl:for-each select="//dc:creator"> |
|
37 |
<xsl:for-each select="tokenize(dnet:cleanNames(.), '#')"> |
|
38 |
<xsl:if test="string-length(.) > 0"> |
|
39 |
<creator><xsl:value-of select="."/></creator> |
|
40 |
</xsl:if> |
|
41 |
</xsl:for-each> |
|
42 |
</xsl:for-each> |
|
47 | 43 |
</creators> |
48 |
<titles> |
|
49 |
<xsl:for-each select="//dc:title"> |
|
50 |
<title> |
|
51 |
<xsl:value-of select="."/> |
|
52 |
</title> |
|
53 |
</xsl:for-each> |
|
54 |
</titles> |
|
44 |
|
|
45 |
<publisher><xsl:value-of select="//dc:publisher[1]"/></publisher> |
|
55 | 46 |
|
56 |
<xsl:if test="//dc:publisher"> |
|
57 |
<publisher> |
|
58 |
<xsl:value-of select="//dc:publisher[1]"/> |
|
59 |
</publisher> |
|
60 |
</xsl:if> |
|
61 |
|
|
62 |
<subjects> |
|
63 |
<xsl:for-each select="//dc:subject"> |
|
64 |
<subject> |
|
65 |
<xsl:value-of select="."/> |
|
66 |
</subject> |
|
67 |
</xsl:for-each> |
|
68 |
</subjects> |
|
69 |
|
|
47 |
<subjects> |
|
48 |
<xsl:for-each select="//dc:subject"> |
|
49 |
<subject><xsl:value-of select="."/></subject> |
|
50 |
</xsl:for-each> |
|
51 |
</subjects> |
|
52 |
|
|
70 | 53 |
<contributors> |
71 |
<xsl:for-each select="//dc:contributor"> |
|
72 |
<xsl:for-each select="tokenize(., ',')"> |
|
73 |
<contributor> |
|
74 |
<contributorName> |
|
75 |
<xsl:value-of select="normalize-space(.)"/> |
|
76 |
</contributorName> |
|
77 |
</contributor> |
|
78 |
</xsl:for-each> |
|
79 |
</xsl:for-each> |
|
80 |
</contributors> |
|
81 |
|
|
82 |
<dates> |
|
83 |
<xsl:for-each select="//dc:date"> |
|
84 |
<date dateType="Accepted"> |
|
85 |
<xsl:value-of select="."/> |
|
86 |
</date> |
|
87 |
</xsl:for-each> |
|
88 |
</dates> |
|
89 |
|
|
90 |
<xsl:if test="//dc:language"> |
|
91 |
<language><xsl:value-of select="TransformationFunction:convertString($tf, //dc:language[1], 'Languages')"/></language> |
|
92 |
</xsl:if> |
|
93 |
|
|
94 |
<xsl:for-each select="//dc:type"> |
|
95 |
<resourceType resourceTypeGeneral="Text"> |
|
96 |
<xsl:value-of select="TransformationFunction:convertString($tf, ., 'TextTypologies')" /> |
|
97 |
</resourceType> |
|
98 |
</xsl:for-each> |
|
99 |
|
|
100 |
<alternateIdentifiers> |
|
54 |
<xsl:for-each select="//dc:contributor"> |
|
55 |
<xsl:for-each select="tokenize(., ',')"> |
|
56 |
<contributor><xsl:value-of select="normalize-space(.)"/></contributor> |
|
57 |
</xsl:for-each> |
|
58 |
</xsl:for-each> |
|
59 |
</contributors> |
|
60 |
|
|
61 |
<date><xsl:value-of select="//dc:date[1]"/></date> |
|
62 |
|
|
63 |
<language><xsl:value-of select="TransformationFunction:convertString($tf, //dc:language[1], 'Languages')"/></language> |
|
64 |
|
|
65 |
<type><xsl:value-of select="TransformationFunction:convertString($tf, //dc:type[1], 'TextTypologies')" /></type> |
|
66 |
|
|
67 |
<urls> |
|
101 | 68 |
<xsl:for-each select="//dc:identifier"> |
102 |
<xsl:if test="starts-with(., 'http') and contains(., 'www.cnr.it')"> |
|
103 |
<alternateIdentifier alternateIdentifierType="url" licence="{$rights}" hostedBy="CNR People"><xsl:value-of select="."/></alternateIdentifier> |
|
104 |
</xsl:if> |
|
105 |
<xsl:if test="starts-with(., 'http') and not(contains(., 'dx.doi.org')) and not(contains(., 'www.cnr.it'))"> |
|
106 |
<alternateIdentifier alternateIdentifierType="url" licence="{$rights}" hostedBy="Unknown"><xsl:value-of select="."/></alternateIdentifier> |
|
107 |
</xsl:if> |
|
108 |
<xsl:if test="starts-with(., 'info:doi:')"> |
|
109 |
<xsl:variable name="doi" select="istiFunction:cleanDoi(substring-after(., 'info:doi:'))" /> |
|
110 |
<alternateIdentifier alternateIdentifierType="url" licence="{$rights}" hostedBy="Unknown"><xsl:value-of select="concat('https://dx.doi.org/', $doi)"/></alternateIdentifier> |
|
111 |
<alternateIdentifier alternateIdentifierType="doi"><xsl:value-of select="$doi"/></alternateIdentifier> |
|
112 |
</xsl:if> |
|
69 |
<xsl:if test="starts-with(., 'http') and contains(., 'www.cnr.it')"> |
|
70 |
<url rights="{$rights}" hostedBy="CNR People"><xsl:value-of select="."/></url> |
|
71 |
</xsl:if> |
|
72 |
<xsl:if test="starts-with(., 'http') and not(contains(., 'dx.doi.org')) and not(contains(., 'www.cnr.it'))"> |
|
73 |
<url rights="{$rights}" hostedBy="Unknown"><xsl:value-of select="."/></url> |
|
74 |
</xsl:if> |
|
75 |
<xsl:if test="starts-with(., 'info:doi:')"> |
|
76 |
<xsl:variable name="doi" select="dnet:cleanDoi(substring-after(., 'info:doi:'))" /> |
|
77 |
<url rights="{$rights}" hostedBy="Unknown"><xsl:value-of select="concat('https://dx.doi.org/', $doi)"/></url> |
|
78 |
</xsl:if> |
|
113 | 79 |
</xsl:for-each> |
114 |
</alternateIdentifiers>
|
|
80 |
</urls>
|
|
115 | 81 |
|
116 |
<bestLicence><xsl:value-of select="$rights" /></bestLicence> |
|
82 |
<dois> |
|
83 |
<xsl:for-each select="//dc:identifier"> |
|
84 |
<xsl:if test="starts-with(., 'info:doi:')"> |
|
85 |
<xsl:variable name="doi" select="dnet:cleanDoi(substring-after(., 'info:doi:'))" /> |
|
86 |
<doi><xsl:value-of select="$doi"/></doi> |
|
87 |
</xsl:if> |
|
88 |
</xsl:for-each> |
|
89 |
</dois> |
|
90 |
|
|
91 |
<bestRights><xsl:value-of select="$rights" /></bestRights> |
|
92 |
|
|
93 |
<abstract><xsl:value-of select="//dc:description[1]"/></abstract> |
|
117 | 94 |
|
118 |
<relatedIdentifiers/> |
|
119 |
<sizes/> |
|
120 |
<formats/> |
|
121 |
|
|
122 |
<descriptions> |
|
123 |
<xsl:for-each select="//dc:description"> |
|
124 |
<description descriptionType="Abstract"> |
|
125 |
<xsl:value-of select="."/> |
|
126 |
</description> |
|
127 |
</xsl:for-each> |
|
128 |
</descriptions> |
|
129 |
|
|
130 |
<geoLocations/> |
|
95 |
<source><xsl:value-of select="//dc:source[string-length(.) > 20]" /></source> |
|
131 | 96 |
|
132 |
<sources> |
|
133 |
<xsl:for-each select="//dc:source[string-length(.) > 20]"> |
|
134 |
<source><xsl:value-of select="." /></source> |
|
135 |
</xsl:for-each> |
|
136 |
</sources> |
|
97 |
<projects> |
|
98 |
<xsl:for-each select="//dc:relation[starts-with(., 'info:eu-repo/grantAgreement')]"> |
|
99 |
<xsl:if test="dnet:isValidProject(.)"> |
|
100 |
<project> |
|
101 |
<infoId><xsl:value-of select="." /></infoId> |
|
102 |
<openaireId /> |
|
103 |
<code /> |
|
104 |
<name /> |
|
105 |
<acronym /> |
|
106 |
<funder /> |
|
107 |
<program /> |
|
108 |
<jurisdiction /> |
|
109 |
</project> |
|
110 |
</xsl:if> |
|
111 |
</xsl:for-each> |
|
112 |
</projects> |
|
137 | 113 |
|
138 |
<isti:projects> |
|
139 |
<xsl:for-each select="//dc:relation[starts-with(., 'info:eu-repo/grantAgreement')]"> |
|
140 |
<xsl:if test="istiFunction:isValidProject(.)"> |
|
141 |
<isti:project> |
|
142 |
<isti:infoId><xsl:value-of select="." /></isti:infoId> |
|
143 |
<isti:openaireId /> |
|
144 |
<isti:code /> |
|
145 |
<isti:name /> |
|
146 |
<isti:acronym /> |
|
147 |
<isti:funder /> |
|
148 |
<isti:program /> |
|
149 |
<isti:jurisdiction /> |
|
150 |
</isti:project> |
|
151 |
</xsl:if> |
|
152 |
</xsl:for-each> |
|
153 |
</isti:projects> |
|
114 |
<cnrPersons> |
|
115 |
<xsl:for-each select="//dc:relation[starts-with(., 'info:cnr-pdr/author')]"> |
|
116 |
<cnrPerson> |
|
117 |
<infoId><xsl:value-of select="." /></infoId> |
|
118 |
<name><xsl:value-of select="dnet:calculatePersonName(.)" /></name> |
|
119 |
</cnrPerson> |
|
120 |
</xsl:for-each> |
|
121 |
</cnrPersons> |
|
154 | 122 |
|
155 |
<isti:datasets />
|
|
123 |
<citations />
|
|
156 | 124 |
|
157 |
<isti:persons> |
|
158 |
<xsl:for-each select="//dc:relation[starts-with(., 'info:cnr-pdr/author')]"> |
|
159 |
<isti:person> |
|
160 |
<isti:infoId><xsl:value-of select="." /></isti:infoId> |
|
161 |
<isti:personName><xsl:value-of select="istiFunction:calculatePersonName(.)" /></isti:personName> |
|
162 |
</isti:person> |
|
163 |
</xsl:for-each> |
|
164 |
</isti:persons> |
|
165 |
|
|
166 |
<isti:citations /> |
|
167 |
|
|
168 |
|
|
169 |
</resource> |
|
170 |
|
|
125 |
</record> |
|
126 |
|
|
171 | 127 |
</oai:metadata> |
172 | 128 |
</oai:record> |
173 | 129 |
</xsl:template> |
Also available in: Unified diff
refactoring using jaxb