Revision 62778
Added by Alessia Bardi over 1 year ago
d4science-gCat2datacite.xml | ||
---|---|---|
13 | 13 |
<TITLE>xslt_d4science-catalog_datacite</TITLE> |
14 | 14 |
<CODE> |
15 | 15 |
|
16 |
|
|
17 |
|
|
16 | 18 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
17 | 19 |
xmlns:date="http://exslt.org/dates-and-times" xmlns:oaf="http://namespace.openaire.eu/oaf" |
18 | 20 |
xmlns:oai="http://www.openarchives.org/OAI/2.0/" |
... | ... | |
24 | 26 |
<xsl:output indent="yes"/> |
25 | 27 |
<xsl:param name="varOfficialName"/> |
26 | 28 |
<xsl:param name="varDataSourceId"/> |
29 |
<xsl:variable name="type" select="//extras[./key = 'system:type']/value"/> |
|
27 | 30 |
|
28 | 31 |
<xsl:template match="/"> |
29 |
<xsl:call-template name="createRecord"/> |
|
32 |
|
|
33 |
<xsl:choose> |
|
34 |
<xsl:when |
|
35 |
test="$type = ('Application', 'Dataset', 'Experiment', 'Method', 'TrainingMaterial')"> |
|
36 |
<xsl:call-template name="createRecord"/> |
|
37 |
</xsl:when> |
|
38 |
<xsl:otherwise><xsl:call-template name="terminate"/></xsl:otherwise> |
|
39 |
</xsl:choose> |
|
30 | 40 |
</xsl:template> |
31 | 41 |
|
42 |
<xsl:template name="terminate"> |
|
43 |
<xsl:message terminate="yes"> |
|
44 |
record is not compliant, transformation is interrupted. |
|
45 |
</xsl:message> |
|
46 |
</xsl:template> |
|
47 |
|
|
32 | 48 |
<xsl:template name="createRecord"> |
33 |
<xsl:variable name="type" select="//extras[./key = 'system:type']/value"/> |
|
49 |
|
|
34 | 50 |
<xsl:variable name="publishedDate"> |
35 | 51 |
<xsl:choose> |
36 |
<xsl:when test="$type = 'Experiment'">
|
|
37 |
<xsl:value-of select="substring-before(//metadata_created, ' ' )"/>
|
|
52 |
<xsl:when test="$type = ('Experiment', 'TrainingMaterial')">
|
|
53 |
<xsl:value-of select="substring-before(//metadata_created, ' ')"/> |
|
38 | 54 |
</xsl:when> |
39 | 55 |
<xsl:otherwise> |
40 |
<xsl:value-of select="substring-before(//extras[./key = 'CreationDate']/value, ' ')"/> |
|
56 |
<xsl:value-of |
|
57 |
select="substring-before(//extras[./key = 'CreationDate']/value, ' ')"/> |
|
41 | 58 |
</xsl:otherwise> |
42 | 59 |
</xsl:choose> |
43 | 60 |
</xsl:variable> |
... | ... | |
56 | 73 |
<xsl:value-of select="//data/extras[./key = 'Item URL']/value"/> |
57 | 74 |
</datacite:identifier> |
58 | 75 |
<datacite:alternateIdentifiers> |
59 |
<xsl:for-each select="//data/extras[./key='External Identifier']/value">
|
|
76 |
<xsl:for-each select="//data/extras[./key = 'External Identifier']/value">
|
|
60 | 77 |
<xsl:choose> |
61 | 78 |
<xsl:when test="starts-with(., 'https://doi.org/')"> |
62 | 79 |
<datacite:alternateIdentifier identifierType="doi"> |
63 |
<xsl:value-of select="substring-after(., 'https://doi.org/')"/> |
|
80 |
<xsl:value-of |
|
81 |
select="substring-after(., 'https://doi.org/')"/> |
|
64 | 82 |
</datacite:alternateIdentifier> |
65 | 83 |
</xsl:when> |
66 | 84 |
<xsl:otherwise> |
67 |
<datacite:alternateIdentifier type="URL"><xsl:value-of select="."/> </datacite:alternateIdentifier> |
|
85 |
<datacite:alternateIdentifier type="URL"> |
|
86 |
<xsl:value-of select="."/> |
|
87 |
</datacite:alternateIdentifier> |
|
68 | 88 |
</xsl:otherwise> |
69 | 89 |
</xsl:choose> |
70 | 90 |
</xsl:for-each> |
... | ... | |
93 | 113 |
</datacite:creator> |
94 | 114 |
</xsl:for-each> |
95 | 115 |
</xsl:when> |
116 |
<xsl:when test="$type = 'TrainingMaterial'"> |
|
117 |
<xsl:for-each select="//data/author"> |
|
118 |
<datacite:creator> |
|
119 |
<datacite:creatorName> |
|
120 |
<xsl:value-of select="."/> |
|
121 |
</datacite:creatorName> |
|
122 |
|
|
123 |
</datacite:creator> |
|
124 |
</xsl:for-each> |
|
125 |
</xsl:when> |
|
96 | 126 |
<xsl:otherwise> |
97 | 127 |
<xsl:for-each select="//data/extras[./key = 'Creator']/value"> |
98 | 128 |
<xsl:variable name="tokenizedCreator" select="tokenize(., ',')"/> |
... | ... | |
107 | 137 |
<datacite:nameIdentifier nameIdentifierScheme="ORCID" |
108 | 138 |
schemeURI="http://orcid.org"> |
109 | 139 |
<xsl:value-of |
110 |
select="tokenize($tokenizedCreator[4], '/')[last()]"/> |
|
140 |
select="tokenize($tokenizedCreator[4], '/')[last()]" |
|
141 |
/> |
|
111 | 142 |
</datacite:nameIdentifier> |
112 | 143 |
</xsl:if> |
113 | 144 |
</datacite:creator> |
... | ... | |
154 | 185 |
</xsl:for-each> |
155 | 186 |
</datacite:subjects> |
156 | 187 |
<datacite:formats> |
157 |
<xsl:for-each select="//resources/format"> |
|
188 |
<xsl:for-each |
|
189 |
select="//resources/format | //extras[./key = 'Training material typology']/value"> |
|
158 | 190 |
<datacite:format> |
159 | 191 |
<xsl:value-of select="."/> |
160 | 192 |
</datacite:format> |
... | ... | |
180 | 212 |
<xsl:when test="$type = 'Dataset'"> |
181 | 213 |
<dr:CobjCategory type="dataset">0021</dr:CobjCategory> |
182 | 214 |
</xsl:when> |
215 |
<xsl:when test="$type = 'TrainingMaterial'"> |
|
216 |
<dr:CobjCategory type="other">0020</dr:CobjCategory> |
|
217 |
</xsl:when> |
|
183 | 218 |
<xsl:otherwise> |
184 | 219 |
<dr:CobjCategory type="other">0020</dr:CobjCategory> |
185 | 220 |
</xsl:otherwise> |
... | ... | |
224 | 259 |
</xsl:template> |
225 | 260 |
</xsl:stylesheet> |
226 | 261 |
|
262 |
|
|
227 | 263 |
</CODE> |
228 | 264 |
</SCRIPT> |
229 | 265 |
</CONFIGURATION> |
Also available in: Unified diff
Adapted rule for deliverables from EU Open Data Portal to set links to HE projects (#8800) and mapping for the d4science catalogue