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.data.transform.xml.OdfToHbaseXsltFunctions"
4
                xmlns:oaf="http://namespace.openaire.eu/oaf"
5
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
6
                xmlns:date="java.lang.System"
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:if test="string-length($resultId) &gt; 0">
40
		            <xsl:variable name="originalids"
41
		                          select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
42

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

    
69
		            <xsl:variable name="result"
70
		                          select="dnet:odfResult($resultId, $about, $metadata, $titles, $subjects, $publisher, $descriptions,
71
			                                            $dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $rights,
72
			                                            $version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
73
			                                            $collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
74
		            <ACTIONS>
75
			            <ACTION targetKey="{$resultId}" targetColumnFamily="result" targetColumn="{concat('update_', date:nanoTime())}">
76
				            <xsl:value-of select="$result"/>
77
			            </ACTION>
78
		            </ACTIONS>
79
	            </xsl:if>
80
            </xsl:otherwise>
81
        </xsl:choose>
82
    </xsl:template>
83
</xsl:stylesheet>
(2-2/5)