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:dnet="eu.dnetlib.actionmanager.actions.infopackage.DataciteInfoPackageToHbaseXsltFunctions"
4
                xmlns:oaf="http://namespace.openaire.eu/oaf"
5
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
6
                xmlns:date="eu.dnetlib.miscutils.datetime.DateUtils"
7
                xmlns:dr="http://www.driver-repository.eu/namespace/dr"
8
                xmlns:exslt="http://exslt.org/common" version="1.0"
9
                extension-element-prefixes="exslt" exclude-result-prefixes="xsl dnet exslt oaf dr dri date">
10

    
11
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
12

    
13
    <xsl:param name="trust" select="string('0.9')"/>
14
    <xsl:param name="provenance" select="string('UNKNOWN')"/>
15
    <xsl:param name="namespaceprefix" select="string('datacite____')"/>
16

    
17
    <xsl:template match="/*">
18
        <xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
19
        <xsl:variable name="metadata" select="exslt:node-set(/*[local-name()='record']/*[local-name()='metadata']/*[local-name()='resource'])"/>
20
        <xsl:variable name="rightNSPrefix">
21
            <xsl:choose>
22
                <xsl:when test="not($namespaceprefix)">
23
                    <xsl:value-of select="//oaf:datasourceprefix"/>
24
                </xsl:when>
25
                <xsl:otherwise>
26
                    <xsl:value-of select="$namespaceprefix"/>
27
                </xsl:otherwise>
28
            </xsl:choose>
29
        </xsl:variable>
30

    
31
        <xsl:choose>
32
            <xsl:when test="count($metadata) =  0">
33
                <ACTIONS/>
34
            </xsl:when>
35
            <xsl:otherwise>
36
                <xsl:variable name="originalId" select="//*[local-name() = 'identifier' and ./@identifierType='DOI']"/>
37
                <xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
38

    
39
                <xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
40
                <xsl:variable name="titles" select="//*[local-name() = 'title']"/>
41
                <xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
42
                <xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
43
                <xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
44
                <xsl:variable name="dates" select="//*[local-name() = 'date']"/>
45
                <xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
46
                <xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/>
47
                <xsl:variable name="formats" select="//*[local-name() = 'format']"/>
48
                <xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
49
                <xsl:variable name="rights" select="//oaf:accessrights"/>
50
                <xsl:variable name="version" select="//*[local-name() = 'version']"/>
51
                <xsl:variable name="pids" select="//*[local-name() = 'resource']/*[local-name()='identifier']"/>
52
                <xsl:variable name="instanceURI"
53
                              select="concat('http://dx.doi.org','/',//*[local-name() = 'resource']/*[local-name() = 'identifier'])"/>
54
                <xsl:variable name="hostedbyid"
55
                              select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
56
                <xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
57
                <xsl:variable name="collectedfromid"
58
                              select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
59
                <xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
60
                <xsl:variable name="dateOfCollection" select="//dr:dateOfCollection"/>
61
                <xsl:variable name="language" select="//oaf:language"/>
62
                <xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
63

    
64
                <ACTIONS>
65
                    <ACTION targetKey="{$resultId}" targetColumnFamily="result" targetColumn="{concat('update_', date:now())}">
66
                        <xsl:value-of
67
                                select="dnet:oafDataCiteResultFromInfoPackage($resultId, $about, $metadata, $titles,
68
                            $subjects, $publisher, $descriptions, $dates, $dateaccepted, $resourceType, 
69
                            $formats, $sizes, $language, $cobjcategory, $rights, $version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname,
70
                            $collectedfromid, $collectedfromname, $originalId, $instanceURI, $dateOfCollection)"/>
71
                    </ACTION>
72
                </ACTIONS>
73
            </xsl:otherwise>
74
        </xsl:choose>
75
    </xsl:template>
76
</xsl:stylesheet>
(2-2/5)