Project

General

Profile

« Previous | Next » 

Revision 55116

Tagging for elixir-gr based on the list of tools. Everything related to the concept has been grouped in the same section of the xslt.

View differences:

modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/xslt_cleaning_ORP-biotools.xml
12 12
			<SCRIPT>
13 13
				<TITLE>xslt_cleaning_ORP-biotools</TITLE>
14 14
				<CODE><![CDATA[
15
				<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
16
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:xs="http://www.w3.org/2001/XMLSchema"
17
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
18
    xmlns:datacite="http://datacite.org/schema/kernel-4" xmlns:functx="http://www.functx.com"
19
    xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
20
    extension-element-prefixes="TransformationFunction"
21
    exclude-result-prefixes="TransformationFunction">
22

  
23
    <xsl:function xmlns:functx="http://www.functx.com" name="functx:value-intersect" as="xs:anyAtomicType*">
24
        <xsl:param name="arg1" as="xs:anyAtomicType*"/>
25
        <xsl:param name="arg2" as="xs:anyAtomicType*"/>
26
        <xsl:sequence select=" distinct-values($arg1[.=$arg2]) "/>
27
    </xsl:function>
28

  
29
    <xsl:param name="varOfficialName"/>
30
    <xsl:param name="varDsType"/>
31
    <xsl:param name="varDataSourceId"/>
32
    <xsl:param name="index" select="0"/>
33
    <xsl:param name="transDate" select="current-dateTime()"/>
34
    <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
35

  
36
	<!-- TODO: ADD HERE THE LIST OF AUTHORS' EMAILS-->
37
    <xsl:variable name="elixirGRAuthorMails" select="()"/>
38
    
39
    <xsl:template match="/">
40
        <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
41
        <xsl:call-template name="validRecord"/>
42
    </xsl:template>
43

  
44
    <xsl:template name="terminate">
45
        <xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
15
				 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:datacite="http://datacite.org/schema/kernel-4" xmlns:functx="http://www.functx.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy" xmlns:dr="http://www.driver-repository.eu/namespace/dr" exclude-result-prefixes="TransformationFunction" extension-element-prefixes="TransformationFunction" version="2.0">
16
                        <xsl:function as="xs:anyAtomicType*" name="functx:value-intersect">
17
                            <xsl:param as="xs:anyAtomicType*" name="arg1"/>
18
                            <xsl:param as="xs:anyAtomicType*" name="arg2"/>
19
                            <xsl:sequence select=" distinct-values($arg1[.=$arg2]) "/>
20
                        </xsl:function>
21
                        <xsl:param name="varOfficialName"/>
22
                        <xsl:param name="varDsType"/>
23
                        <xsl:param name="varDataSourceId"/>
24
                        <xsl:param name="index" select="0"/>
25
                        <xsl:param name="transDate" select="current-dateTime()"/>
26
                        <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
27
                        <xsl:template match="/">
28
                            <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
29
                            <xsl:call-template name="validRecord"/>
30
                        </xsl:template>
31
                        <xsl:template name="terminate">
32
                            <xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
46 33
        </xsl:message>
47
    </xsl:template>
48

  
49
    <xsl:template name="validRecord">
50
        <record>
51
            <xsl:apply-templates select="//*[local-name() = 'header']"/>
52

  
53
            <metadata>
54

  
55
                <!--
34
                        </xsl:template>
35
                        <xsl:template name="validRecord">
36
                            <record>
37
                                <xsl:apply-templates select="//*[local-name() = 'header']"/>
38
                                <metadata><!--
56 39
									<xsl:apply-templates select="//*[local-name() = 'metadata']//*[local-name() = 'list']"/>
57 40
									-->
58

  
59
                <datacite:resource>
60

  
61

  
62
                    <datacite:resourceType>
63
                        <xsl:attribute name="resourceTypeGeneral" select="'Software'"/>
64
                        <xsl:value-of select="//*[local-name() = 'toolType']"/>
65
                    </datacite:resourceType>
66

  
67
                    <xsl:for-each select="//*[local-name() = 'language']">
68
                        <datacite:format>
69
                            <xsl:value-of select="."/>
70
                        </datacite:format>
71
                    </xsl:for-each>
72

  
73
                    <!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE
41
                                    <datacite:resource>
42
                                        <datacite:resourceType>
43
                                            <xsl:attribute name="resourceTypeGeneral" select="'Software'"/>
44
                                            <xsl:value-of select="//*[local-name() = 'toolType']"/>
45
                                        </datacite:resourceType>
46
                                        <xsl:for-each select="//*[local-name() = 'language']">
47
                                            <datacite:format>
48
                                                <xsl:value-of select="."/>
49
                                            </datacite:format>
50
                                        </xsl:for-each><!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE
74 51
										-->
75

  
76
                    <datacite:publisher>
77
                        <xsl:value-of select="$varOfficialName"/>
78
                    </datacite:publisher>
79

  
80
                    <datacite:relatedIdentifiers>
81
                        <xsl:for-each
82
                            select="//*[local-name() = 'documentation'][not(./*[local-name() = 'type'] = ('Terms of use', 'Citation instructions', 'Contributions policy', 'Governance'))]">
83
                            <datacite:relatedIdentifier>
84
                                <xsl:attribute name="relatedIdentifierType" select="'URL'"/>
85
                                <xsl:attribute name="relationType" select="'IsDocumentedBy'"/>
86
                                <xsl:value-of select="./*[local-name() = 'url']"/>
87
                            </datacite:relatedIdentifier>
88
                        </xsl:for-each>
89
                        <!-- paper references -->
90
                        <xsl:call-template name="relatedPaper"/>
91
                    </datacite:relatedIdentifiers>
92

  
93
                    <datacite:alternateIdentifiers>
94
                        <!-- landing page, documentation, distribution -->
95
                        <datacite:alternateIdentifier>
96
                            <xsl:attribute name="alternateIdentifierType" select="'LandingPage'"/>
97
                            <xsl:value-of
98
                                select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
99
                        </datacite:alternateIdentifier>
100

  
101
                        <!--
52
                                        <datacite:publisher>
53
                                            <xsl:value-of select="$varOfficialName"/>
54
                                        </datacite:publisher>
55
                                        <datacite:relatedIdentifiers>
56
                                            <xsl:for-each select="//*[local-name() = 'documentation'][not(./*[local-name() = 'type'] = ('Terms of use', 'Citation instructions', 'Contributions policy', 'Governance'))]">
57
                                                <datacite:relatedIdentifier>
58
                                                    <xsl:attribute name="relatedIdentifierType" select="'URL'"/>
59
                                                    <xsl:attribute name="relationType" select="'IsDocumentedBy'"/>
60
                                                    <xsl:value-of select="./*[local-name() = 'url']"/>
61
                                                </datacite:relatedIdentifier>
62
                                            </xsl:for-each><!-- paper references -->
63
                                            <xsl:call-template name="relatedPaper"/>
64
                                        </datacite:relatedIdentifiers>
65
                                        <datacite:alternateIdentifiers><!-- landing page, documentation, distribution -->
66
                                            <datacite:alternateIdentifier>
67
                                                <xsl:attribute name="alternateIdentifierType" select="'LandingPage'"/>
68
                                                <xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
69
                                            </datacite:alternateIdentifier><!--
102 70
											<xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[local-name() = 'link'][./*[local-name() = 'url' and starts-with(., 'https://github.com/')]]/*[local-name() = 'url']/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
103 71
											-->
104
                        <xsl:for-each
105
                            select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[starts-with(., 'https://github.com/') and contains(., concat('/', //*[local-name() = 'id']))]/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
106
                            <datacite:alternateIdentifier>
107
                                <xsl:attribute name="alternateIdentifierType"
108
                                    select="'DistributionLocation'"/>
109
                                <xsl:value-of select="."/>
110
                            </datacite:alternateIdentifier>
111
                        </xsl:for-each>
112

  
113
                        <!-- identifier -->
114
                        <datacite:alternateIdentifier>
115
                            <xsl:attribute name="alternateIdentifierType"
116
                                select="'local accession id'"/>
117
                            <xsl:value-of select="//*[local-name() = 'id']"/>
118
                        </datacite:alternateIdentifier>
119
                    </datacite:alternateIdentifiers>
120

  
121
                    <datacite:identifier>
122
                        <xsl:attribute name="identifierType" select="'URL'"/>
123
                        <xsl:value-of
124
                            select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
125
                    </datacite:identifier>
126

  
127
                    <!-- title -->
128
                    <datacite:titles>
129
                        <datacite:title>
130
                            <xsl:value-of
131
                                select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
132
                        </datacite:title>
133
                    </datacite:titles>
134

  
135
                    <!-- version -->
136
                    <xsl:if
137
                        test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
138
                        <datacite:version>
139
                            <xsl:value-of
140
                                select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"
141
                            />
142
                        </datacite:version>
143
                    </xsl:if>
144

  
145
                    <!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
146
                    <xsl:call-template name="authors"/>
147

  
148
                    <datacite:contributors>
149
                        <xsl:for-each
150
                            select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
151
                            <xsl:variable name="varContributorName"
152
                                select="TransformationFunction:convertString($tf, ., 'Person')"/>
153
                            <datacite:contributor>
154
                                <xsl:attribute name="contributorType" select="'ContactPerson'"/>
155
                                <datacite:contributorName>
156
                                    <xsl:value-of select="$varContributorName"/>
157
                                </datacite:contributorName>
158
                                <datacite:givenName>
159
                                    <xsl:value-of
160
                                        select="substring-after($varContributorName, ', ')"/>
161
                                </datacite:givenName>
162
                                <datacite:familyName>
163
                                    <xsl:value-of
164
                                        select="substring-before($varContributorName, ', ')"/>
165
                                </datacite:familyName>
166
                            </datacite:contributor>
167
                        </xsl:for-each>
168
                    </datacite:contributors>
169

  
170
                    <datacite:descriptions>
171
                        <datacite:description>
172
                            <xsl:attribute name="descriptionType">
173
                                <xsl:value-of select="'Abstract'"/>
174
                            </xsl:attribute>
175
                            <xsl:value-of select="//*[local-name() = 'description']"/>
176
                        </datacite:description>
177

  
178
                        <!--
72
                                            <xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[starts-with(., 'https://github.com/') and contains(., concat('/', //*[local-name() = 'id']))]/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
73
                                                <datacite:alternateIdentifier>
74
                                                    <xsl:attribute name="alternateIdentifierType" select="'DistributionLocation'"/>
75
                                                    <xsl:value-of select="."/>
76
                                                </datacite:alternateIdentifier>
77
                                            </xsl:for-each><!-- identifier -->
78
                                            <datacite:alternateIdentifier>
79
                                                <xsl:attribute name="alternateIdentifierType" select="'local accession id'"/>
80
                                                <xsl:value-of select="//*[local-name() = 'id']"/>
81
                                            </datacite:alternateIdentifier>
82
                                        </datacite:alternateIdentifiers>
83
                                        <datacite:identifier>
84
                                            <xsl:attribute name="identifierType" select="'URL'"/>
85
                                            <xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
86
                                        </datacite:identifier><!-- title -->
87
                                        <datacite:titles>
88
                                            <datacite:title>
89
                                                <xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
90
                                            </datacite:title>
91
                                        </datacite:titles><!-- version -->
92
                                        <xsl:if test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
93
                                            <datacite:version>
94
                                                <xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"/>
95
                                            </datacite:version>
96
                                        </xsl:if><!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
97
                                        <xsl:call-template name="authors"/>
98
                                        <datacite:contributors>
99
                                            <xsl:for-each select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
100
                                                <xsl:variable name="varContributorName" select="TransformationFunction:convertString($tf, ., 'Person')"/>
101
                                                <datacite:contributor>
102
                                                    <xsl:attribute name="contributorType" select="'ContactPerson'"/>
103
                                                    <datacite:contributorName>
104
                                                        <xsl:value-of select="$varContributorName"/>
105
                                                    </datacite:contributorName>
106
                                                    <datacite:givenName>
107
                                                        <xsl:value-of select="substring-after($varContributorName, ', ')"/>
108
                                                    </datacite:givenName>
109
                                                    <datacite:familyName>
110
                                                        <xsl:value-of select="substring-before($varContributorName, ', ')"/>
111
                                                    </datacite:familyName>
112
                                                </datacite:contributor>
113
                                            </xsl:for-each>
114
                                        </datacite:contributors>
115
                                        <datacite:descriptions>
116
                                            <datacite:description>
117
                                                <xsl:attribute name="descriptionType">
118
                                                    <xsl:value-of select="'Abstract'"/>
119
                                                </xsl:attribute>
120
                                                <xsl:value-of select="//*[local-name() = 'description']"/>
121
                                            </datacite:description><!--
179 122
											<xsl:for-each select="//*[local-name() = 'operatingSystem'], //*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
180 123
											-->
181

  
182
                        <xsl:for-each
183
                            select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
184
                            <datacite:description>
185
                                <xsl:attribute name="descriptionType" select="'Abstract'"/>
186
                                <xsl:value-of select="."/>
187
                            </datacite:description>
188
                        </xsl:for-each>
189

  
190
                        <xsl:for-each select="//*[local-name() = 'operatingSystem']">
191
                            <datacite:description>
192
                                <xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
193
                                <xsl:value-of select="."/>
194
                            </datacite:description>
195
                        </xsl:for-each>
196

  
197
                    </datacite:descriptions>
198

  
199
                    <!-- subject -->
200
                    <!-- dropping duplicate topics - funny that this seemingly works -->
201
                    <datacite:subjects>
202
                        <xsl:for-each
203
                            select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
204
                            <xsl:if test=".">
205
                                <datacite:subject>
206
                                    <xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
207
                                    <xsl:attribute name="schemeURI"
208
                                        select="'http://edamontology.org'"/>
209
                                    <xsl:attribute name="valueURI"
210
                                        select="./*[local-name() = 'uri']"/>
211
                                    <xsl:value-of select="./*[local-name() = 'term']"/>
212
                                </datacite:subject>
213
                            </xsl:if>
214
                        </xsl:for-each>
215
                    </datacite:subjects>
216

  
217
                </datacite:resource>
218

  
219
                <!--
124
                                            <xsl:for-each select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
125
                                                <datacite:description>
126
                                                    <xsl:attribute name="descriptionType" select="'Abstract'"/>
127
                                                    <xsl:value-of select="."/>
128
                                                </datacite:description>
129
                                            </xsl:for-each>
130
                                            <xsl:for-each select="//*[local-name() = 'operatingSystem']">
131
                                                <datacite:description>
132
                                                    <xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
133
                                                    <xsl:value-of select="."/>
134
                                                </datacite:description>
135
                                            </xsl:for-each>
136
                                        </datacite:descriptions><!-- subject --><!-- dropping duplicate topics - funny that this seemingly works -->
137
                                        <datacite:subjects>
138
                                            <xsl:for-each select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
139
                                                <xsl:if test=".">
140
                                                    <datacite:subject>
141
                                                        <xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
142
                                                        <xsl:attribute name="schemeURI" select="'http://edamontology.org'"/>
143
                                                        <xsl:attribute name="valueURI" select="./*[local-name() = 'uri']"/>
144
                                                        <xsl:value-of select="./*[local-name() = 'term']"/>
145
                                                    </datacite:subject>
146
                                                </xsl:if>
147
                                            </xsl:for-each>
148
                                        </datacite:subjects>
149
                                    </datacite:resource><!--
220 150
									CobjCategory, SuperType
221 151
									-->
222
                <xsl:variable name="varCobjCategory" select="'0029'"/>
223
                <xsl:variable name="varSuperType"
224
                    select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
225
                <dr:CobjCategory>
226
                    <xsl:attribute name="type" select="$varSuperType"/>
227
                    <xsl:value-of select="$varCobjCategory"/>
228
                </dr:CobjCategory>
229

  
230
                <!--
152
                                    <xsl:variable name="varCobjCategory" select="'0029'"/>
153
                                    <xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
154
                                    <dr:CobjCategory>
155
                                        <xsl:attribute name="type" select="$varSuperType"/>
156
                                        <xsl:value-of select="$varCobjCategory"/>
157
                                    </dr:CobjCategory><!--
231 158
									access rights, licenses
232 159
									-->
233
                <xsl:for-each
234
                    select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
235
                    <oaf:accessrights>
236
                        <xsl:variable name="varAccessRights"
237
                            select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
238
                        <xsl:choose>
239
                            <xsl:when
240
                                test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
241
                                <xsl:value-of select="'OPEN SOURCE'"/>
242
                            </xsl:when>
243
                            <xsl:otherwise>
244
                                <xsl:value-of select="$varAccessRights"/>
245
                            </xsl:otherwise>
246
                        </xsl:choose>
247
                    </oaf:accessrights>
248
                </xsl:for-each>
249

  
250
                <xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
251
                    <oaf:license>
252
                        <xsl:value-of select="."/>
253
                    </oaf:license>
254
                </xsl:for-each>
255

  
256
                <oaf:hostedBy>
257
                    <xsl:attribute name="name" select="$varOfficialName"/>
258
                    <xsl:attribute name="id" select="$varDataSourceId"/>
259
                </oaf:hostedBy>
260
                <oaf:collectedFrom>
261
                    <xsl:attribute name="name" select="$varOfficialName"/>
262
                    <xsl:attribute name="id" select="$varDataSourceId"/>
263
                </oaf:collectedFrom>
264

  
265
                <!--
160
                                    <xsl:for-each select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
161
                                        <oaf:accessrights>
162
                                            <xsl:variable name="varAccessRights" select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
163
                                            <xsl:choose>
164
                                                <xsl:when test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
165
                                                    <xsl:value-of select="'OPEN SOURCE'"/>
166
                                                </xsl:when>
167
                                                <xsl:otherwise>
168
                                                    <xsl:value-of select="$varAccessRights"/>
169
                                                </xsl:otherwise>
170
                                            </xsl:choose>
171
                                        </oaf:accessrights>
172
                                    </xsl:for-each>
173
                                    <xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
174
                                        <oaf:license>
175
                                            <xsl:value-of select="."/>
176
                                        </oaf:license>
177
                                    </xsl:for-each>
178
                                    <oaf:hostedBy>
179
                                        <xsl:attribute name="name" select="$varOfficialName"/>
180
                                        <xsl:attribute name="id" select="$varDataSourceId"/>
181
                                    </oaf:hostedBy>
182
                                    <oaf:collectedFrom>
183
                                        <xsl:attribute name="name" select="$varOfficialName"/>
184
                                        <xsl:attribute name="id" select="$varDataSourceId"/>
185
                                    </oaf:collectedFrom><!--
266 186
									<oaf:identifier>
267 187
									<xsl:value-of select="//*[local-name() = 'id']"/>
268 188
									</oaf:identifier>
269 189
									-->
270

  
271
                <!-- Check for person emails and elixirNode if we can set the concept for ELIXIR-GR -->
272
                <xsl:variable name="authorMails" select="//credit/email"/>
273
                <xsl:if test="//elixirNode/text() = 'Greece' or /list/name/text() or count(functx:value-intersect($authorMails, $elixirGRAuthorMails)) > 0">
274
                    <oaf:concept>
275
                        <xsl:attribute name="id" select="'elixir-gr'"/>
276
                    </oaf:concept>
277
                </xsl:if>
278

  
279

  
280
                <!-- date -->
281
                <oaf:dateAccepted>
282
                    <xsl:value-of
283
                        select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
284
                </oaf:dateAccepted>
285

  
286
            </metadata>
287
            <xsl:copy-of select="//*[local-name() = 'about']"/>
288
        </record>
289

  
290
    </xsl:template>
291

  
292
    <xsl:template match="node() | @*">
293
        <xsl:copy>
294
            <xsl:apply-templates select="node() | @*"/>
295
        </xsl:copy>
296
    </xsl:template>
297

  
298
    <xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
299
        <xsl:copy>
300
            <xsl:apply-templates select="node() | @*"/>
301
        </xsl:copy>
302
    </xsl:template>
303

  
304
    <xsl:template match="//*[local-name() = 'header']">
305
        <xsl:copy>
306
            <xsl:apply-templates select="node() | @*"/>
307
            <xsl:element name="dr:dateOfTransformation">
308
                <xsl:value-of select="$transDate"/>
309
            </xsl:element>
310
        </xsl:copy>
311
    </xsl:template>
312

  
313
<xsl:template name="authors">
314
        <!-- Allowed roles :
190
                                    <xsl:variable name="elixirGRAuthorMails" select="()"/>
191
                                    <xsl:variable name="elixirGRTools" select="('FINDbase','DruGeVar','ePGA','easyFRAP','CHRONOS','DEsubs','PICKLE','ANASTASIA','BioTranslator','metaseqR','recoup','ACT','Proteosign','BioTextQuest(+)','SCENERY','MXM','PRED-TMBB2','PRED-TAT','PRED-SIGNAL','PRED-LIPO','OMPdb','GWAR','METAGEN','DIANA-mirExTra','DIANA-mirPath','DIANA-microT','microTSS','DIANA-miRGen','DIANA-LNCBase','Network Analyzer','Variant Ranker','','GWAS Training','GprotPRED','AMYL-PRED 2','SymCurv','RNEA','BUFET','BiP finder','MR-microT&#160;','M-IOLITE','PICKLE','MESBL GC-MS metabolite peak database','3DMem-enzyme','Micro-CTvlab','g-Class','Align Paths','BPM','haplotypeAnalysisPipeline','Mutations-Meta-Analyser ','TRES','MiGA')"/>
192
                                    <xsl:variable name="authorMails" select="//credit/email"/>
193
                                    <xsl:if test="//elixirNode/text() = 'Greece' or $elixirGRTools=/list/name/text() or count(functx:value-intersect($authorMails, $elixirGRAuthorMails)) &gt; 0">
194
                                        <oaf:concept>
195
                                            <xsl:attribute name="id" select="'elixir-gr'"/>
196
                                        </oaf:concept>
197
                                    </xsl:if><!-- date -->
198
                                    <oaf:dateAccepted>
199
                                        <xsl:value-of select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
200
                                    </oaf:dateAccepted>
201
                                </metadata>
202
                                <xsl:copy-of select="//*[local-name() = 'about']"/>
203
                            </record>
204
                        </xsl:template>
205
                        <xsl:template match="node() | @*">
206
                            <xsl:copy>
207
                                <xsl:apply-templates select="node() | @*"/>
208
                            </xsl:copy>
209
                        </xsl:template>
210
                        <xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
211
                            <xsl:copy>
212
                                <xsl:apply-templates select="node() | @*"/>
213
                            </xsl:copy>
214
                        </xsl:template>
215
                        <xsl:template match="//*[local-name() = 'header']">
216
                            <xsl:copy>
217
                                <xsl:apply-templates select="node() | @*"/>
218
                                <xsl:element name="dr:dateOfTransformation">
219
                                    <xsl:value-of select="$transDate"/>
220
                                </xsl:element>
221
                            </xsl:copy>
222
                        </xsl:template>
223
                        <xsl:template name="authors"><!-- Allowed roles :
315 224
            Developer
316 225
            Maintainer
317 226
            Provider
......
321 230
            Primary contact
322 231
            We'll consider Developer and Primary Contact as authors.
323 232
        -->
324
        <xsl:choose>
325
            <xsl:when
326
                test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]][./*[local-name() = 'name' and not(. = 'null')]])">
327
                <xsl:call-template name="terminate"/>
328
            </xsl:when>
329
            <xsl:otherwise>
330
                <creators>
331
                    <xsl:for-each
332
                        select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]]/*[local-name() = 'name' and not(. = 'null')]">
333
                        <xsl:for-each select="tokenize(., ', ')">
334
                            <xsl:variable name="varDeveloperName"
335
                                select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
336
                            <creator>
337
                                <creatorName>
338
                                    <xsl:value-of select="$varDeveloperName"/>
339
                                </creatorName>
340
                                <givenName>
341
                                    <xsl:value-of select="substring-after($varDeveloperName, ', ')"
342
                                    />
343
                                </givenName>
344
                                <familyName>
345
                                    <xsl:value-of select="substring-before($varDeveloperName, ', ')"
346
                                    />
347
                                </familyName>
348
                                <!-- TODO: change the loop so we can set the ORICD id -->
349
                                <!--<xsl:if
350
                                    test="string-length(./*[local-name() = 'orcidId']) > 0 and ./*[local-name() = 'orcidId'] != 'null'">
351
                                    <nameIdentifier nameIdentifierScheme="ORCID"
352
                                        schemeURI="https://orcid.org">
353
                                        <xsl:value-of select="./*[local-name() = 'orcidId']"/>
354
                                    </nameIdentifier>
355
                                </xsl:if>
356
                                -->
357
                            </creator>
358
                        </xsl:for-each>
359
                    </xsl:for-each>
360
                </creators>
361
            </xsl:otherwise>
362
        </xsl:choose>
363
    </xsl:template>
364

  
365
    <!--
233
                            <xsl:choose>
234
                                <xsl:when test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]][./*[local-name() = 'name' and not(. = 'null')]])">
235
                                    <xsl:call-template name="terminate"/>
236
                                </xsl:when>
237
                                <xsl:otherwise>
238
                                    <creators>
239
                                        <xsl:for-each select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]]/*[local-name() = 'name' and not(. = 'null')]">
240
                                            <xsl:for-each select="tokenize(., ', ')">
241
                                                <xsl:variable name="varDeveloperName" select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
242
                                                <creator>
243
                                                    <creatorName>
244
                                                        <xsl:value-of select="$varDeveloperName"/>
245
                                                    </creatorName>
246
                                                    <givenName>
247
                                                        <xsl:value-of select="substring-after($varDeveloperName, ', ')"/>
248
                                                    </givenName>
249
                                                    <familyName>
250
                                                        <xsl:value-of select="substring-before($varDeveloperName, ', ')"/>
251
                                                    </familyName>
252
                                                </creator>
253
                                            </xsl:for-each>
254
                                        </xsl:for-each>
255
                                    </creators>
256
                                </xsl:otherwise>
257
                            </xsl:choose>
258
                        </xsl:template><!--
366 259
						<xsl:template match="//*[local-name() = 'DOI']">
367 260
						-->
368
    <xsl:template name="relatedPaper">
369
        <xsl:for-each
370
            select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
371
            <xsl:element name="datacite:relatedIdentifier">
372
                <xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
373
                <xsl:attribute name="relationType">
374
                    <xsl:choose>
375
                        <xsl:when test="../*[local-name() = 'type'] = 'Primary'">
376
                            <xsl:value-of select="'isSupplementTo'"/>
377
                        </xsl:when>
378
                        <xsl:when
379
                            test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
380
                            <xsl:value-of select="'isReviewedBy'"/>
381
                        </xsl:when>
382
                        <xsl:when test="../*[local-name() = 'type'] = 'Usage'">
383
                            <xsl:value-of select="'isReferencedBy'"/>
384
                        </xsl:when>
385
                        <xsl:when test="../*[local-name() = 'type'] = 'Method'">
386
                            <xsl:value-of select="'references'"/>
387
                        </xsl:when>
388
                        <xsl:otherwise>
389
                            <xsl:value-of select="'isReferencedBy'"/>
390
                        </xsl:otherwise>
391
                    </xsl:choose>
392
                </xsl:attribute>
393
                <xsl:value-of select="."/>
394
            </xsl:element>
395
        </xsl:for-each>
396
    </xsl:template>
397

  
398
</xsl:stylesheet>
261
                        <xsl:template name="relatedPaper">
262
                            <xsl:for-each select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
263
                                <xsl:element name="datacite:relatedIdentifier">
264
                                    <xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
265
                                    <xsl:attribute name="relationType">
266
                                        <xsl:choose>
267
                                            <xsl:when test="../*[local-name() = 'type'] = 'Primary'">
268
                                                <xsl:value-of select="'isSupplementTo'"/>
269
                                            </xsl:when>
270
                                            <xsl:when test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
271
                                                <xsl:value-of select="'isReviewedBy'"/>
272
                                            </xsl:when>
273
                                            <xsl:when test="../*[local-name() = 'type'] = 'Usage'">
274
                                                <xsl:value-of select="'isReferencedBy'"/>
275
                                            </xsl:when>
276
                                            <xsl:when test="../*[local-name() = 'type'] = 'Method'">
277
                                                <xsl:value-of select="'references'"/>
278
                                            </xsl:when>
279
                                            <xsl:otherwise>
280
                                                <xsl:value-of select="'isReferencedBy'"/>
281
                                            </xsl:otherwise>
282
                                        </xsl:choose>
283
                                    </xsl:attribute>
284
                                    <xsl:value-of select="."/>
285
                                </xsl:element>
286
                            </xsl:for-each>
287
                        </xsl:template>
288
                    </xsl:stylesheet>
399 289
]]>
400 290
				</CODE>
401 291
			</SCRIPT>

Also available in: Unified diff