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($projectId) &gt; 0">
99
							<oaf:projectid>
100
								<xsl:value-of
101
										select="concat('corda_______::', stringUtils:substringAfterLast($projectId, '/'))"/>
102
							</oaf:projectid>
103
						</xsl:when>
104
					</xsl:choose>
105
					<xsl:variable name="journalName">
106
						<xsl:value-of select="//*[local-name() ='journal']/@name"/>
107
					</xsl:variable>
108
					<xsl:variable name="journalISSN">
109
						<xsl:value-of select="//*[local-name() ='journal']/@issn"/>
110
					</xsl:variable>
111
					<xsl:variable name="journalDSId">
112
						<xsl:value-of select="//*[local-name() ='journal']/@datasourceid"/>
113
					</xsl:variable>
114

    
115
					<xsl:choose>
116
						<xsl:when test="string-length($journalISSN) &gt; 0">
117
							<oaf:journal issn="{$journalISSN}" eissn="">
118
								<xsl:value-of select="$journalName"/>
119
							</oaf:journal>
120
							<oaf:hostedBy>
121
								<xsl:attribute name="id">
122
									<xsl:value-of
123
											select="$journalDSId"/>
124
								</xsl:attribute>
125
								<xsl:attribute name="name">
126
									<xsl:value-of
127
											select="$journalName"/>
128
								</xsl:attribute>
129
							</oaf:hostedBy>
130
						</xsl:when>
131
						<xsl:otherwise>
132
							<oaf:hostedBy
133
									id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18" name="Unknown Repository"/>
134
						</xsl:otherwise>
135
					</xsl:choose>
136

    
137

    
138
					<oaf:collectedFrom>
139
						<xsl:attribute name="id">
140
							<xsl:value-of select="$parentDatasourceId"/>
141
						</xsl:attribute>
142
						<xsl:attribute name="name">
143
							<xsl:value-of select="$dataprovider_name"/>
144
						</xsl:attribute>
145
					</oaf:collectedFrom>
146
					<oaf:about>
147
						<oaf:datainfo>
148
							<oaf:inferred>false</oaf:inferred>
149
							<oaf:deletedbyinference>false</oaf:deletedbyinference>
150
							<oaf:trust>0.9</oaf:trust>
151
							<oaf:inferenceprovenance/>
152
							<oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
153
							                      classname="sysimport:crosswalk:datasetarchive" schemeid="dnet:provenanceActions"
154
							                      schemename="dnet:provenanceActions"/>
155
						</oaf:datainfo>
156
					</oaf:about>
157
				</oai:metadata>
158
			</oai:record>
159
		</publication>
160
	</xsl:template>
161
</xsl:stylesheet>
(3-3/6)