Index: modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/xslt_cleaning_ORP-biotools.xml
===================================================================
--- modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/xslt_cleaning_ORP-biotools.xml	(nonexistent)
+++ modules/dnet-openaireplus-profiles/trunk/src/main/resources/eu/dnetlib/test/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/xslt_cleaning_ORP-biotools.xml	(revision 55109)
@@ -0,0 +1,363 @@
+<RESOURCE_PROFILE>
+	<HEADER>
+		<RESOURCE_IDENTIFIER value="b703be53-e2e9-4de3-ba94-210ea4a96b82_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
+		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
+		<RESOURCE_KIND value="TransformationRuleDSResources"/>
+		<RESOURCE_URI value=""/>
+		<DATE_OF_CREATION value="2019-03-27T09:42:01+00:00"/>
+	</HEADER>
+	<BODY>
+		<CONFIGURATION>
+			<IMPORTED/>
+			<SCRIPT>
+				<TITLE>xslt_cleaning_ORP-biotools</TITLE>
+				<CODE>
+					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
+					                xmlns:oaf="http://namespace.openaire.eu/oaf"
+					                xmlns:dr="http://www.driver-repository.eu/namespace/dr"
+					                xmlns:datacite="http://datacite.org/schema/kernel-4"
+					                xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
+					                extension-element-prefixes="TransformationFunction"
+					                exclude-result-prefixes="TransformationFunction">
+
+						<xsl:param name="varOfficialName"/>
+						<xsl:param name="varDsType"/>
+						<xsl:param name="varDataSourceId"/>
+						<xsl:param name="index" select="0"/>
+						<xsl:param name="transDate" select="current-dateTime()"/>
+						<xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
+
+						<xsl:template match="/">
+							<xsl:variable name="datasourcePrefix"
+							              select="normalize-space(//oaf:datasourceprefix)"/>
+							<xsl:call-template name="validRecord"/>
+						</xsl:template>
+
+						<xsl:template name="terminate">
+							<xsl:message terminate="yes">
+								record is not compliant, transformation is interrupted.
+							</xsl:message>
+						</xsl:template>
+
+						<xsl:template name="validRecord">
+							<record>
+								<xsl:apply-templates select="//*[local-name() = 'header']"/>
+
+								<metadata>
+
+									<!--
+									<xsl:apply-templates select="//*[local-name() = 'metadata']//*[local-name() = 'list']"/>
+									-->
+
+									<datacite:resource>
+
+
+										<datacite:resourceType>
+											<xsl:attribute name="resourceTypeGeneral" select="'Software'"/>
+											<xsl:value-of select="//*[local-name() = 'toolType']"/>
+										</datacite:resourceType>
+
+										<xsl:for-each select="//*[local-name() = 'language']">
+											<datacite:format>
+												<xsl:value-of select="."/>
+											</datacite:format>
+										</xsl:for-each>
+
+										<!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE
+										-->
+
+										<datacite:publisher>
+											<xsl:value-of select="$varOfficialName"/>
+										</datacite:publisher>
+
+										<datacite:relatedIdentifiers>
+											<xsl:for-each select="//*[local-name() = 'documentation'][not(./*[local-name() = 'type'] = ('Terms of use', 'Citation instructions', 'Contributions policy', 'Governance'))]">
+												<datacite:relatedIdentifier>
+													<xsl:attribute name="relatedIdentifierType" select="'URL'"/>
+													<xsl:attribute name="relationType" select="'IsDocumentedBy'"/>
+													<xsl:value-of select="./*[local-name() = 'url']"/>
+												</datacite:relatedIdentifier>
+											</xsl:for-each>
+											<!-- paper references -->
+											<xsl:call-template name="relatedPaper"/>
+										</datacite:relatedIdentifiers>
+
+										<datacite:alternateIdentifiers>
+											<!-- landing page, documentation, distribution -->
+											<datacite:alternateIdentifier>
+												<xsl:attribute name="alternateIdentifierType" select="'LandingPage'"/>
+												<xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
+											</datacite:alternateIdentifier>
+
+											<!--
+											<xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[local-name() = 'link'][./*[local-name() = 'url' and starts-with(., 'https://github.com/')]]/*[local-name() = 'url']/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
+											-->
+											<xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[starts-with(., 'https://github.com/') and contains(., concat('/', //*[local-name() = 'id']))]/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
+												<datacite:alternateIdentifier>
+													<xsl:attribute name="alternateIdentifierType" select="'DistributionLocation'"/>
+													<xsl:value-of select="."/>
+												</datacite:alternateIdentifier>
+											</xsl:for-each>
+
+											<!-- identifier -->
+											<datacite:alternateIdentifier>
+												<xsl:attribute name="alternateIdentifierType" select="'local accession id'"/>
+												<xsl:value-of select="//*[local-name() = 'id']"/>
+											</datacite:alternateIdentifier>
+										</datacite:alternateIdentifiers>
+
+										<datacite:identifier>
+											<xsl:attribute name="identifierType" select="'URL'"/>
+											<xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
+										</datacite:identifier>
+
+										<!-- title -->
+										<datacite:titles>
+											<datacite:title>
+												<xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
+											</datacite:title>
+										</datacite:titles>
+
+										<!-- version -->
+										<xsl:if test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
+											<datacite:version>
+												<xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"/>
+											</datacite:version>
+										</xsl:if>
+
+										<!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
+										<xsl:call-template name="authors"/>
+
+										<datacite:contributors>
+											<xsl:for-each select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
+												<xsl:variable name="varContributorName" select="TransformationFunction:convertString($tf, ., 'Person')"/>
+												<datacite:contributor>
+													<xsl:attribute name="contributorType" select="'ContactPerson'"/>
+													<datacite:contributorName>
+														<xsl:value-of select="$varContributorName"/>
+													</datacite:contributorName>
+													<datacite:givenName>
+														<xsl:value-of select="substring-after($varContributorName, ', ')"/>
+													</datacite:givenName>
+													<datacite:familyName>
+														<xsl:value-of select="substring-before($varContributorName, ', ')"/>
+													</datacite:familyName>
+												</datacite:contributor>
+											</xsl:for-each>
+										</datacite:contributors>
+
+										<datacite:descriptions>
+											<datacite:description>
+												<xsl:attribute name="descriptionType">
+													<xsl:value-of select="'Abstract'"/>
+												</xsl:attribute>
+												<xsl:value-of select="//*[local-name() = 'description']"/>
+											</datacite:description>
+
+											<!--
+											<xsl:for-each select="//*[local-name() = 'operatingSystem'], //*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
+											-->
+
+											<xsl:for-each select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
+												<datacite:description>
+													<xsl:attribute name="descriptionType" select="'Abstract'"/>
+													<xsl:value-of select="."/>
+												</datacite:description>
+											</xsl:for-each>
+
+											<xsl:for-each select="//*[local-name() = 'operatingSystem']">
+												<datacite:description>
+													<xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
+													<xsl:value-of select="."/>
+												</datacite:description>
+											</xsl:for-each>
+
+										</datacite:descriptions>
+
+										<!-- subject -->
+										<!-- dropping duplicate topics - funny that this seemingly works -->
+										<datacite:subjects>
+											<xsl:for-each select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
+												<xsl:if test=".">
+													<datacite:subject>
+														<xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
+														<xsl:attribute name="schemeURI" select="'http://edamontology.org'"/>
+														<xsl:attribute name="valueURI" select="./*[local-name() = 'uri']"/>
+														<xsl:value-of select="./*[local-name() = 'term']"/>
+													</datacite:subject>
+												</xsl:if>
+											</xsl:for-each>
+										</datacite:subjects>
+
+									</datacite:resource>
+
+									<!--
+									CobjCategory, SuperType
+									-->
+									<xsl:variable name='varCobjCategory' select="'0029'"/>
+									<xsl:variable name='varSuperType' select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
+									<dr:CobjCategory>
+										<xsl:attribute name="type" select="$varSuperType"/>
+										<xsl:value-of select="$varCobjCategory"/>
+									</dr:CobjCategory>
+
+									<!--
+									access rights, licenses
+									-->
+									<xsl:for-each select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
+										<oaf:accessrights>
+											<xsl:variable name='varAccessRights' select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
+											<xsl:choose>
+												<xsl:when test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
+													<xsl:value-of select="'OPEN SOURCE'"/>
+												</xsl:when>
+												<xsl:otherwise>
+													<xsl:value-of select="$varAccessRights"/>
+												</xsl:otherwise>
+											</xsl:choose>
+										</oaf:accessrights>
+									</xsl:for-each>
+
+									<xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
+										<oaf:license>
+											<xsl:value-of select="."/>
+										</oaf:license>
+									</xsl:for-each>
+
+									<oaf:hostedBy>
+										<xsl:attribute name="name" select="$varOfficialName"/>
+										<xsl:attribute name="id" select="$varDataSourceId"/>
+									</oaf:hostedBy>
+									<oaf:collectedFrom>
+										<xsl:attribute name="name" select="$varOfficialName"/>
+										<xsl:attribute name="id" select="$varDataSourceId"/>
+									</oaf:collectedFrom>
+
+									<!--
+									<oaf:identifier>
+									<xsl:value-of select="//*[local-name() = 'id']"/>
+									</oaf:identifier>
+									-->
+
+
+									<oaf:concept>
+										<xsl:attribute name="id" select="'elixir-gr'"/>
+									</oaf:concept>
+
+
+									<!-- date -->
+									<oaf:dateAccepted>
+										<xsl:value-of select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
+									</oaf:dateAccepted>
+
+								</metadata>
+								<xsl:copy-of select="//*[local-name() = 'about']"/>
+							</record>
+
+						</xsl:template>
+
+						<xsl:template match="node()|@*">
+							<xsl:copy>
+								<xsl:apply-templates select="node()|@*"/>
+							</xsl:copy>
+						</xsl:template>
+
+						<xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
+							<xsl:copy>
+								<xsl:apply-templates select="node()|@*"/>
+							</xsl:copy>
+						</xsl:template>
+
+						<xsl:template match="//*[local-name() = 'header']">
+							<xsl:copy>
+								<xsl:apply-templates select="node()|@*"/>
+								<xsl:element name="dr:dateOfTransformation">
+									<xsl:value-of select="$transDate"/>
+								</xsl:element>
+							</xsl:copy>
+						</xsl:template>
+
+						<!--
+						<xsl:template match="//*[local-name() = 'authors']">
+						-->
+						<xsl:template name="authors">
+							<xsl:choose>
+								<xsl:when test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']][./*[local-name() = 'name' and not(. = 'null')]])">
+									<xsl:call-template name="terminate"/>
+								</xsl:when>
+								<xsl:otherwise>
+									<datacite:creators>
+										<xsl:for-each select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and . = 'Developer']]/*[local-name() = 'name' and not(. = 'null')]">
+											<xsl:for-each select="tokenize(., ', ')">
+												<xsl:variable name="varDeveloperName" select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
+												<datacite:creator>
+													<datacite:creatorName>
+														<xsl:value-of select="$varDeveloperName"/>
+													</datacite:creatorName>
+													<datacite:givenName>
+														<xsl:value-of select="substring-after($varDeveloperName, ', ')"/>
+													</datacite:givenName>
+													<datacite:familyName>
+														<xsl:value-of select="substring-before($varDeveloperName, ', ')"/>
+													</datacite:familyName>
+													<!--
+													<xsl:if test="string-length(./*[local-name() = 'orcid']) > 0">
+													<xsl:element name="datacite:nameIdentifier">
+													<xsl:attribute name="nameIdentifierScheme" select="'ORCID'"/>
+													<xsl:attribute name="schemeURI" select="'http://orcid.org'"/>
+													<xsl:value-of select="./*[local-name()='orcid']"/>
+													</xsl:element>
+													</xsl:if>
+													<xsl:for-each select="./*[local-name() = 'affiliations'][string-length(.) > 0]">
+													<xsl:element name="datacite:affiliation">
+													<xsl:value-of select="."/>
+													</xsl:element>
+													</xsl:for-each>
+													-->
+												</datacite:creator>
+											</xsl:for-each>
+										</xsl:for-each>
+									</datacite:creators>
+								</xsl:otherwise>
+							</xsl:choose>
+						</xsl:template>
+
+						<!--
+						<xsl:template match="//*[local-name() = 'DOI']">
+						-->
+						<xsl:template name="relatedPaper">
+							<xsl:for-each select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
+								<xsl:element name="datacite:relatedIdentifier">
+									<xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
+									<xsl:attribute name="relationType">
+										<xsl:choose>
+											<xsl:when test="../*[local-name() = 'type'] = 'Primary'">
+												<xsl:value-of select="'isSupplementTo'"/>
+											</xsl:when>
+											<xsl:when test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
+												<xsl:value-of select="'isReviewedBy'"/>
+											</xsl:when>
+											<xsl:when test="../*[local-name() = 'type'] = 'Usage'">
+												<xsl:value-of select="'isReferencedBy'"/>
+											</xsl:when>
+											<xsl:when test="../*[local-name() = 'type'] = 'Method'">
+												<xsl:value-of select="'references'"/>
+											</xsl:when>
+											<xsl:otherwise>
+												<xsl:value-of select="'isReferencedBy'"/>
+											</xsl:otherwise>
+										</xsl:choose>
+									</xsl:attribute>
+									<xsl:value-of select="."/>
+								</xsl:element>
+							</xsl:for-each>
+						</xsl:template>
+
+					</xsl:stylesheet>
+				</CODE>
+			</SCRIPT>
+		</CONFIGURATION>
+		<STATUS/>
+		<SECURITY_PARAMETERS/>
+	</BODY>
+</RESOURCE_PROFILE>
\ No newline at end of file
