1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
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/"
|
6
|
xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
|
7
|
xmlns:oaf="http://namespace.openaire.eu/oaf"
|
8
|
exclude-result-prefixes="xsl datetime exslt dnet"
|
9
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri">
|
10
|
|
11
|
<xsl:variable name="status" select="/*[local-name() = 'record']/*[local-name() = 'header']/@status" />
|
12
|
|
13
|
<xsl:template match="/">
|
14
|
<oai:record xmlns="http://namespace.openaire.eu/"
|
15
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
16
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
17
|
xmlns:prov="http://www.openarchives.org/OAI/2.0/provenance"
|
18
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
19
|
|
20
|
<xsl:variable name="datestamp" select="datetime:dateTime()" />
|
21
|
|
22
|
<oai:header>
|
23
|
<xsl:if test="\$status">
|
24
|
<xsl:attribute name="status" >
|
25
|
<xsl:value-of select="\$status"/>
|
26
|
</xsl:attribute>
|
27
|
</xsl:if>
|
28
|
<xsl:if test="not(.//dri:objIdentifier)">
|
29
|
<dri:objIdentifier><xsl:value-of select="concat('$namespacePrefix$::', dnet:md5($xpath$))"/></dri:objIdentifier>
|
30
|
</xsl:if>
|
31
|
<xsl:if test="not(.//dri:recordIdentifier)">
|
32
|
<dri:recordIdentifier><xsl:value-of select="$xpath$"/></dri:recordIdentifier>
|
33
|
</xsl:if>
|
34
|
<xsl:if test="not(.//dri:dateOfCollection)">
|
35
|
<dri:dateOfCollection><xsl:value-of select="\$datestamp"/></dri:dateOfCollection>
|
36
|
</xsl:if>
|
37
|
<xsl:if test="not(.//dri:repositoryId)">
|
38
|
<dri:repositoryId>$datasourceId$</dri:repositoryId>
|
39
|
</xsl:if>
|
40
|
<xsl:if test="not(.//oaf:datasourceprefix)">
|
41
|
<oaf:datasourceprefix>$namespacePrefix$</oaf:datasourceprefix>
|
42
|
</xsl:if>
|
43
|
|
44
|
<xsl:for-each select="/*[local-name() = 'record']/*[local-name() = 'header']/*">
|
45
|
<xsl:copy-of select="."/>
|
46
|
</xsl:for-each>
|
47
|
</oai:header>
|
48
|
<xsl:choose>
|
49
|
<xsl:when test="count(/*[local-name() = 'record']/*[local-name() = 'metadata']) > 0">
|
50
|
<xsl:copy-of select="/*[local-name() = 'record']/*[local-name() = 'metadata']"/>
|
51
|
</xsl:when>
|
52
|
<xsl:when test="\$status = 'deleted'" />
|
53
|
<xsl:otherwise>
|
54
|
<oai:metadata>
|
55
|
<xsl:copy-of select="."/>
|
56
|
</oai:metadata>
|
57
|
</xsl:otherwise>
|
58
|
</xsl:choose>
|
59
|
<xsl:if test="not(\$status) or \$status != 'deleted'">
|
60
|
<about>
|
61
|
<provenance xmlns="http://www.openarchives.org/OAI/2.0/provenance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/provenance http://www.openarchives.org/OAI/2.0/provenance.xsd">
|
62
|
<originDescription harvestDate="{\$datestamp}" altered="true">
|
63
|
<baseURL>$baseurl$</baseURL>
|
64
|
<identifier><xsl:value-of select="//*[local-name()='header']/*[local-name()='identifier']"/></identifier>
|
65
|
<datestamp><xsl:value-of select="//*[local-name()='header']/*[local-name()='datestamp']"/></datestamp>
|
66
|
<metadataNamespace>$metadatanamespace$</metadataNamespace>
|
67
|
<xsl:copy-of select="//*[local-name()='provenance']/*[local-name() = 'originDescription']"/>
|
68
|
</originDescription>
|
69
|
</provenance>
|
70
|
<oaf:datainfo>
|
71
|
<oaf:inferred>$inferred$</oaf:inferred>
|
72
|
<oaf:deletedbyinference>$deletedbyinference$</oaf:deletedbyinference>
|
73
|
<oaf:trust>$trust$</oaf:trust>
|
74
|
<oaf:inferenceprovenance>$inferenceprovenance$</oaf:inferenceprovenance>
|
75
|
<oaf:provenanceaction schemename="dnet:provenanceActions" schemeid="dnet:provenanceActions" classname="$provenanceactionclassname$" classid="$provenanceactionclassid$"/>
|
76
|
</oaf:datainfo>
|
77
|
</about>
|
78
|
</xsl:if>
|
79
|
</oai:record>
|
80
|
</xsl:template>
|
81
|
|
82
|
</xsl:stylesheet>
|