Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER
4
                value="415f686e-9c45-4a8a-b80a-017b7dd39c86_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_Datacite 2 to DMF transform</TITLE>
15
                <CODE><![CDATA[
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17
	xmlns:dnet="eu.dnetlib.dli.DLIUtils"
18
	xmlns:dri="http://www.driver-repository.eu/namespace/dri"
19
    xmlns:oaf="http://namespace.dnet.eu/oaf" version="2.0" exclude-result-prefixes="xsl dnet oaf">
20
    <xsl:template match="/">
21
        <xsl:choose>
22
            <xsl:when test="not(//*[lower-case(local-name()) = 'relatedidentifier'])">
23
                <record/>
24
            </xsl:when>
25
            <xsl:when
26
                test="not(//*[local-name() = 'resourceType']/@resourceTypeGeneral = 'Dataset' or //*[local-name() = 'resourceType']/@resourceTypeGeneral = 'Software' or //*[local-name() = 'resourceType']/@resourceTypeGeneral = 'Film' or //*[local-name() = 'resourceType']/@resourceTypeGeneral = 'Sound' or //*[local-name() = 'resourceType']/@resourceTypeGeneral = 'PhysicalObject' or //*[local-name() = 'resourceType']/@resourceTypeGeneral = 'Audiovisual' or //*[local-name() = 'resourceType']/@resourceTypeGeneral = 'Collection' or //*[local-name() = 'resourceType'][@resourceTypeGeneral = 'Other' and . = 'Study'])">
27
                <record/>
28
            </xsl:when>
29
            <xsl:otherwise>
30
                <xsl:apply-templates mode="dli"></xsl:apply-templates>
31
            </xsl:otherwise>
32
        </xsl:choose>
33
    </xsl:template>
34

    
35
    <xsl:template match="@*|node()" mode="dli">
36
        <xsl:copy>
37
            <xsl:apply-templates select="@*|node()" mode="dli"/>
38
        </xsl:copy>
39
    </xsl:template>
40

    
41
    <xsl:template match="*[local-name()='publisher']" mode="dli">
42
    </xsl:template>
43

    
44
    <xsl:template match="*[local-name()='resourceType']" mode="dli">
45
    	<resourceType>
46
			<xsl:attribute name="resourceTypeGeneral"><xsl:value-of select="./@resourceTypeGeneral"/> </xsl:attribute>
47
			<xsl:value-of select="."/>
48
    	</resourceType>
49
    	<xsl:for-each select="//*[local-name()='setSpec']">
50
    		<xsl:variable name="pubId" select="dnet:getPublisherName(.)"/>
51
			<xsl:choose>
52
				<xsl:when test="string-length(normalize-space($pubId)) &gt; 0">
53
					<publisher><xsl:value-of select="$pubId" /></publisher>
54
				</xsl:when>
55
        	</xsl:choose>
56
    	</xsl:for-each>
57
    </xsl:template>
58
    <xsl:template match="*[local-name()='relatedIdentifier']" mode="dli">
59
         <xsl:choose>
60
            <xsl:when test="string-length(normalize-space(./@relatedIdentifierType)) &gt; 0 and string-length(normalize-space(./@relationType)) &gt; 0 and string-length(normalize-space(.)) &gt; 0">
61
                <relatedIdentifier>
62
                    <xsl:attribute name="relatedIdentifierType"><xsl:value-of select="./@relatedIdentifierType"/></xsl:attribute>
63
                    <xsl:attribute name="relationType"><xsl:value-of select="dnet:normalizeRelation(./@relationType)"/></xsl:attribute>
64
                    <xsl:attribute name="inverseRelationType"><xsl:value-of select="dnet:getInverse(./@relationType)"/></xsl:attribute>
65
                    <xsl:value-of select="."/>
66
                </relatedIdentifier>
67
            </xsl:when>
68
        </xsl:choose>
69
    </xsl:template>
70

    
71
    <xsl:template match="*[local-name()='about']" mode="dli">
72
        <oaf:about>
73
            <oaf:datainfo>
74
                <xsl:variable name="datasourcePrefix">
75
                    <xsl:value-of select="//dri:datasourceprefix/text()"/>
76
                </xsl:variable>
77
                <oaf:collectedFrom completionStatus="complete">
78
                    <xsl:attribute name="id">
79
                        <xsl:value-of select="dnet:getIdFromDataSourcePrefix($datasourcePrefix)"/>
80
                    </xsl:attribute>
81
                    <xsl:attribute name="name">
82
                        <xsl:value-of select="dnet:getNameFromDataSourcePrefix($datasourcePrefix)"/>
83
                    </xsl:attribute>
84
                </oaf:collectedFrom>
85
                <oaf:completionStatus>complete</oaf:completionStatus>
86
                <oaf:provisionMode>collected</oaf:provisionMode>
87
            </oaf:datainfo>
88
        </oaf:about>
89
    </xsl:template>
90

    
91
</xsl:stylesheet>
92
]]>
93
                </CODE>
94
            </SCRIPT>
95
        </CONFIGURATION>
96
        <STATUS/>
97
        <SECURITY_PARAMETERS/>
98
    </BODY>
99
</RESOURCE_PROFILE>
(7-7/15)