Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="33e8cc88-3b4a-4a68-b332-7cae8baad8dc_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2014-07-17T10:41:08+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>xslt_cleaning_zenodo_datacite</TITLE>
14
                <CODE><![CDATA[
15
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
16
 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17
                xmlns:oaf="http://namespace.openaire.eu/oaf"
18
                xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
        	xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
20
                extension-element-prefixes="TransformationFunction"
21
                exclude-result-prefixes="TransformationFunction">
22

    
23
  <xsl:param name="varOfficialName" />
24
  <xsl:param name="varDsType" />
25
  <xsl:param name="varDataSourceId" />
26
  <xsl:param name="varCorda" select="'corda_______::'"/>
27

    
28
  <xsl:param name="index" select="0"/>
29
  <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
30

    
31

    
32
  <xsl:template match="/">
33
    <xsl:variable name="datasourcePrefix"
34
             select="normalize-space(//oaf:datasourceprefix)" />
35
    <xsl:call-template name="validRecord" />
36
  </xsl:template>
37

    
38

    
39
  <xsl:template name="validRecord">
40
    <record>
41
      <xsl:copy-of select="//*[local-name() = 'header']" />
42

    
43
      <metadata>
44
        <xsl:copy-of select="//*[local-name() = 'metadata']/*[local-name() = 'resource']" />
45

    
46
         <xsl:if test="//*[local-name()='date']/@dateType='Available'">
47
            <xsl:variable name='varEmbargoEndDate' 
48
                select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='date'][@dateType='Available']), 'DateISO8601')"/>
49
            <xsl:choose>
50
              <xsl:when test="string-length($varEmbargoEndDate) > 0">
51
                <oaf:embargoenddate>
52
                  <xsl:value-of select="$varEmbargoEndDate"/>
53
                </oaf:embargoenddate>
54
              </xsl:when>
55
              <xsl:otherwise>
56
               <oaf:skip>
57
                 <xsl:value-of select="TransformationFunction:skipRecord($tf, $index)"/>
58
               </oaf:skip>
59
              </xsl:otherwise>
60
            </xsl:choose>
61
         </xsl:if>
62

    
63
         <dr:CobjCategory><xsl:value-of 
64
                 select="TransformationFunction:convertString($tf, //*[local-name()='resourceType']/@resourceTypeGeneral, 'TextTypologies')" />
65
         </dr:CobjCategory>
66

    
67
         <oaf:dateAccepted>
68
               <xsl:value-of select="TransformationFunction:convertString($tf, normalize-space(//*[local-name()='publicationYear']), 'DateISO8601')"/>           
69
         </oaf:dateAccepted>
70
         <xsl:choose>
71

    
72
          <xsl:when test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
73
             <oaf:accessrights>
74
                <xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"/>
75
             </oaf:accessrights>
76
          </xsl:when>
77
          <xsl:when test="//*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')]">
78
             <oaf:accessrights>
79
                <xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name() = 'rights']/@rightsURI[starts-with(normalize-space(.), 'info:eu-repo/semantics')], 'AccessRights')"/>
80
             </oaf:accessrights>
81
          </xsl:when>
82
          <xsl:otherwise>
83
            <xsl:choose>
84
             <xsl:when test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'http://creativecommons.org')]">
85
              <oaf:accessrights>
86
                 <xsl:text>OPEN</xsl:text>
87
              </oaf:accessrights>
88
             </xsl:when>
89
             <xsl:otherwise>
90
              <oaf:accessrights>
91
                 <xsl:text>CLOSED</xsl:text>
92
              </oaf:accessrights>
93
             </xsl:otherwise> 
94
            </xsl:choose>
95
          </xsl:otherwise>
96
         </xsl:choose>
97

    
98
         <oaf:language>
99
           <xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
100
         </oaf:language>
101

    
102
<!--
103
    <xsl:if test="//*[local-name() = 'rights'][starts-with(normalize-space(.), 'info:eu-repo/semantics/embargoedAccess')]">
104
        <oaf:embargoenddate>
105
          <xsl:value-of select="//*[local-name()='date']/@dateType='Available'"/>
106
        </oaf:embargoenddate>
107
    </xsl:if>
108
-->
109

    
110
         <xsl:for-each select="//*[local-name()='nameIdentifier']">
111
            <xsl:if test="string-length(substring-after(normalize-space(.), 'info:eu-repo/grantAgreement/EC/FP7/')) = 6">
112
                <oaf:projectid>
113
                    <xsl:value-of select="TransformationFunction:regExpr($tf, normalize-space(.), $varCorda, 's/^(.*info:eu-repo\/grantAgreement\/EC\/FP7\/)//gm')"/>
114
                </oaf:projectid>
115
            </xsl:if>
116
         </xsl:for-each>
117

    
118

    
119
         <oaf:hostedBy>
120
            <xsl:attribute name="name">
121
               <xsl:value-of select="$varOfficialName"/>
122
            </xsl:attribute>
123
            <xsl:attribute name="id">
124
               <xsl:value-of select="$varDataSourceId"/>
125
            </xsl:attribute>
126
         </oaf:hostedBy>
127
         <oaf:collectedFrom>
128
            <xsl:attribute name="name">
129
               <xsl:value-of select="$varOfficialName"/>
130
            </xsl:attribute>
131
            <xsl:attribute name="id">
132
               <xsl:value-of select="$varDataSourceId"/>
133
            </xsl:attribute>
134
         </oaf:collectedFrom>
135
      </metadata>
136
      <xsl:copy-of select="//*[local-name() = 'about']" />
137
   </record>
138
  </xsl:template>
139

    
140
<!--
141
  <xsl:template match="//*[local-name()='language']">
142
         <oaf:language>
143
           <xsl:value-of select="TransformationFunction:convert($tf, //*[local-name()='language'], 'Languages')" />
144
         </oaf:language>
145
  </xsl:template>
146
-->
147
</xsl:stylesheet>
148
]]></CODE>
149
            </SCRIPT>
150
        </CONFIGURATION>
151
        <STATUS/>
152
        <SECURITY_PARAMETERS/>
153
    </BODY>
154
</RESOURCE_PROFILE>
(82-82/85)