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="invisible" select="false()"/>
|
15
|
<xsl:param name="trust" select="string('0.9')"/>
|
16
|
<xsl:param name="provenance" 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
|
|
25
|
<xsl:choose>
|
26
|
<xsl:when test="count($metadata) = 0">
|
27
|
<ROWS/>
|
28
|
</xsl:when>
|
29
|
<xsl:otherwise>
|
30
|
|
31
|
<xsl:variable name="objidentifier" select="/record/*[local-name() = 'header']/*[local-name() = 'objIdentifier']"/>
|
32
|
|
33
|
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', $objidentifier)"/>
|
34
|
|
35
|
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
|
36
|
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
|
37
|
|
38
|
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
|
39
|
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
|
40
|
|
41
|
<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
|
42
|
<xsl:variable name="originalid">
|
43
|
<xsl:choose>
|
44
|
<xsl:when test="contains($originalidTest, '::')">
|
45
|
<xsl:value-of select="substring-after($originalidTest, '::')"/>
|
46
|
</xsl:when>
|
47
|
<xsl:otherwise>
|
48
|
<xsl:value-of select="$originalidTest"/>
|
49
|
</xsl:otherwise>
|
50
|
</xsl:choose>
|
51
|
</xsl:variable>
|
52
|
|
53
|
<xsl:variable name="result"
|
54
|
select="dnet:oafResult($resultId, $invisible, $provenance, $trust, $about, $hostedbyid, $hostedbyname,
|
55
|
$collectedfromid, $collectedfromname, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
|
56
|
|
57
|
<ROWS>
|
58
|
<ROW targetKey="{$resultId}" targetColumnFamily="result">
|
59
|
<QUALIFIER name="{concat('update_', date:nanoTime())}" type="base64"><xsl:value-of select="$result"/></QUALIFIER>
|
60
|
</ROW>
|
61
|
</ROWS>
|
62
|
</xsl:otherwise>
|
63
|
</xsl:choose>
|
64
|
</xsl:template>
|
65
|
|
66
|
</xsl:stylesheet>
|