Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                              xmlns="http://namespace.openaire.eu/sygma">
4

    
5
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
6

    
7
    <xsl:template match = "/">
8
        <response>
9
            <xsl:apply-templates select="response/header"/>
10
            <datasets>
11
                <xsl:apply-templates select="//result"/>
12
            </datasets>
13
        </response>
14
    </xsl:template>
15

    
16
    <xsl:template match="response/header">
17
        <header>
18
            <size><xsl:value-of select="size"/></size>
19
            <page><xsl:value-of select="page"/></page>
20
            <total><xsl:value-of select="total"/></total>
21
        </header>
22
    </xsl:template>
23

    
24
<!--    <xsl:template match="field[@name='pid']/field[@name='classid' and @value='doi']" name="idnode"></xsl:template> -->
25

    
26
    <xsl:template match="result">
27
        <dataset>
28
            <openaireid><xsl:value-of select="field[@name='resultId']/@value"/></openaireid>
29
            <authors>
30
                <xsl:for-each select="field[@name='hasAuthor']">
31
                    <author><xsl:value-of select="field[@name='fullname']/@value"/></author>
32
                </xsl:for-each>
33
            </authors>
34
            <doi>
35
                <xsl:for-each select="field[@name='pid']">
36
                    <xsl:if test="field[@name='classid' and @value='doi']/@value = 'doi'">
37
                        <xsl:value-of select="field[@name='value']/@value"/>
38
                    </xsl:if>
39
                </xsl:for-each>
40
            </doi>
41
            <description><xsl:value-of select="field[@name='description']/@value"/></description>
42
            <title><xsl:value-of select="field[@name='title']/@value"/></title>
43
            <xsl:for-each select="field[@name='datasource']">
44
                <xsl:for-each select="field[@name='url']">
45
                    <webresource><xsl:value-of select="@value"/></webresource>
46
                </xsl:for-each>
47
            </xsl:for-each>
48
            <bestlicense><xsl:value-of select="field[@name='bestaccessright']/@value"/></bestlicense>
49
            <relatedpublications>
50
                    <xsl:for-each select="field[@name='isRelatedTo']">
51
                        <xsl:if test="field[@name='resulttypeid']/@value = 'publication'">
52
                            <publication>
53
                                <openaireid><xsl:value-of select="field['resultid']/@value"/></openaireid>
54
                                <doi></doi>
55
                                <title><xsl:value-of select="field[@name='title']/@value"/></title>
56
                                <authors></authors>
57
                                <sourcejournal></sourcejournal>
58
                                <dateofacceptance></dateofacceptance>
59
                                <webresource></webresource>
60
                                <bestlicense></bestlicense>
61
                            </publication>
62
                        </xsl:if>
63
                    </xsl:for-each>
64
            </relatedpublications>
65
        </dataset>
66
    </xsl:template>
67

    
68
</xsl:stylesheet>
(42-42/46)