1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet version="1.0"
|
3
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
xmlns:datetime="http://exslt.org/dates-and-times" xmlns:exslt="http://exslt.org/common"
|
5
|
xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
7
|
xmlns:oaf="http://namespace.openaire.eu/oaf" exclude-result-prefixes="xsl datetime exslt xsi" >
|
8
|
|
9
|
<!-- <xsl:param name="
|
10
|
repositoryCountry " />
|
11
|
-->
|
12
|
<xsl:param name="repositoryName" />
|
13
|
<!-- <xsl:param name="repositoryLink" /> -->
|
14
|
<xsl:param name="dataSourceId" />
|
15
|
|
16
|
<xsl:template match="/">
|
17
|
<xsl:variable name="datasourcePrefix"
|
18
|
select="normalize-space(//oaf:datasourceprefix)" />
|
19
|
<xsl:variable name="mid"
|
20
|
select="normalize-space(//*[local-name()='identifier' and ./@identifierType='DOI'])" />
|
21
|
<xsl:call-template name="validRecord" />
|
22
|
</xsl:template>
|
23
|
|
24
|
|
25
|
<xsl:template name="validRecord">
|
26
|
<xsl:param name="relatedId" />
|
27
|
|
28
|
<record>
|
29
|
<xsl:copy-of select="//header" />
|
30
|
|
31
|
<metadata>
|
32
|
<xsl:copy-of
|
33
|
select="//*[local-name() = 'metadata']//*[local-name() = 'resource']" />
|
34
|
|
35
|
<oaf:collectedDatasourceid>
|
36
|
<xsl:value-of select="$dataSourceId" />
|
37
|
</oaf:collectedDatasourceid>
|
38
|
<oaf:collectedFrom name="{$repositoryName}" id="{$dataSourceId}" />
|
39
|
<oaf:hostedBy name="{$repositoryName}" id="{$dataSourceId}" />
|
40
|
<xsl:if test="$relatedId">
|
41
|
<xsl:call-template name="processIds">
|
42
|
<xsl:with-param name="s" select="$relatedId" />
|
43
|
</xsl:call-template>
|
44
|
<!-- <oaf:relatedId> <xsl:value-of select="$relatedId"></xsl:value-of></oaf:relatedId> -->
|
45
|
</xsl:if>
|
46
|
<xsl:for-each
|
47
|
select="//*[local-name() = 'contributor' and ./@contributorType='Funder']/*[local-name() = 'nameIdentifier' and starts-with(text(), 'info:eu-repo/grantAgreement/EC/FP7/')]">
|
48
|
<oaf:projectid>
|
49
|
<xsl:value-of
|
50
|
select="concat('corda_______::', substring-after(text(),'info:eu-repo/grantAgreement/EC/FP7/'))" />
|
51
|
</oaf:projectid>
|
52
|
</xsl:for-each>
|
53
|
<xsl:for-each
|
54
|
select="//*[local-name() = 'contributor' and ./@contributorType='Funder']/*[local-name() = 'nameIdentifier' and starts-with(text(), 'info:eu-repo/grantAgreement/WT/WT/')]">
|
55
|
<oaf:projectid>
|
56
|
<xsl:value-of
|
57
|
select="concat('welcometrust::', substring-after(text(),'info:eu-repo/grantAgreement/WT/WT/'))" />
|
58
|
</oaf:projectid>
|
59
|
</xsl:for-each>
|
60
|
</metadata>
|
61
|
</record>
|
62
|
</xsl:template>
|
63
|
|
64
|
<xsl:template name="processIds">
|
65
|
<xsl:param name="s" />
|
66
|
|
67
|
<xsl:choose>
|
68
|
<xsl:when test="contains($s, ',')">
|
69
|
<oaf:relatedId>
|
70
|
<xsl:value-of select="normalize-space(substring-before($s, ','))" />
|
71
|
</oaf:relatedId>
|
72
|
<xsl:call-template name="processIds">
|
73
|
<xsl:with-param name="s" select="substring-after($s, ',')" />
|
74
|
</xsl:call-template>
|
75
|
</xsl:when>
|
76
|
<xsl:otherwise>
|
77
|
<oaf:relatedId>
|
78
|
<xsl:value-of select="normalize-space($s)" />
|
79
|
</oaf:relatedId>
|
80
|
</xsl:otherwise>
|
81
|
</xsl:choose>
|
82
|
|
83
|
</xsl:template>
|
84
|
|
85
|
</xsl:stylesheet>
|