Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
4
                xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:datetime="http://exslt.org/dates-and-times"
5
                xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:md="http://www.pangaea.de/MetaData"
6
                xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf"
7
                xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions"
8
                xmlns:stringUtils="org.apache.commons.lang.StringUtils"
9
                version="1.0"
10
                exclude-result-prefixes="xsl dnet oaa fn stringUtils datetime">
11

    
12
	<xsl:param name="namespacePrefix"/>
13
	<xsl:param name="dataprovider_id"/>
14
	<xsl:param name="parentDatasourceId"/>
15
	<xsl:param name="dataprovider_name"/>
16

    
17
	<xsl:template match="/">
18
		<xsl:variable name="identifier">
19
			<xsl:value-of
20
					select="stringUtils:substringAfter(//md:citation/md:URI,'doi:')"/>
21
		</xsl:variable>
22
		<xsl:variable name="identifier_datacite">
23
			<xsl:value-of select="oai:record/oai:header/dri:objIdentifier"/>
24
		</xsl:variable>
25
		<publications>
26
			<xsl:for-each select="//md:citation/md:supplementTo">
27
				<xsl:variable name="pub_identifier">
28
					<xsl:value-of select="./@id"/>
29
				</xsl:variable>
30
				<xsl:choose>
31
					<xsl:when test="string-length($pub_identifier)">
32
						<xsl:call-template name="GeneratePublication">
33
							<xsl:with-param name="pub_identifier" select="$pub_identifier"/>
34
						</xsl:call-template>
35
					</xsl:when>
36
				</xsl:choose>
37
			</xsl:for-each>
38
		</publications>
39
	</xsl:template>
40
	<xsl:template name="GeneratePublication">
41
		<xsl:param name="pub_identifier"/>
42
		<publication>
43
			<oai:record>
44
				<oai:header>
45
					<dri:objIdentifier>
46
						<xsl:value-of
47
								select="concat($namespacePrefix,'::', dnet:md5($pub_identifier))"/>
48
					</dri:objIdentifier>
49
					<dri:recordIdentifier>
50
						<xsl:value-of select="$pub_identifier"/>
51
					</dri:recordIdentifier>
52
					<dri:dateOfCollection>
53
						<xsl:value-of select="datetime:dateTime()"/>
54
					</dri:dateOfCollection>
55
					<dri:repositoryId>
56
						<xsl:value-of select="$dataprovider_id"/>
57
					</dri:repositoryId>
58
					<oaf:datasourceprefix>
59
						<xsl:value-of select="$namespacePrefix"/>
60
					</oaf:datasourceprefix>
61
				</oai:header>
62
				<oai:metadata>
63
					<dc:identifier>
64
						<xsl:value-of select="$pub_identifier"/>
65
					</dc:identifier>
66
					<xsl:variable name="publicationDOI">
67
						<xsl:value-of select="./md:URI"/>
68
					</xsl:variable>
69
					<xsl:choose>
70
						<xsl:when test="string-length($publicationDOI) &gt; 0">
71
							<dc:identifier>
72
								<xsl:value-of select="$publicationDOI"/>
73
							</dc:identifier>
74
						</xsl:when>
75
					</xsl:choose>
76

    
77
					<dc:title>
78
						<xsl:value-of select=".//md:title"/>
79
					</dc:title>
80
					<xsl:for-each select=".//md:author">
81
						<dc:creator>
82
							<xsl:value-of select="concat(./md:lastName,' ', md:firstName)"/>
83
						</dc:creator>
84
					</xsl:for-each>
85
					<dc:source>
86
						<xsl:value-of select="./md:source"/>
87
					</dc:source>
88
					<dr:CobjCategory>0000</dr:CobjCategory>
89
					<dc:language>und</dc:language>
90
					<oaf:journal>
91
						<xsl:value-of select="./md:source"/>
92
					</oaf:journal>
93
					<oaf:accessrights>UNKNOWN</oaf:accessrights>
94
					<xsl:variable name="projectId">
95
						<xsl:value-of select="normalize-space(//*[local-name() ='projectid'])"/>
96
					</xsl:variable>
97
					<xsl:choose>
98
						<xsl:when test="string-length(substring-after($projectId, 'info:eu-repo/grantAgreement/EC/FP7/')) > 0">
99
							<oaf:projectid>
100
								<xsl:value-of
101
										select="concat('corda_______::', substring-after($projectId, 'info:eu-repo/grantAgreement/EC/FP7/'))"/>
102
							</oaf:projectid>
103
						</xsl:when>
104
						<xsl:when test="string-length(substring-after($projectId, 'info:eu-repo/grantAgreement/EC/H2020/')) > 0">
105
							<oaf:projectid>
106
								<xsl:value-of
107
										select="concat('corda_______::', substring-after($projectId, 'info:eu-repo/grantAgreement/EC/H2020/'))"/>
108
							</oaf:projectid>
109
						</xsl:when>
110
						<xsl:otherwise>
111
							<oaf:projectid><xsl:value-of select="$projectId"/></oaf:projectid>
112
						</xsl:otherwise>
113
					</xsl:choose>
114
					<xsl:variable name="journalName">
115
						<xsl:value-of select="//*[local-name() ='journal']/@name"/>
116
					</xsl:variable>
117
					<xsl:variable name="journalISSN">
118
						<xsl:value-of select="//*[local-name() ='journal']/@issn"/>
119
					</xsl:variable>
120
					<xsl:variable name="journalDSId">
121
						<xsl:value-of select="//*[local-name() ='journal']/@datasourceid"/>
122
					</xsl:variable>
123

    
124
					<xsl:choose>
125
						<xsl:when test="string-length($journalISSN) &gt; 0">
126
							<oaf:journal issn="{$journalISSN}" eissn="">
127
								<xsl:value-of select="$journalName"/>
128
							</oaf:journal>
129
							<oaf:hostedBy>
130
								<xsl:attribute name="id">
131
									<xsl:value-of
132
											select="$journalDSId"/>
133
								</xsl:attribute>
134
								<xsl:attribute name="name">
135
									<xsl:value-of
136
											select="$journalName"/>
137
								</xsl:attribute>
138
							</oaf:hostedBy>
139
						</xsl:when>
140
						<xsl:otherwise>
141
							<oaf:hostedBy
142
									id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18" name="Unknown Repository"/>
143
						</xsl:otherwise>
144
					</xsl:choose>
145

    
146

    
147
					<oaf:collectedFrom>
148
						<xsl:attribute name="id">
149
							<xsl:value-of select="$parentDatasourceId"/>
150
						</xsl:attribute>
151
						<xsl:attribute name="name">
152
							<xsl:value-of select="$dataprovider_name"/>
153
						</xsl:attribute>
154
					</oaf:collectedFrom>
155
					<oaf:about>
156
						<oaf:datainfo>
157
							<oaf:inferred>false</oaf:inferred>
158
							<oaf:deletedbyinference>false</oaf:deletedbyinference>
159
							<oaf:trust>0.9</oaf:trust>
160
							<oaf:inferenceprovenance/>
161
							<oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
162
							                      classname="sysimport:crosswalk:datasetarchive" schemeid="dnet:provenanceActions"
163
							                      schemename="dnet:provenanceActions"/>
164
						</oaf:datainfo>
165
					</oaf:about>
166
				</oai:metadata>
167
			</oai:record>
168
		</publication>
169
	</xsl:template>
170
</xsl:stylesheet>
(3-3/3)