Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="b056a619-9019-4f82-8b7a-8d50302c7d43_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2016-11-21T11:15:30+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>core_plos2oaf</TITLE>
14
                <CODE>
15
                    <![CDATA[
16

    
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/"
19
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
21
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:date="http://exslt.org/dates-and-times"
22
    extension-element-prefixes="date" exclude-result-prefixes="xs" version="2.0">
23

    
24
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
25
    <xsl:param name="varOfficialName"/>
26
    <xsl:param name="varDataSourceId"/>
27
    <xsl:variable name="article_type">
28
        <xsl:value-of select="article/@article-type"/>
29
    </xsl:variable>
30
    <xsl:variable name="newline"><xsl:text>
31
</xsl:text></xsl:variable>
32
    <xsl:template match="issn">
33
        <xsl:if test="./@pub-type = 'epub'">
34
            <dc:source>
35
                    <xsl:value-of select="concat(string('eissn: '), normalize-space(.))"/>
36
                </dc:source>
37
        </xsl:if>
38

    
39
        <xsl:if test="./@pub-type = 'ppub'">
40
            <dc:source>
41
                    <xsl:value-of
42
                        select="concat(string('issn: '), normalize-space(.))"
43
                    />
44
                </dc:source>
45
        </xsl:if>
46

    
47

    
48
    </xsl:template>
49

    
50
    <xsl:template match="publisher">
51
        <dc:publisher>
52
            <xsl:value-of select="./publisher-name"/>
53
        </dc:publisher>
54
    </xsl:template>
55

    
56
    <xsl:template match="permissions">
57
         <dc:rights>
58
             <xsl:value-of select="concat(./copyright-holder,', ',./copyright-year)"/>
59
         </dc:rights>
60
        <xsl:if test=".//ext-link[@ext-link-type='uri']">
61
            <dc:rights><xsl:value-of select=".//*[local-name()='ext-link']/@*[local-name()='href']"/></dc:rights>
62
        </xsl:if>
63
    </xsl:template>
64

    
65
    <xsl:template match="/">
66
        <xsl:if test="not(article[@article-type='correction'])">
67
            <record>
68
                <header>
69
                    <xsl:copy-of select="//*[local-name() = 'header']/*" copy-namespaces="no"/>
70
                    <dr:dateOfTransformation>
71
                        <xsl:value-of select="date:date-time()"/>
72
                    </dr:dateOfTransformation>
73
                </header>
74
                <metadata>
75
                    <dc:language>eng</dc:language>
76
                    <xsl:choose>
77
                        <xsl:when test="//*[local-name()='permissions']//*[local-name()='ext-link'][@*[local-name()='ext-link-type']='uri' and @*[local-name()='href']='http://creativecommons.org/licenses/by/4.0/']">
78
                            <oaf:accessrights>OPEN</oaf:accessrights>
79
                        </xsl:when>
80
                        <xsl:otherwise>
81
                            <oaf:accessrights>UNKNOWN</oaf:accessrights>
82
                        </xsl:otherwise>
83
                    </xsl:choose>
84

    
85

    
86
                    <oaf:hostedBy id="doajarticles::1932-6203"
87
                        name="PLoS ONE"/>
88
                    <oaf:collectedFrom>
89
                        <xsl:attribute name="name">
90
                            <xsl:value-of select="$varOfficialName"/>
91
                        </xsl:attribute>
92
                        <xsl:attribute name="id">
93
                            <xsl:value-of select="$varDataSourceId"/>
94
                        </xsl:attribute>
95
                    </oaf:collectedFrom>
96

    
97
                    <xsl:apply-templates select=".//*"/>
98
                </metadata>
99
                <xsl:copy-of select="//*[local-name() = 'about']/*" copy-namespaces="no"/>
100
            </record>
101
        </xsl:if>
102

    
103
    </xsl:template>
104

    
105
    <xsl:template match="title-group">
106
        <dc:title>
107
            <xsl:value-of select="normalize-space(./article-title)"/>
108
        </dc:title>
109
    </xsl:template>
110

    
111
    <xsl:template match="contrib-group">
112
        <xsl:for-each select="./contrib">
113
            <xsl:if test="./@*[local-name()='contrib-type']='author'">
114
            <dc:creator>
115
            <xsl:value-of select="concat(.//surname, ', ', .//given-names)"/>
116
        </dc:creator>
117

    
118

    
119
        </xsl:if>
120
        </xsl:for-each>
121
    </xsl:template>
122

    
123
    <xsl:template match="journal-meta">
124
        <dc:type>
125
            <xsl:value-of select="string('info:eu-repo/semantics/article')"/>
126
        </dc:type>
127
        <dc:type>
128
            <xsl:value-of select="$article_type"/>
129
        </dc:type>
130

    
131
        <dr:CobjCategory>0001</dr:CobjCategory>
132

    
133
            <oaf:journal eissn="{./issn[@pub-type='epub']}"
134
                issn="{./issn[@pub-type='ppub']}"
135
                volq="{../article-meta/volume}"
136
                iss="{../article-meta/issue}">
137
                <xsl:value-of select=".//journal-title"/>
138
            </oaf:journal>
139

    
140

    
141
    </xsl:template>
142

    
143

    
144
    <xsl:template name="dex">
145
        <xsl:param name="array"/>
146
        <xsl:param name="index" select="1"/>
147
        <xsl:param name="description" select="''"/>
148

    
149
        <xsl:choose>
150
            <xsl:when test="count($array) >= $index">
151
                <xsl:call-template name="dex">
152
                    <xsl:with-param name="array" select="$array"/>
153
                    <xsl:with-param name="index" select="$index + 1"/>
154
                    <xsl:with-param name="description" select="concat($description, $array[$index]/title ,': ', $array[$index]/p,$newline)"/>
155
                </xsl:call-template>
156
            </xsl:when>
157
            <xsl:otherwise>
158
                <dc:description>
159
                    <xsl:value-of select="substring($description,1,string-length($description))"/>
160
                </dc:description>
161
            </xsl:otherwise>
162
        </xsl:choose>
163
    </xsl:template>
164

    
165
    <xsl:template match="abstract">
166
        <xsl:call-template name="dex">
167
            <xsl:with-param name="array" select="./sec"/>
168
        </xsl:call-template>
169
    </xsl:template>
170

    
171
    <xsl:template match="pub-date">
172
        <xsl:choose>
173
            <xsl:when test="./year and ./month and ./day"> <dc:date>
174
                <xsl:value-of select="concat(./year, '-' , ./month, '-' , ./day)"/>
175
            </dc:date></xsl:when>
176
            <xsl:when test="./year and ./month">
177
                <dc:date>
178
                    <xsl:value-of select="concat(./year, '-' , ./month)"/>
179
                </dc:date>
180
            </xsl:when>
181
            <xsl:when test="./year">
182
                <dc:date>
183
                    <xsl:value-of select="./year"/></dc:date>
184
            </xsl:when>
185
        </xsl:choose>
186

    
187

    
188

    
189

    
190

    
191
    </xsl:template>
192

    
193
    <xsl:template match="article-id">
194
        <xsl:choose>
195
            <xsl:when test="./@pub-id-type='doi'">
196
                <dc:identifier>
197
                    <xsl:value-of select="concat('http://dx.doi.org/', .)"/>
198
                </dc:identifier>
199
                <oaf:identifier identifierType="doi">
200
                    <xsl:value-of select="."/>
201
                </oaf:identifier>
202
            </xsl:when>
203
            <xsl:otherwise>
204
                <dc:relation>
205
                    <xsl:value-of select="concat('info:eu-repo/semantics/altIdentifier/',./@pub-id-type,'/',.)"/>
206
                </dc:relation>
207
            </xsl:otherwise>
208
        </xsl:choose>
209

    
210
    </xsl:template>
211

    
212
    <xsl:template match="downloadFileUrl">
213
        <downloadFileUrl><xsl:value-of select="."/></downloadFileUrl>
214
    </xsl:template>
215

    
216
    <xsl:template match="article-categories">
217

    
218
        <xsl:for-each select="//subject[not(.=preceding::*)]">
219

    
220
                 <dc:subject>
221
                    <xsl:value-of select="."/>
222
                    </dc:subject>
223

    
224

    
225
            </xsl:for-each>
226

    
227
    </xsl:template>
228
    <!-- Extend with new templates for additional types of publication     -->
229

    
230
    <xsl:template match="* | @*"/>
231

    
232
</xsl:stylesheet>
233
]]>
234
                </CODE>
235
            </SCRIPT>
236
        </CONFIGURATION>
237
        <STATUS/>
238
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
239
    </BODY>
240
</RESOURCE_PROFILE>
241

    
(3-3/5)