Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="a9649911-1697-47df-922a-23ac4c1e593a_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_pangaea_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:copy-of select="//*[local-name() = 'metadata']/*[local-name() = 'relatedPublication']" copy-namespaces="no"/>
47
		<xsl:copy-of select="//*[local-name() = 'metadata']/*[local-name() = 'relatedDataSet']" copy-namespaces="no"/>
48

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

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

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

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

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

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

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

    
121

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

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