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 xsi"
|
9
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri">
|
10
|
|
11
|
<xsl:template match="/">
|
12
|
<oai:record>
|
13
|
<oai:header>
|
14
|
<dri:objIdentifier><xsl:value-of select="concat('$namespacePrefix$::', dnet:md5($xpath$))"/></dri:objIdentifier>
|
15
|
<dri:recordIdentifier><xsl:value-of select="$xpath$"/></dri:recordIdentifier>
|
16
|
<dri:dateOfCollection><xsl:value-of select="datetime:dateTime()"/></dri:dateOfCollection>
|
17
|
<dri:repositoryId>$datasourceId$</dri:repositoryId>
|
18
|
<oaf:datasourceprefix>$namespacePrefix$</oaf:datasourceprefix>
|
19
|
<xsl:for-each select="/*[local-name() = 'record']/*[local-name() = 'header']/*">
|
20
|
<xsl:copy-of select="."/>
|
21
|
</xsl:for-each>
|
22
|
</oai:header>
|
23
|
<xsl:choose>
|
24
|
<xsl:when test="count(/*[local-name() = 'record']/*[local-name() = 'metadata']) > 0">
|
25
|
<xsl:copy-of select="/*[local-name() = 'record']/*[local-name() = 'metadata']"/>
|
26
|
</xsl:when>
|
27
|
<xsl:otherwise>
|
28
|
<oai:metadata>
|
29
|
<xsl:copy-of select="."/>
|
30
|
</oai:metadata>
|
31
|
</xsl:otherwise>
|
32
|
</xsl:choose>
|
33
|
</oai:record>
|
34
|
</xsl:template>
|
35
|
|
36
|
</xsl:stylesheet>
|