Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER
4
				value="d55a2e23-4bae-47a6-9056-980839773621_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
7
		<RESOURCE_URI value=""/>
8
		<DATE_OF_CREATION value="2014-11-19T11:05:55+01:00"/>
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<IMPORTED/>
13
			<SCRIPT>
14
                <TITLE>DLI: OAI_ICPSR transform</TITLE>
15
                <CODE><![CDATA[<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17
    xmlns:datetime="http://exslt.org/dates-and-times"
18
    xmlns:exslt="http://exslt.org/common"
19
    xmlns:oai="http://www.openarchives.org/OAI/2.0/"
20
    xmlns:oaf="http://namespace.dnet.eu/oaf"
21
    xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dli="http://www.dli.eu"
22
    xmlns:ddi="ddi:codebook:2_5"
23
    xmlns:dnet="eu.dnetlib.dli.DLIUtils"
24
    xmlns:dc="http://purl.org/dc/elements/1.1/"
25
    exclude-result-prefixes="xsl datetime exslt ddi dnet">
26
    <xsl:output method="xml" indent="yes" />
27

    
28

    
29
    <xsl:template match="/">
30
        <xsl:choose>
31
            <xsl:when test="not(//*[local-name()='relPubl'])">
32
                <record/>
33
            </xsl:when>
34
            <xsl:when test="not(//*[local-name()='stdyDscr']/*[local-name()='citation']/*[local-name()='holdings'])">
35
                <record> </record>
36
            </xsl:when>
37
            <xsl:otherwise>
38
                <xsl:variable name="namespacePrefix">
39
                    <xsl:value-of select="//*[local-name()='header']/*[local-name()='datasourceprefix']"/>
40
                </xsl:variable>
41
                <xsl:variable name="objIdentifier">
42
                    <xsl:value-of select="concat($namespacePrefix, '::', dnet:generateIdentifier(//*[local-name()='stdyDscr']/*[local-name()='citation']/*[local-name()='holdings'], 'DOI'))"/>
43
                </xsl:variable>
44
                <pack>
45
                    <oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
46
                        xmlns:dri="http://www.driver-repository.eu/namespace/dri"
47
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
48
                        <oai:header>
49
                            <dri:objIdentifier><xsl:value-of select="$objIdentifier"/></dri:objIdentifier>
50
                            <dri:recordIdentifier><xsl:value-of select="//*[local-name()='stdyDscr']/*[local-name()='citation']/*[local-name()='holdings']"/></dri:recordIdentifier>
51
                            <dri:dateOfCollection><xsl:value-of select="//dri:dateOfCollection"/></dri:dateOfCollection>
52
                            <dri:repositoryId><xsl:value-of select="//dri:repositoryId"/></dri:repositoryId>
53
                            <dri:datasourceprefix><xsl:value-of select="$namespacePrefix"/></dri:datasourceprefix>
54
                            <oai:identifier><xsl:value-of select="//*[local-name()='stdyDscr']/*[local-name()='citation']/*[local-name()='holdings']"/></oai:identifier>
55
                        </oai:header>
56
                        <metadata>
57
                            <resource xmlns="http://datacite.org/schema/kernel-3"
58
                                xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
59
                                <identifier xmlns="" identifierType="DOI"><xsl:value-of select="//*[local-name()='stdyDscr']/*[local-name()='citation']/*[local-name()='holdings']"/></identifier>
60
                                <creators>
61
                                    <xsl:for-each select="//*[local-name()='stdyDscr']/*[local-name()='citation']//*[local-name()='AuthEnty']">
62
                                        <creator>
63
                                            <creatorName><xsl:value-of select="."/></creatorName>
64
                                        </creator>
65
                                    </xsl:for-each>
66
                                </creators>
67
                                <titles>
68
                                    <xsl:for-each select="//*[local-name()='stdyDscr']/*[local-name()='citation']//*[local-name()='titl']">
69
                                        <title><xsl:value-of select="."/></title>
70
                                    </xsl:for-each>
71
                                </titles>
72
                                <subjects>
73

    
74
                                    <xsl:for-each select="//*[local-name()='stdyDscr']/*[local-name()='stdyInfo']/*[local-name()='subject']//*[local-name()='keyword']">
75
                                        <subject>
76
                                            <xsl:attribute name="subjectScheme"><xsl:value-of select="./@vocab"/>
77
                                            </xsl:attribute>
78
                                            <xsl:value-of select="."/></subject>
79
                                    </xsl:for-each>
80
                                </subjects>
81
                                <contributors>
82
                                    <contributor contributorType="HostingInstitution">
83
                                        <xsl:for-each select="//*[local-name()='stdyDscr']/*[local-name()='citation']//*[local-name()='AuthEnty']">
84
                                            <contributorName><xsl:value-of select="."/></contributorName>
85
                                        </xsl:for-each>
86
                                    </contributor>
87
                                </contributors>
88
                                <dates >
89
                                    <date dateType="Collected"><xsl:value-of select="//*[local-name()='stdyDscr']/*[local-name()='citation']//*[local-name()='distDate']/@date"/></date>
90
                                </dates>
91
                                <resourceType resourceTypeGeneral="Dataset">Dataset</resourceType>
92
                                <relatedIdentifiers>
93
                                    <xsl:for-each select="//*[local-name()='stdyDscr']//*[local-name()='relPubl']">
94
                                        <xsl:choose>
95
                                            <xsl:when test="string-length(normalize-space(./*[local-name()='citation']/*[local-name()='holdings'])) &gt; 0">
96

    
97
                                                <relatedIdentifier entityType="publication" inverseRelationType="cites" relatedIdentifierType="dnet"
98
                                                    relationType="isCitedBy"><xsl:value-of select="concat($namespacePrefix,'::',dnet:generateIdentifier(./*[local-name()='citation']/*[local-name()='holdings'],'DOI'))"/></relatedIdentifier>
99
                                            </xsl:when>
100
                                            <xsl:otherwise>
101
                                                <relatedIdentifier entityType="publication" inverseRelationType="cites" relatedIdentifierType="dnet"
102
                                                    relationType="isCitedBy"><xsl:value-of select="concat($namespacePrefix,'::',dnet:generateIdentifier(.//*[local-name()='IDNo' and ./@agency='ICPSR'],'ICPSR')) "/></relatedIdentifier>
103
                                            </xsl:otherwise>
104
                                        </xsl:choose>
105
                                    </xsl:for-each>
106
                                </relatedIdentifiers>
107
                            </resource>
108
                        </metadata>
109
                        <oaf:about xmlns:oaf="http://namespace.dnet.eu/oaf">
110
                            <oaf:datainfo>
111
                                <oaf:collectedFrom completionStatus="complete"  >
112
                                    <xsl:attribute name="id"><xsl:value-of select="dnet:getIdFromDataSourcePrefix($namespacePrefix)"/></xsl:attribute>
113
                                    <xsl:attribute name="name"><xsl:value-of select="dnet:getNameFromDataSourcePrefix($namespacePrefix)"/></xsl:attribute>
114
                                </oaf:collectedFrom>
115
                                <oaf:completionStatus>complete</oaf:completionStatus>
116
                                <oaf:provisionMode>collected</oaf:provisionMode>
117
                            </oaf:datainfo>
118
                        </oaf:about>
119
                    </oai:record>
120

    
121

    
122
                    <xsl:for-each select="//*[local-name()='relPubl']">
123

    
124
                        <xsl:variable name="pubId">
125
                            <xsl:choose>
126
                                <xsl:when test="string-length(normalize-space(./*[local-name()='citation']/*[local-name()='holdings'])) &gt; 0">
127
                                    <xsl:value-of select="./*[local-name()='citation']/*[local-name()='holdings']"/>
128
                                </xsl:when>
129
                                <xsl:otherwise>
130
                                    <xsl:value-of select=".//*[local-name()='IDNo' and ./@agency='ICPSR']"/>
131
                                </xsl:otherwise>
132
                            </xsl:choose>
133
                        </xsl:variable>
134

    
135
                        <xsl:variable name="pubType">
136
                            <xsl:choose>
137
                                <xsl:when test="string-length(normalize-space(./*[local-name()='citation']/*[local-name()='holdings'])) &gt; 0">DOI</xsl:when>
138
                                <xsl:otherwise>ICPSR</xsl:otherwise>
139
                            </xsl:choose>
140
                        </xsl:variable>
141
                        <xsl:call-template name="makePublication">
142
                            <xsl:with-param name="namespacePrefix"><xsl:value-of select="$namespacePrefix"/></xsl:with-param>
143
                            <xsl:with-param name="publicationIdentifier"><xsl:value-of select="$pubId"/></xsl:with-param>
144
                            <xsl:with-param name="pidType"><xsl:value-of select="$pubType"/></xsl:with-param>
145
                        </xsl:call-template>
146
                    </xsl:for-each>
147
                </pack>
148
            </xsl:otherwise>
149
        </xsl:choose>
150
    </xsl:template>
151

    
152
    <xsl:template name="makePublication" match="//*[local-name()='relPubl']" >
153
        <xsl:param name="namespacePrefix"/>
154
        <xsl:param name="pidType"></xsl:param>
155
        <xsl:param name="publicationIdentifier"/>
156
        <xsl:variable name="objIdentifier">
157
            <xsl:value-of select="concat($namespacePrefix, '::', dnet:generateIdentifier($publicationIdentifier,$pidType))"/>
158
        </xsl:variable>
159

    
160
        <oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
161
            xmlns:dri="http://www.driver-repository.eu/namespace/dri"
162
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
163
            <oai:header>
164
                <dri:objIdentifier><xsl:value-of select="$objIdentifier"/></dri:objIdentifier>
165
                <dri:recordIdentifier><xsl:value-of select="$publicationIdentifier"/></dri:recordIdentifier>
166
                <dri:dateOfCollection><xsl:value-of select="//dri:dateOfCollection"/></dri:dateOfCollection>
167
                <dri:repositoryId><xsl:value-of select="//dri:repositoryId"/></dri:repositoryId>
168
                <dri:datasourceprefix><xsl:value-of select="$namespacePrefix"/></dri:datasourceprefix>
169
                <oai:identifier><xsl:value-of select="$publicationIdentifier"/></oai:identifier>
170
            </oai:header>
171
            <metadata>
172
                <oaf:pid type="{$pidType}"><xsl:value-of select="$publicationIdentifier"/></oaf:pid>
173
                <dc:identifier><xsl:value-of select="$publicationIdentifier"/></dc:identifier>
174
                <xsl:for-each select=".//*[local-name()='titl']">
175
                    <dc:title><xsl:value-of select="."/></dc:title>
176
                </xsl:for-each>
177
                <xsl:for-each select=".//*[local-name()='AuthEnty']">
178
                    <dc:creator><xsl:value-of select="."/></dc:creator>
179
                </xsl:for-each>
180
                <dc:type>publication</dc:type>
181
            </metadata>
182
            <oaf:about>
183
                <oaf:datainfo>
184
                    <oaf:collectedFrom completionStatus="complete">
185
                        <xsl:attribute name="id"><xsl:value-of select="dnet:getIdFromDataSourcePrefix($namespacePrefix)"/></xsl:attribute>
186
                        <xsl:attribute name="name"><xsl:value-of select="dnet:getNameFromDataSourcePrefix($namespacePrefix)"/></xsl:attribute>
187
                    </oaf:collectedFrom>
188
                    <oaf:completionStatus>complete</oaf:completionStatus>
189
                    <oaf:provisionMode>collected</oaf:provisionMode>
190
                </oaf:datainfo>
191
            </oaf:about>
192

    
193
        </oai:record>
194
    </xsl:template>
195

    
196
</xsl:stylesheet>
197

    
198
]]></CODE>
199
			</SCRIPT>
200
		</CONFIGURATION>
201
		<STATUS/>
202
		<SECURITY_PARAMETERS/>
203
	</BODY>
204
</RESOURCE_PROFILE>
(12-12/17)