1 |
26600
|
sandro.lab
|
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
28688
|
michele.ar
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3 |
31972
|
andrea.man
|
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 |
32397
|
andrea.man
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
8 |
|
|
exclude-result-prefixes="xsl datetime exslt dnet">
|
9 |
31972
|
andrea.man
|
|
10 |
|
|
<xsl:variable name="status" select="/*[local-name() = 'record']/*[local-name() = 'header']/@status" />
|
11 |
|
|
|
12 |
|
|
<xsl:template match="/">
|
13 |
|
|
<oai:record xmlns="http://namespace.openaire.eu/"
|
14 |
|
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
15 |
|
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
16 |
|
|
xmlns:prov="http://www.openarchives.org/OAI/2.0/provenance"
|
17 |
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
18 |
|
|
|
19 |
|
|
<!-- Patch OAI header or create ex-novo if not oai -->
|
20 |
|
|
<oai:header>
|
21 |
|
|
<xsl:if test="\$status">
|
22 |
|
|
<xsl:attribute name="status" >
|
23 |
|
|
<xsl:value-of select="\$status"/>
|
24 |
|
|
</xsl:attribute>
|
25 |
|
|
</xsl:if>
|
26 |
|
|
<xsl:if test="not(.//dri:objIdentifier)">
|
27 |
|
|
<dri:objIdentifier><xsl:value-of select="concat('$namespacePrefix$::', dnet:md5($xpath$))"/></dri:objIdentifier>
|
28 |
|
|
</xsl:if>
|
29 |
|
|
<xsl:if test="not(.//dri:recordIdentifier)">
|
30 |
|
|
<dri:recordIdentifier><xsl:value-of select="$xpath$"/></dri:recordIdentifier>
|
31 |
|
|
</xsl:if>
|
32 |
|
|
<xsl:if test="not(.//dri:dateOfCollection)">
|
33 |
|
|
<dri:dateOfCollection><xsl:value-of select="datetime:dateTime()"/></dri:dateOfCollection>
|
34 |
|
|
</xsl:if>
|
35 |
32899
|
andrea.man
|
<xsl:if test="not(.//dri:repositoryId)">
|
36 |
|
|
<dri:repositoryId>$datasourceId$</dri:repositoryId>
|
37 |
|
|
</xsl:if>
|
38 |
31972
|
andrea.man
|
<xsl:if test="not(.//dri:datasourceprefix)">
|
39 |
|
|
<dri:datasourceprefix>$namespacePrefix$</dri:datasourceprefix>
|
40 |
|
|
</xsl:if>
|
41 |
|
|
|
42 |
|
|
<!-- Bulk copy of old header -->
|
43 |
|
|
<xsl:for-each select="/*[local-name() = 'record']/*[local-name() = 'header']/*">
|
44 |
|
|
<xsl:copy-of select="."/>
|
45 |
|
|
</xsl:for-each>
|
46 |
|
|
</oai:header>
|
47 |
|
|
|
48 |
|
|
<!-- Handle metadata block -->
|
49 |
|
|
<xsl:choose>
|
50 |
|
|
<!-- If OAI then copy copy the metadata block along -->
|
51 |
|
|
<xsl:when test="count(/*[local-name() = 'record']/*[local-name() = 'metadata']) > 0">
|
52 |
|
|
<xsl:copy-of select="/*[local-name() = 'record']/*[local-name() = 'metadata']"/>
|
53 |
|
|
</xsl:when>
|
54 |
|
|
<!-- If OAI copy in bulk the metadata block -->
|
55 |
|
|
<xsl:when test="\$status = 'deleted'" />
|
56 |
|
|
<!-- If not-OAI copy ALL the record inside metadata block -->
|
57 |
|
|
<xsl:otherwise>
|
58 |
|
|
<oai:metadata>
|
59 |
|
|
<xsl:copy-of select="."/>
|
60 |
|
|
</oai:metadata>
|
61 |
|
|
</xsl:otherwise>
|
62 |
|
|
</xsl:choose>
|
63 |
|
|
</oai:record>
|
64 |
|
|
</xsl:template>
|
65 |
|
|
|
66 |
26600
|
sandro.lab
|
</xsl:stylesheet>
|