Index: modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/datasources/opendoar2dbrest.xml
===================================================================
--- modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/datasources/opendoar2dbrest.xml	(revision 59661)
+++ modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/datasources/opendoar2dbrest.xml	(revision 59662)
@@ -1,10 +1,11 @@
 <RESOURCE_PROFILE>
     <HEADER>
-        <RESOURCE_IDENTIFIER value="a2611b61-3748-4917-9397-3426b5174d8d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
+        <RESOURCE_IDENTIFIER
+                value="a2611b61-3748-4917-9397-3426b5174d8d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
         <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
         <RESOURCE_KIND value="TransformationRuleDSResources"/>
         <RESOURCE_URI value=""/>
-        <DATE_OF_CREATION value="2018-11-02T12:28:21+00:00"/>
+        <DATE_OF_CREATION value="2019-11-11T10:35:54+00:00"/>
     </HEADER>
     <BODY>
         <CONFIGURATION>
@@ -11,252 +12,268 @@
             <IMPORTED/>
             <SCRIPT>
                 <TITLE>OPENDOAR 2 DB REST</TITLE>
-                <CODE><![CDATA[
+                <CODE>
 
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="1.0">
+                    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                                    xmlns:dnet="eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions" version="1.0">
 
-	<xsl:param name="varDataSourceId"/>
-	<xsl:variable name="namespacePrefix" select="string('opendoar____')"/>
+                        <xsl:param name="varDataSourceId"/>
+                        <xsl:variable name="namespacePrefix" select="string('opendoar____')"/>
 
-	<xsl:template match="/">
-		<record>
+                        <xsl:template match="/">
+                            <record>
 
-			<xsl:copy-of select=".//*[local-name()='header']"/>
-			<metadata>
-				<xsl:variable name="rid" select="normalize-space(//items/system_metadata/id)"/>
-				<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
-				<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
-				<xsl:variable name="oUrl" select="normalize-space(//organisation/url)"/>
-				<xsl:variable name="oName" select="normalize-space(//organisation/name/name)"/>
-				<xsl:variable name="organizationId" select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/>
-				<xsl:variable name="repositoryType">
-					<xsl:choose>
-						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'institutional'">
-							<xsl:value-of select="string('pubsrepository::institutional')"/>
-						</xsl:when>
-						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'governmental'">
-							<xsl:value-of select="string('pubsrepository::institutional')"/>
-						</xsl:when>
-						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'disciplinary'">
-							<xsl:value-of select="string('pubsrepository::thematic')"/>
-						</xsl:when>
-						<xsl:when test="lower-case(normalize-space(//repository_metadata/type)) = 'aggregating'">
-							<xsl:choose>
-								<xsl:when test="lower-case(normalize-space(//repository_metadata/content_types)) = 'journal_articles'">
-									<xsl:value-of select="string('aggregator::pubsrepository::journals')"/>
-								</xsl:when>
-								<xsl:otherwise>
-									<xsl:value-of select="string('aggregator::pubsrepository::unknown')"/>
-								</xsl:otherwise>
-							</xsl:choose>
-						</xsl:when>
-						<xsl:otherwise>
-							<xsl:value-of select="string('pubsrepository::unknown')"/>
-						</xsl:otherwise>
-					</xsl:choose>
-				</xsl:variable>
+                                <xsl:copy-of select=".//*[local-name()='header']"/>
+                                <metadata>
+                                    <xsl:variable name="rid" select="normalize-space(//items/system_metadata/id)"/>
+                                    <xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)"/>
+                                    <xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')"/>
+                                    <xsl:variable name="oUrl" select="normalize-space(//organisation/url)"/>
+                                    <xsl:variable name="oName" select="normalize-space(//organisation/name/name)"/>
+                                    <xsl:variable name="organizationId"
+                                                  select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')"/>
+                                    <xsl:variable name="repositoryType">
+                                        <xsl:choose>
+                                            <xsl:when
+                                                    test="lower-case(normalize-space(//repository_metadata/type)) = 'institutional'">
+                                                <xsl:value-of select="string('pubsrepository::institutional')"/>
+                                            </xsl:when>
+                                            <xsl:when
+                                                    test="lower-case(normalize-space(//repository_metadata/type)) = 'governmental'">
+                                                <xsl:value-of select="string('pubsrepository::institutional')"/>
+                                            </xsl:when>
+                                            <xsl:when
+                                                    test="lower-case(normalize-space(//repository_metadata/type)) = 'disciplinary'">
+                                                <xsl:value-of select="string('pubsrepository::thematic')"/>
+                                            </xsl:when>
+                                            <xsl:when
+                                                    test="lower-case(normalize-space(//repository_metadata/type)) = 'aggregating'">
+                                                <xsl:choose>
+                                                    <xsl:when
+                                                            test="lower-case(normalize-space(//repository_metadata/content_types)) = 'journal_articles'">
+                                                        <xsl:value-of
+                                                                select="string('aggregator::pubsrepository::journals')"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:value-of
+                                                                select="string('aggregator::pubsrepository::unknown')"/>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:when>
+                                            <xsl:otherwise>
+                                                <xsl:value-of select="string('pubsrepository::unknown')"/>
+                                            </xsl:otherwise>
+                                        </xsl:choose>
+                                    </xsl:variable>
 
-				<xsl:variable name="contenttypes">
-					<xsl:for-each select=".//content_types">
-						<xsl:if test="position() &gt; 1"> - </xsl:if>
-						<xsl:value-of select="."/>
-					</xsl:for-each>
-				</xsl:variable>
-				<xsl:variable name="languages">
-					<xsl:for-each select=".//content_languages">
-						<xsl:if test="position() &gt; 1">, </xsl:if>
-						<xsl:value-of select="."/>
-					</xsl:for-each>
-				</xsl:variable>
+                                    <xsl:variable name="contenttypes">
+                                        <xsl:for-each select=".//content_types">
+                                            <xsl:if test="position() &amp;gt; 1">-</xsl:if>
+                                            <xsl:value-of select="."/>
+                                        </xsl:for-each>
+                                    </xsl:variable>
+                                    <xsl:variable name="languages">
+                                        <xsl:for-each select=".//content_languages">
+                                            <xsl:if test="position() &amp;gt; 1">,</xsl:if>
+                                            <xsl:value-of select="."/>
+                                        </xsl:for-each>
+                                    </xsl:variable>
 
-				<xsl:variable name="subjects">
-					<xsl:for-each select=".//content_subjects/label">
-						<xsl:if test="position() &gt; 1"> @@ </xsl:if>
-						<xsl:value-of select="."/>
-					</xsl:for-each>
-				</xsl:variable>
+                                    <xsl:variable name="subjects">
+                                        <xsl:for-each select=".//content_subjects/label">
+                                            <xsl:if test="position() &amp;gt; 1">@@</xsl:if>
+                                            <xsl:value-of select="."/>
+                                        </xsl:for-each>
+                                    </xsl:variable>
 
-				<ROWS>
-					<ROW table="dsm_datasources">
-						<FIELD name="_dnet_resource_identifier_">
-							<xsl:value-of select="$datasourceId"/>
-						</FIELD>
-						<FIELD name="id">
-							<xsl:value-of select="$datasourceId"/>
-						</FIELD>
-						<FIELD name="officialname">
-						<xsl:choose>
-                                <xsl:when test="//repository_metadata/name/name">
-                                    <xsl:value-of
-                                        select="normalize-space(//repository_metadata/name/name)"/>
-                                </xsl:when>
-                                <xsl:otherwise>
-                                    <xsl:value-of
-                                        select="normalize-space(//repository_metadata/name/acronym)"/>
-                                </xsl:otherwise>
-                            </xsl:choose>
-						</FIELD>
-						<FIELD name="englishname">
-							<xsl:choose>
-                                <xsl:when test="//repository_metadata/name/acronym">
-                                    <xsl:value-of
-                                        select="normalize-space(//repository_metadata/name/acronym)"/>
-                                </xsl:when>
-                                <xsl:otherwise>
-                                    <xsl:value-of
-                                        select="normalize-space(//repository_metadata/name/name)"/>
-                                </xsl:otherwise>
-                            </xsl:choose>
-						</FIELD>
-						<FIELD name="websiteurl">
-							<xsl:value-of select="normalize-space(//repository_metadata/url)"/>
-						</FIELD>
-						<FIELD name="contactemail">
-							<xsl:value-of select="normalize-space(//pEmail)"/>
-						</FIELD>
-                        <xsl:if test="not(normalize-space(//organisation/location/latitude) = 'null')">
-                            <FIELD name="latitude" type="float">
-                              <xsl:value-of select="normalize-space(//organisation/location/latitude)"/>
-                            </FIELD>
-                        </xsl:if>
-                        <xsl:if test="normalize-space(//organisation/location/latitude) = 'null'">
-							<FIELD name="latitude" type="float"/>
-                        </xsl:if>
-                        <xsl:if test="not(normalize-space(//organisation/location/longitude) = 'null')">
-                              <FIELD name="longitude" type="float">
-                                <xsl:value-of select="normalize-space(//organisation/location/longitude)"/>
-                              </FIELD>
-                        </xsl:if>
-                        <xsl:if test="normalize-space(//organisation/location/longitude) = 'null'">
-							<FIELD name="longitude" type="float"/>
-                        </xsl:if>
-						<FIELD name="namespaceprefix">
-							<xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
-						</FIELD>
-						<FIELD name="languages">
-							<xsl:value-of select="normalize-space($languages)"/>
-						</FIELD>
-						<FIELD name="od_contenttypes">
-							<xsl:value-of select="normalize-space($contenttypes)"/>
-						</FIELD>
-						<FIELD name="collectedfrom">
-							<xsl:value-of select="$varDataSourceId"/>
-						</FIELD>
-						<FIELD name="typology">
-							<xsl:value-of select="$repositoryType"/>
-						</FIELD>
-						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
-						<FIELD name="platform">
-							<xsl:value-of select="normalize-space(//repository_metadata/software/name)"/>
-						</FIELD>
-						<FIELD name="description">
-							<xsl:value-of select="normalize-space(//repository_metadata/description)"/>
-						</FIELD>
+                                    <ROWS>
+                                        <ROW table="dsm_datasources">
+                                            <FIELD name="_dnet_resource_identifier_">
+                                                <xsl:value-of select="$datasourceId"/>
+                                            </FIELD>
+                                            <FIELD name="id">
+                                                <xsl:value-of select="$datasourceId"/>
+                                            </FIELD>
+                                            <FIELD name="officialname">
+                                                <xsl:choose>
+                                                    <xsl:when test="//repository_metadata/name/name">
+                                                        <xsl:value-of
+                                                                select="normalize-space(//repository_metadata/name/name)"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:value-of
+                                                                select="normalize-space(//repository_metadata/name/acronym)"/>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </FIELD>
+                                            <FIELD name="englishname">
+                                                <xsl:choose>
+                                                    <xsl:when test="//repository_metadata/name/acronym">
+                                                        <xsl:value-of
+                                                                select="normalize-space(//repository_metadata/name/acronym)"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:value-of
+                                                                select="normalize-space(//repository_metadata/name/name)"/>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </FIELD>
+                                            <FIELD name="websiteurl">
+                                                <xsl:value-of select="normalize-space(//repository_metadata/url)"/>
+                                            </FIELD>
+                                            <FIELD name="contactemail">
+                                                <xsl:value-of select="normalize-space(//pEmail)"/>
+                                            </FIELD>
+                                            <xsl:if test="not(normalize-space(//organisation/location/latitude) = 'null')">
+                                                <FIELD name="latitude" type="float">
+                                                    <xsl:value-of
+                                                            select="normalize-space(//organisation/location/latitude)"/>
+                                                </FIELD>
+                                            </xsl:if>
+                                            <xsl:if test="normalize-space(//organisation/location/latitude) = 'null'">
+                                                <FIELD name="latitude" type="float"/>
+                                            </xsl:if>
+                                            <xsl:if test="not(normalize-space(//organisation/location/longitude) = 'null')">
+                                                <FIELD name="longitude" type="float">
+                                                    <xsl:value-of
+                                                            select="normalize-space(//organisation/location/longitude)"/>
+                                                </FIELD>
+                                            </xsl:if>
+                                            <xsl:if test="normalize-space(//organisation/location/longitude) = 'null'">
+                                                <FIELD name="longitude" type="float"/>
+                                            </xsl:if>
+                                            <FIELD name="namespaceprefix">
+                                                <xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/>
+                                            </FIELD>
+                                            <FIELD name="languages">
+                                                <xsl:value-of select="normalize-space($languages)"/>
+                                            </FIELD>
+                                            <FIELD name="od_contenttypes">
+                                                <xsl:value-of select="normalize-space($contenttypes)"/>
+                                            </FIELD>
+                                            <FIELD name="collectedfrom">
+                                                <xsl:value-of select="$varDataSourceId"/>
+                                            </FIELD>
+                                            <FIELD name="typology">
+                                                <xsl:value-of select="$repositoryType"/>
+                                            </FIELD>
+                                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
+                                            <FIELD name="platform">
+                                                <xsl:value-of
+                                                        select="normalize-space(//repository_metadata/software/name)"/>
+                                            </FIELD>
+                                            <FIELD name="description">
+                                                <xsl:value-of
+                                                        select="normalize-space(//repository_metadata/description)"/>
+                                            </FIELD>
 
-						<FIELD name="subjects">
-							<xsl:value-of select="normalize-space($subjects)"/>
-						</FIELD>
-						<xsl:if test="//policies/preservation_policy/version_control/policy[./text() = 'updated_versions_allowed']">
-						    <FIELD name="versioning" type="boolean">true</FIELD>
-						</xsl:if>
-					</ROW>
+                                            <FIELD name="subjects">
+                                                <xsl:value-of select="normalize-space($subjects)"/>
+                                            </FIELD>
+                                            <xsl:if test="//policies/preservation_policy/version_control/policy[./text() = 'updated_versions_allowed']">
+                                                <FIELD name="versioning" type="boolean">true</FIELD>
+                                            </xsl:if>
+                                        </ROW>
 
-					<ROW table="dsm_api">
-						<FIELD name="_dnet_resource_identifier_">
-							<xsl:value-of select="$apiId"/>
-						</FIELD>
-						<FIELD name="id">
-							<xsl:value-of select="$apiId"/>
-						</FIELD>
-						<FIELD name="protocol">oai</FIELD>
-						<FIELD name="datasource">
-							<xsl:value-of select="$datasourceId"/>
-						</FIELD>
-						<FIELD name="contentdescription">metadata</FIELD>
-						<FIELD name="typology">
-							<xsl:value-of select="$repositoryType"/>
-						</FIELD>
-						<FIELD name="baseurl">
-							<xsl:value-of select="normalize-space(//repository_metadata/oai_url)"/>
-						</FIELD>
-						<FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
-					</ROW>
+                                        <ROW table="dsm_api">
+                                            <FIELD name="_dnet_resource_identifier_">
+                                                <xsl:value-of select="$apiId"/>
+                                            </FIELD>
+                                            <FIELD name="id">
+                                                <xsl:value-of select="$apiId"/>
+                                            </FIELD>
+                                            <FIELD name="protocol">oai</FIELD>
+                                            <FIELD name="datasource">
+                                                <xsl:value-of select="$datasourceId"/>
+                                            </FIELD>
+                                            <FIELD name="contentdescription">metadata</FIELD>
+                                            <FIELD name="typology">
+                                                <xsl:value-of select="$repositoryType"/>
+                                            </FIELD>
+                                            <FIELD name="baseurl">
+                                                <xsl:value-of select="normalize-space(//repository_metadata/oai_url)"/>
+                                            </FIELD>
+                                            <FIELD name="metadata_identifier_path">
+                                                //*[local-name()='header']/*[local-name()='identifier']
+                                            </FIELD>
+                                        </ROW>
 
-					<ROW table="dsm_apiparams">
-						<FIELD name="_dnet_resource_identifier_">
-							<xsl:value-of select="concat($apiId, '@@format')"/>
-						</FIELD>
-						<FIELD name="api">
-							<xsl:value-of select="$apiId"/>
-						</FIELD>
-						<FIELD name="param">format</FIELD>
-						<FIELD name="value">oai_dc</FIELD>
-					</ROW>
+                                        <ROW table="dsm_apiparams">
+                                            <FIELD name="_dnet_resource_identifier_">
+                                                <xsl:value-of select="concat($apiId, '@@format')"/>
+                                            </FIELD>
+                                            <FIELD name="api">
+                                                <xsl:value-of select="$apiId"/>
+                                            </FIELD>
+                                            <FIELD name="param">format</FIELD>
+                                            <FIELD name="value">oai_dc</FIELD>
+                                        </ROW>
 
-					<ROW table="dsm_organizations">
-						<FIELD name="_dnet_resource_identifier_">
-							<xsl:value-of select="$organizationId"/>
-						</FIELD>
-						<FIELD name="id">
-							<xsl:value-of select="$organizationId"/>
-						</FIELD>
-						<FIELD name="legalname">
-							<xsl:value-of select="$oName"/>
-						</FIELD>
-						<FIELD name="legalshortname">
-							<xsl:value-of select="normalize-space(//organisation/name/acronym)"/>
-						</FIELD>
-						<FIELD name="websiteurl">
-							<xsl:choose>
-								<xsl:when test="starts-with(normalize-space($oUrl), 'http')">
-									<xsl:value-of select="normalize-space($oUrl)"/>
-								</xsl:when>
-								<xsl:when test="string-length(normalize-space($oUrl)) &gt; 0">
-									<xsl:value-of select="concat('http://', normalize-space($oUrl))"/>
-								</xsl:when>
-							</xsl:choose>
-						</FIELD>
+                                        <ROW table="dsm_organizations">
+                                            <FIELD name="_dnet_resource_identifier_">
+                                                <xsl:value-of select="$organizationId"/>
+                                            </FIELD>
+                                            <FIELD name="id">
+                                                <xsl:value-of select="$organizationId"/>
+                                            </FIELD>
+                                            <FIELD name="legalname">
+                                                <xsl:value-of select="$oName"/>
+                                            </FIELD>
+                                            <FIELD name="legalshortname">
+                                                <xsl:value-of select="normalize-space(//organisation/name/acronym)"/>
+                                            </FIELD>
+                                            <FIELD name="websiteurl">
+                                                <xsl:choose>
+                                                    <xsl:when test="starts-with(normalize-space($oUrl), 'http')">
+                                                        <xsl:value-of select="normalize-space($oUrl)"/>
+                                                    </xsl:when>
+                                                    <xsl:when test="string-length(normalize-space($oUrl)) &amp;gt; 0">
+                                                        <xsl:value-of
+                                                                select="concat('http://', normalize-space($oUrl))"/>
+                                                    </xsl:when>
+                                                </xsl:choose>
+                                            </FIELD>
 
-						<FIELD name="country">
-							<xsl:choose>
-								<xsl:when test="normalize-space(//organisation/country) = 'UK'">GB</xsl:when>
-								<xsl:otherwise>
-	                                <xsl:value-of select="normalize-space(//organisation/country)"/>
-								</xsl:otherwise>
-							</xsl:choose>
-						</FIELD>
+                                            <FIELD name="country">
+                                                <xsl:choose>
+                                                    <xsl:when test="normalize-space(//organisation/country) = 'UK'">GB
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:value-of select="normalize-space(//organisation/country)"/>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </FIELD>
 
-						<FIELD name="collectedfrom">
-							<xsl:value-of select="$varDataSourceId"/>
-						</FIELD>
-						<FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
-					</ROW>
+                                            <FIELD name="collectedfrom">
+                                                <xsl:value-of select="$varDataSourceId"/>
+                                            </FIELD>
+                                            <FIELD name="provenanceaction">sysimport:crosswalk:entityregistry</FIELD>
+                                        </ROW>
 
-					<ROW table="dsm_datasource_organization">
-						<FIELD name="_dnet_resource_identifier_">
-							<xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
-						</FIELD>
-						<FIELD name="datasource">
-							<xsl:value-of select="$datasourceId"/>
-						</FIELD>
-						<FIELD name="organization">
-							<xsl:value-of select="$organizationId"/>
-						</FIELD>
-					</ROW>
+                                        <ROW table="dsm_datasource_organization">
+                                            <FIELD name="_dnet_resource_identifier_">
+                                                <xsl:value-of select="concat($datasourceId, '@@', $organizationId)"/>
+                                            </FIELD>
+                                            <FIELD name="datasource">
+                                                <xsl:value-of select="$datasourceId"/>
+                                            </FIELD>
+                                            <FIELD name="organization">
+                                                <xsl:value-of select="$organizationId"/>
+                                            </FIELD>
+                                        </ROW>
 
-				</ROWS>
-			</metadata>
-		</record>
-	</xsl:template>
+                                    </ROWS>
+                                </metadata>
+                            </record>
+                        </xsl:template>
 
-</xsl:stylesheet>
+                    </xsl:stylesheet>
 
 
-				]]></CODE>
+                </CODE>
             </SCRIPT>
         </CONFIGURATION>
         <STATUS/>
         <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
     </BODY>
-</RESOURCE_PROFILE>
+</RESOURCE_PROFILE>
\ No newline at end of file
