1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
4
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa"
|
5
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
|
6
|
xmlns:date="java.lang.System"
|
7
|
xmlns:exslt="http://exslt.org/common"
|
8
|
version="1.0"
|
9
|
extension-element-prefixes="exslt"
|
10
|
exclude-result-prefixes="xsl dc dr dri oaa oaf dnet exslt date">
|
11
|
|
12
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
13
|
|
14
|
<xsl:param name="trust" select="string('0.9')"/>
|
15
|
<xsl:param name="provenance" select="string('UNKNOWN')"/>
|
16
|
<xsl:param name="namespaceprefix" select="string('unknown_____')"/>
|
17
|
|
18
|
<xsl:template match="/*">
|
19
|
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
20
|
<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
|
21
|
<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/>
|
22
|
|
23
|
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
24
|
<xsl:variable name="collectedDatasourceid">
|
25
|
<xsl:choose>
|
26
|
<xsl:when test="string-length(//oaf:collectedDatasourceid) > 0">
|
27
|
<xsl:value-of select="//oaf:collectedDatasourceid"/>
|
28
|
</xsl:when>
|
29
|
<xsl:otherwise>
|
30
|
<xsl:value-of select="UNKNOWN"/>
|
31
|
</xsl:otherwise>
|
32
|
</xsl:choose>
|
33
|
</xsl:variable>
|
34
|
|
35
|
<xsl:choose>
|
36
|
<xsl:when test="count($metadata) = 0">
|
37
|
<ACTIONS/>
|
38
|
</xsl:when>
|
39
|
<xsl:otherwise>
|
40
|
|
41
|
<xsl:variable name="objidentifier" select="/record/*[local-name() = 'header']/*[local-name() = 'objIdentifier']"/>
|
42
|
|
43
|
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', $objidentifier)"/>
|
44
|
|
45
|
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
|
46
|
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
|
47
|
|
48
|
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
|
49
|
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
|
50
|
|
51
|
<!-- <xsl:variable name="country" select="substring(//dr:repositoryCountry, 1, 200)" /> -->
|
52
|
<!-- <xsl:variable name="accessmode" select="substring(//oaf:accessrights, 1, 200)" /> -->
|
53
|
|
54
|
<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
|
55
|
<xsl:variable name="originalid">
|
56
|
<xsl:choose>
|
57
|
<xsl:when test="contains($originalidTest, '::')">
|
58
|
<xsl:value-of select="substring-after($originalidTest, '::')"/>
|
59
|
</xsl:when>
|
60
|
<xsl:otherwise>
|
61
|
<xsl:value-of select="$originalidTest"/>
|
62
|
</xsl:otherwise>
|
63
|
</xsl:choose>
|
64
|
</xsl:variable>
|
65
|
|
66
|
<xsl:variable name="result"
|
67
|
select="dnet:oafResult($resultId, $provenance, $trust, $about, $hostedbyid, $hostedbyname,
|
68
|
$collectedfromid, $collectedfromname, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
|
69
|
|
70
|
<ACTIONS>
|
71
|
<ACTION targetKey="{$resultId}" targetColumnFamily="result" targetColumn="{concat('update_', date:nanoTime())}">
|
72
|
<xsl:value-of select="$result"/>
|
73
|
</ACTION>
|
74
|
</ACTIONS>
|
75
|
</xsl:otherwise>
|
76
|
</xsl:choose>
|
77
|
</xsl:template>
|
78
|
|
79
|
</xsl:stylesheet>
|