Index: modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctionsTest.java
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctionsTest.java	(revision 48000)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctionsTest.java	(revision 48001)
@@ -9,6 +9,7 @@
 
 import static org.junit.Assert.assertEquals;
 
+
 /**
  * OpenTrialsXsltFunctions Tester.
  *
@@ -19,6 +20,24 @@
 	private String jsonProvWithNull = "[{\"url\" : \"\", \"sourceID\" : \"77eb42c5-0ec7-4e31-963a-5736b66f2d26\", \"sourceName\" : \"ictrp\"},{\"url\" : \"https://www.clinicaltrials.gov/ct2/show/NCT00378508?lup_e=02%2F04%2F2016&lup_s=01%2F01%2F2001&rank=175075&resultsxml=true\", \"sourceID\" : \"b389497c-0833-432b-a09b-930526b7b4d4\", \"sourceName\" : \"nct\"}]";
 	private String jidentifiers = "{112683,NCT00920439}";
 
+
+	private String jsonRecord = "[{\"source_id\" : \"nct\", \"source_url\" : \"https://clinicaltrials.gov/ct2/show/NCT02321059\", \"is_primary\" : true},{\"source_id\" : \"ictrp\", \"source_url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059\", \"is_primary\" : false}]";
+	private String jsonRecordNull = "[{\"source_id\" : \"nct\", \"source_url\" : \"https://clinicaltrials.gov/ct2/show/NCT02321059\"},{\"source_id\" : \"ictrp\", \"source_url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059\", \"is_primary\" : false}]";
+	private String jsonRecordVoid = "[{\"source_id\" : \"\", \"source_url\" : \"\", \"is_primary\" : \"\"}]";
+	private String jsonRecondPrimary = "[{\"source_id\" : \"nct\", \"source_url\" : \"https://clinicaltrials.gov/ct2/show/NCT02321059\", \"is_primary\" : false},{\"source_id\" : \"ictrp\", \"source_url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059\", \"is_primary\" : false}]";
+
+	private String jsonPeopleVoid ="[{\"person_name\" : null, \"person_id\" : null, \"person_role\" : null}]";
+	private String jsonPeopleOne = "[{\"person_name\" : \"Henk Verheul, M.D., PhD\", \"person_id\" : \"116438e9-f8b1-46e5-a1f8-20f851cab73c\", \"person_role\" : \"principal_investigator\"}]";
+	private String jsonPeopleMore = "[{\"person_name\" : \"Henk Verheul, M.D., PhD\", \"person_id\" : \"116438e9-f8b1-46e5-a1f8-20f851cab73c\", \"person_role\" : \"principal_investigator\"},{\"person_name\" : \"Miriam Pippolippo Baglioni, PhD\", \"person_id\" : \"fake\", \"person_role\" : \"principal_investigator\"}]";
+
+	private String jsonOrganizationVoid = "[{\"organization_name\" : null, \"organization_id\" : null, \"organization_role\" : null}]";
+	private String jsonOrganizationOne = "[{\"organization_name\" : \"SÃ¶dertÃ¤lje sjukhus AB\", \"organization_id\" : \"15f0d004-b82b-408c-8605-38a57352468d\", \"organization_role\" : \"sponsor\"}]";
+	private String jsonOrganizationMore = "[{\"organization_name\" : \"SÃ¶dertÃ¤lje sjukhus AB\", \"organization_id\" : \"15f0d004-b82b-408c-8605-38a57352468d\", \"organization_role\" : \"sponsor\"},{\"organization_name\" : \"Miriam Baglioni AB\", \"organization_id\" : \"fake\", \"organization_role\" : \"primary_sponsor\"}]";
+
+	private String jsonLocationVoid = "[{\"location_name\" : null}]";
+	private String jsonLocationOne = "[{\"location_name\" : \"China\"}]";
+	private String jsonLocationMore = "[{\"location_name\" : \"China\"},{\"location_name\" : \"North Korea\"}]";
+
 	@Before
 	public void before() throws Exception {
 	}
@@ -47,6 +66,116 @@
 		assertEquals("https://www.clinicaltrials.gov/ct2/show/NCT00378508?lup_e=02%2F04%2F2016&lup_s=01%2F01%2F2001&rank=175075&resultsxml=true", url);
 	}
 
+	@Test
+	public void testGetPrimaryRecordUrl(){
+		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecord);
+		assertEquals("https://clinicaltrials.gov/ct2/show/NCT02321059", url);
+	}
 
+	@Test
+	public void testGetPrimaryRecordID(){
+		String id = OpenTrialsXsltFunctions.getPrimaryRecordIdentifier(jsonRecord);
+		assertEquals("nct", id);
+	}
 
+	@Test
+	public void testGetPrimaryRecordUrlNull(){
+		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecordNull);
+		assertEquals("https://clinicaltrials.gov/ct2/show/NCT02321059", url);
+	}
+
+	@Test
+	public void testGetPrimaryRecordUrlVoid(){
+		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecordVoid);
+		assertEquals("", url);
+	}
+
+	@Test
+	public void testGetPrimaryRecordUrlNoPrimary(){
+		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecondPrimary);
+		assertEquals("https://clinicaltrials.gov/ct2/show/NCT02321059", url);
+	}
+	@Test
+	public void testGetPrimaryRecordIDNoPrimary(){
+		String id = OpenTrialsXsltFunctions.getPrimaryRecordIdentifier(jsonRecondPrimary);
+		assertEquals("nct", id);
+	}
+	@Test
+	public void testGetPrincipalInvestigatorsVoid(){
+		String url = OpenTrialsXsltFunctions.getPrincipalInvestigators(jsonPeopleVoid);
+		assertEquals("",url);
+	}
+
+
+	@Test
+	public void testGetPrincipalInvestigatorsOne(){
+		String url = OpenTrialsXsltFunctions.getPrincipalInvestigators(jsonPeopleOne);
+		assertEquals("Verheul, Henk", url);
+	}
+
+	@Test
+	public void testGetPrincipalInvestigatorsMore(){
+		String url = OpenTrialsXsltFunctions.getPrincipalInvestigators(jsonPeopleMore);
+		assertEquals("Verheul, Henk@@Baglioni, Miriam Pippolippo", url);
+	}
+
+
+
+	@Test
+	public void testgGetTrialOrganizationsVoid(){
+		String url = OpenTrialsXsltFunctions.getTrialOrganizations(jsonOrganizationVoid);
+		assertEquals("",url);
+	}
+
+
+	@Test
+	public void testgGetTrialOrganizationsOne(){
+		String url = OpenTrialsXsltFunctions.getTrialOrganizations(jsonOrganizationOne);
+		assertEquals("SÃ¶dertÃ¤lje sjukhus AB@sponsor", url);
+	}
+
+	@Test
+	public void testgGetTrialOrganizationsMore(){
+		String url = OpenTrialsXsltFunctions.getTrialOrganizations(jsonOrganizationMore);
+		assertEquals("SÃ¶dertÃ¤lje sjukhus AB@sponsor@@Miriam Baglioni AB@sponsor", url);
+	}
+
+	@Test
+	public void testgGetTrialLocationsVoid(){
+		String url = OpenTrialsXsltFunctions.getTrialLocations(jsonLocationVoid);
+		assertEquals("",url);
+	}
+
+
+	@Test
+	public void testgGetTrialLocationsOne(){
+		String url = OpenTrialsXsltFunctions.getTrialLocations(jsonLocationOne);
+		assertEquals("China", url);
+	}
+
+	@Test
+	public void testgGetTrialLocationsMore(){
+		String url = OpenTrialsXsltFunctions.getTrialLocations(jsonLocationMore);
+		assertEquals("China@@North Korea", url);
+	}
+
+	@Test
+	public void testGetNotPrimaryRecordUrlPrimary(){
+		String url = OpenTrialsXsltFunctions.getNotPrimaryRecordUrl(jsonRecondPrimary);
+		assertEquals("http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059", url);
+	}
+
+	@Test
+	public void testGetNotPrimaryRecordUrlVoid(){
+		String url = OpenTrialsXsltFunctions.getNotPrimaryRecordUrl(jsonRecordVoid);
+		assertEquals("", url);
+	}
+
+	@Test
+	public void testGetNotPrimaryRecordUrl(){
+		String url = OpenTrialsXsltFunctions.getNotPrimaryRecordUrl(jsonRecord);
+		assertEquals("http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059", url);
+	}
+
+
 } 
Index: modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/transform/xml/FWFXsltFunctionsTest.java
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/transform/xml/FWFXsltFunctionsTest.java	(nonexistent)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/test/java/eu/dnetlib/data/transform/xml/FWFXsltFunctionsTest.java	(revision 48001)
@@ -0,0 +1,113 @@
+package eu.dnetlib.data.transform.xml;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ *
+ * Created by miriam on 04/05/2017.
+ */
+public class FWFXsltFunctionsTest {
+	private String namesurname ="Gerhard SOMMER";
+	private String noSurname = "Gerhard";
+	private String noName = "SOMMER";
+	private String twoNames = "Gerhard Pippo SOMMER";
+	private String twoSurname = "Gerhard PIPPO SOMMER";
+	private String nonamesurname = "";
+	private String organization ="UniversitÃ¤t Linz - Institut fÃ¼r Computational Perception; UniversitÃ¤t fÃ¼r Musik und darstellende Kunst Graz - Institut 1: Komposition, Musiktheorie, Musikgeschichte und Dirigieren; UniversitÃ¤t Mozarteum Salzburg - Institut fÃ¼r Musikalische Rezeptions- und Interpretationsgeschichte; Anton Bruckner PrivatuniversitÃ¤t - Institut fÃ¼r Theorie und Geschichte der Musik; Eliette und Herbert von Karajan Institut - Eliette und Herbert von Karajan Institut";
+
+	@Before
+	public void before() throws Exception {
+	}
+
+	@After
+	public void after() throws Exception {
+	}
+
+	@Test
+	public void testGetNamesNameNoNameSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(nonamesurname,true);
+		assertEquals("",ret );
+	}
+
+	@Test
+	public void testGetNamesSurnameNoNameSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(nonamesurname,false);
+		assertEquals("",ret );
+	}
+
+	@Test
+	public void testGetNamesNameTwoSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(twoSurname,true);
+		assertEquals("Gerhard",ret );
+	}
+
+	@Test
+	public void testGetNamesSurnameTwoSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(twoSurname,false);
+		assertEquals("PIPPO SOMMER",ret );
+	}
+
+	@Test
+	public void testGetNamesNameTwoNames() throws Exception {
+		String ret = FWFXsltFunctions.getName(twoNames,true);
+		assertEquals("Gerhard Pippo",ret );
+	}
+
+	@Test
+	public void testGetNamesSurnameTwoNames() throws Exception {
+		String ret = FWFXsltFunctions.getName(twoNames,false);
+		assertEquals("SOMMER",ret );
+	}
+
+	/**
+	 * Method: getProvs(String jsonProvList)
+	 */
+	@Test
+	public void testGetNamesName() throws Exception {
+		String ret = FWFXsltFunctions.getName(namesurname,true);
+		assertEquals("Gerhard",ret );
+	}
+
+	@Test
+	public void testGetNamesSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(namesurname,false);
+		assertEquals("SOMMER",ret );
+	}
+
+	@Test
+	public void testGetNamesNameNoSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(noSurname,true);
+		assertEquals("Gerhard",ret );
+	}
+
+	@Test
+	public void testGetNamesSurnameNoSurname() throws Exception {
+		String ret = FWFXsltFunctions.getName(noSurname,false);
+		assertEquals("",ret );
+	}
+
+	@Test
+	public void testGetNamesNameNoName() throws Exception {
+		String ret = FWFXsltFunctions.getName(noName,true);
+		assertEquals("",ret );
+	}
+
+	@Test
+	public void testGetNamesSurnameNoName() throws Exception {
+		String ret = FWFXsltFunctions.getName(noName,false);
+		assertEquals("SOMMER",ret );
+	}
+
+	@Test
+	public void TestGetMd5()throws Exception{
+		String md5 = FWFXsltFunctions.getMd5(organization);
+		System.out.println(md5);
+		assertNotNull(md5);
+	}
+
+}
Index: modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/OafToHbaseXsltFunctions.java
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/OafToHbaseXsltFunctions.java	(revision 48000)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/OafToHbaseXsltFunctions.java	(revision 48001)
@@ -161,6 +161,19 @@
 					if (attr.get("lissn") != null) {
 						journal.setIssnLinking(attr.get("lissn"));
 					}
+
+					if (attr.get("ep") != null) {
+						journal.setEp(attr.get("ep"));
+					}
+					if (attr.get("iss") != null) {
+						journal.setIss(attr.get("iss"));
+					}
+					if (attr.get("sp") != null) {
+						journal.setSp(attr.get("sp"));
+					}
+					if (attr.get("vol") != null) {
+						journal.setVol(attr.get("vol"));
+					}
 				}
 				metadata.setJournal(journal.build());
 			}
Index: modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/DbmfToHbaseXsltFunctions.java
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/DbmfToHbaseXsltFunctions.java	(revision 48000)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/DbmfToHbaseXsltFunctions.java	(revision 48001)
@@ -26,6 +26,8 @@
 import eu.dnetlib.data.proto.RelMetadataProtos.RelMetadata;
 import eu.dnetlib.data.proto.RelTypeProtos.RelType;
 import eu.dnetlib.data.proto.RelTypeProtos.SubRelType;
+import eu.dnetlib.data.proto.ResultOrganizationProtos.ResultOrganization;
+import eu.dnetlib.data.proto.ResultOrganizationProtos.ResultOrganization.Affiliation;
 import eu.dnetlib.data.proto.ResultProjectProtos.ResultProject;
 import eu.dnetlib.data.proto.ResultProjectProtos.ResultProject.Outcome;
 import eu.dnetlib.data.proto.ResultProtos.Result;
@@ -127,6 +129,12 @@
 			ResultProject.Builder resultProject = ResultProject.newBuilder().setOutcome(outcome);
 
 			return serializeOafRel(nodeList, eSource, eTarget, relType, SubRelType.outcome, relClass, collectedFromId, collectedFromName, false, resultProject, outcome);
+		case resultOrganization:
+			Affiliation.Builder affiliation = Affiliation.newBuilder().setRelMetadata(
+					RelMetadata.newBuilder().setSemantics(getSimpleQualifier(Affiliation.RelName.valueOf(relClass).toString(), relScheme)));
+			ResultOrganization.Builder resultOrganization = ResultOrganization.newBuilder().setAffiliation(affiliation);
+
+			return serializeOafRel(nodeList, eSource, eTarget, relType, SubRelType.affiliation, relClass, collectedFromId, collectedFromName, false, resultOrganization, affiliation);
 		default:
 			throw new IllegalArgumentException("unhandled relType: " + relationType);
 		}
Index: modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctions.java
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctions.java	(revision 48000)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctions.java	(revision 48001)
@@ -7,6 +7,7 @@
 import com.google.gson.reflect.TypeToken;
 import org.apache.commons.lang.StringUtils;
 
+
 /**
  * * <xsl:stylesheet ... xmlns:openTrials="eu.dnetlib.miscutils.functional.xml.OpenTrialsFunctions"> ... </xsl:stylesheet>
  * Created by alessia on 13/05/16.
@@ -19,6 +20,7 @@
 	 * @param jsonProvList A json string in the following format: [{"url" : "theUrl", "sourceID" : "theSourceId", "sourceName" : "theSourceName"}]
 	 * @return the url value in the first object in the list
 	 */
+	@Deprecated
 	public static String getMainIdentifierURL(String jsonProvList) {
 		List<JsonProv> provs = getProvs(jsonProvList);
 		for (JsonProv prov : provs) {
@@ -27,7 +29,140 @@
 		return "";
 	}
 
+	/**
+	 * Parses a Json to get the url item associated to the primary record if any
+	 * @param jsonRecordsList A json string in the format [{"source_id","theSourceId","source_url","theUrlOfTheTrialForThisSource", "is_primary","typeOfTheTrial")}]
+	 * @return the url value of the primary record
+	 */
+	public static String getPrimaryRecordUrl(String jsonRecordsList){
+		List<JsonRecord> records = getRecords(jsonRecordsList);
+		for (JsonRecord record : records) {
+			if(record.isIs_primary() && StringUtils.isNotBlank(record.getSource_url()))
+				return record.getSource_url();
+		}
+		if (!records.isEmpty() && StringUtils.isNotBlank(records.get(0).getSource_url())){
+			return records.get(0).getSource_url();
+		}
+		return "";
+	}
 
+	/**
+	 * Parses a Json to get the id of the source associated to the primary record if any
+	 * @param jsonRecordsList A json string in the format [{"source_id","theSourceId","source_url","theUrlOfTheTrialForThisSource", "is_primary","typeOfTheTrial")}]
+	 * @return the id of the source of the primary record
+	 */
+	public static String getPrimaryRecordIdentifier(String jsonRecordsList){
+		List<JsonRecord> records = getRecords(jsonRecordsList);
+		for (JsonRecord record : records) {
+			if(record.isIs_primary() && StringUtils.isNotBlank(record.getSource_id()))
+				return record.getSource_id();
+		}
+		if (!records.isEmpty() && StringUtils.isNotBlank(records.get(0).getSource_url())){
+			return records.get(0).getSource_id();
+		}
+		return "";
+	}
+
+	/**
+	 * Parses a Json to get the list of the not primary url associated to the trial if any
+	 * @param jsonRecordsList A json string in the format [{"source_id","theSourceId","source_url","theUrlOfTheTrialForThisSource", "is_primary","typeOfTheTrial")}]
+	 * @return a string containing the not primary source urls divided by "@@"
+	 */
+	public static String getNotPrimaryRecordUrl(String jsonRecordsList){
+		boolean found = false;
+		String ret = "";
+		List<JsonRecord> records = getRecords(jsonRecordsList);
+		for (JsonRecord record : records) {
+			if(record.isIs_primary())
+				found = true;
+			else
+			if(StringUtils.isNotBlank(record.getSource_url()))
+				ret += record.getSource_url() + "@@";
+		}
+		if (!found && ret.length() > 0){
+			ret = ret.substring(ret.indexOf("@@")+2);
+		}
+		if(ret.endsWith("@@"))
+			ret = ret.substring(0,ret.length()-2);
+
+		return ret;
+	}
+
+	/**
+	 * Parses a Json to get the names of the principal investigators of the trial if any
+	 * @param jsonPeopleList A json string in the format [{"person_name", "thePersonName", "person_id","thePersonId", "person_role",thePersonRole)}]
+	 * @return a string containing the names of the principal investigators divided by @@
+	 */
+	public static String getPrincipalInvestigators(String jsonPeopleList){
+		List<JsonPeople> people = getPeople(jsonPeopleList);
+		String ret ="";
+		for (JsonPeople person : people) {
+			if(StringUtils.isNotBlank(person.getPerson_role()) && (person.getPerson_role().equals("principal_investigator"))){
+				ret += conformToGuidelines(person.getPerson_name()) + "@@";
+			}
+
+		}
+		if(ret.endsWith("@@")){
+			ret=ret.substring(0,ret.length()-2);
+		}
+		return ret;
+	}
+
+	private static String conformToGuidelines(String person_name) {
+
+		if (person_name.indexOf(",") > -1)
+			person_name = person_name.substring(0,person_name.indexOf(","));
+		String[] name = person_name.split(" ");
+		person_name = name[name.length-1] + ",";
+		for(int i=0;i<name.length-1; i++)
+			person_name += " " + name[i];
+
+		return person_name;
+	}
+
+	/**
+	 * Parses a Json to get the names of the organizations supporting the trial if any
+	 * @param jsonOrganizationList A json string in the format [{"organization_name", "theOrganizationName", "organization_id","theOrganizationId", "organization_role",theOrganizationRole)}]
+	 * @return a string containing the names and roles of the organizations
+	 */
+	public static String getTrialOrganizations(String jsonOrganizationList){
+		List<JsonOrganization> organizations = getOrganizations(jsonOrganizationList);
+		String ret ="";
+		for (JsonOrganization o : organizations) {
+			if (StringUtils.isNotBlank(o.getOrganization_id())) {
+				ret += o.getOrganization_name() + "@";
+				if (o.getOrganization_role().equalsIgnoreCase("primary_sponsor"))
+					ret += "sponsor@@";
+				else
+					ret += o.getOrganization_role() + "@@";
+			}
+		}
+		if(ret.endsWith("@@")){
+			ret=ret.substring(0,ret.length()-2);
+		}
+		return ret;
+	}
+
+	/**
+	 * Parses a Json to get the names of the locations where the trial take place if any
+	 * @param jsonLocationsList A json string in the format [{"location_name","theLocationName"}]
+	 * @return a string containing the locations associated to the trial divided by "@@"
+	 */
+	public static String getTrialLocations(String jsonLocationsList){
+		List<JsonLocation> locations = getLocations(jsonLocationsList);
+		String ret ="";
+		for (JsonLocation l : locations) {
+			if (StringUtils.isNotBlank(l.getLocation_name()))
+				ret += l.getLocation_name() + "@@";
+
+		}
+		if(ret.endsWith("@@")){
+			ret=ret.substring(0,ret.length()-2);
+		}
+		return ret;
+	}
+
+	@Deprecated
 	public static List<JsonProv> getProvs(String jsonProvList) {
 		Gson gson = new Gson();
 		Type type = new TypeToken<List<JsonProv>>() {
@@ -35,6 +170,36 @@
 		return gson.fromJson(jsonProvList, type);
 	}
 
+	public static List<JsonRecord> getRecords(String jsonRecordsList) {
+		Gson gson = new Gson();
+		Type type = new TypeToken<List<JsonRecord>>() {
+		}.getType();
+		return gson.fromJson(jsonRecordsList, type);
+	}
+
+
+	public static List<JsonPeople> getPeople(String jsonPeopleList) {
+		Gson gson = new Gson();
+		Type type = new TypeToken<List<JsonPeople>>() {
+		}.getType();
+		return gson.fromJson(jsonPeopleList, type);
+	}
+
+	public static List<JsonOrganization> getOrganizations(String jsonOrganizationsList) {
+		Gson gson = new Gson();
+		Type type = new TypeToken<List<JsonOrganization>>() {
+		}.getType();
+		return gson.fromJson(jsonOrganizationsList, type);
+	}
+
+	public static List<JsonLocation> getLocations(String jsonLocationsList) {
+		Gson gson = new Gson();
+		Type type = new TypeToken<List<JsonLocation>>() {
+		}.getType();
+		return gson.fromJson(jsonLocationsList, type);
+	}
+
+	@Deprecated
 	static class JsonProv {
 
 		String url, sourceId, sourceName;
@@ -63,4 +228,101 @@
 			this.sourceName = sourceName;
 		}
 	}
+
+	static class JsonRecord{
+		String source_id, source_url;
+		boolean is_primary;
+
+		public String getSource_id() {
+			return source_id;
+		}
+
+		public String getSource_url() {
+			return source_url;
+		}
+
+		public void setSource_id(String source_id) {
+			this.source_id = source_id;
+		}
+
+		public void setSource_url(String source_url) {
+			this.source_url = source_url;
+		}
+
+		public boolean isIs_primary() {
+			return is_primary;
+		}
+
+		public void setIs_primary(final boolean is_primary) {
+			this.is_primary = is_primary;
+		}
+	}
+
+	static class JsonPeople{
+		String person_name, person_id, person_role;
+
+		public String getPerson_name() {
+			return person_name;
+		}
+
+		public void setPerson_name(String person_name) {
+			this.person_name = person_name;
+		}
+
+		public String getPerson_id() {
+			return person_id;
+		}
+
+		public void setPerson_id(String person_id) {
+			this.person_id = person_id;
+		}
+
+		public String getPerson_role() {
+			return person_role;
+		}
+
+		public void setPerson_role(String person_role) {
+			this.person_role = person_role;
+		}
+	}
+
+	static class JsonOrganization{
+		String organization_name, organization_id, organization_role;
+
+		public String getOrganization_name() {
+			return organization_name;
+		}
+
+		public void setOrganization_name(String organization_name) {
+			this.organization_name = organization_name;
+		}
+
+		public String getOrganization_id() {
+			return organization_id;
+		}
+
+		public void setOrganization_id(String organization_id) {
+			this.organization_id = organization_id;
+		}
+
+		public String getOrganization_role() {
+			return organization_role;
+		}
+
+		public void setOrganization_role(String organization_role) {
+			this.organization_role = organization_role;
+		}
+	}
+
+	static class JsonLocation{
+		String location_name;
+
+		public String getLocation_name() {
+			return location_name;
+		}
+
+		public void setLocation_name(String location_name) {
+			this.location_name = location_name;
+		}
+	}
 }
Index: modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/FWFXsltFunctions.java
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/FWFXsltFunctions.java	(nonexistent)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/main/java/eu/dnetlib/data/transform/xml/FWFXsltFunctions.java	(revision 48001)
@@ -0,0 +1,30 @@
+package eu.dnetlib.data.transform.xml;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Created by miriam on 04/05/2017.
+ */
+public class FWFXsltFunctions {
+	public static String getName(String name, boolean first){
+		String[] split = name.split(" ");
+		name ="";
+		for (int i = 0; i< split.length; i++)
+			if(!split[i].equals(split[i].toUpperCase())) {
+				if (first)
+					name += split[i] + " ";
+			}
+			else{
+				if(!first){
+					name += split[i] + " ";
+				}
+			}
+		return name.trim();
+	}
+
+	public static String getMd5(String name){
+		if(StringUtils.isNotBlank(name ) && StringUtils.isNotEmpty(name))
+			return AbstractDNetXsltFunctions.md5(name);
+		return name;
+	}
+}
Index: modules/dnet-openaireplus-mapping-utils/trunk/src/main/resources/eu/dnetlib/actionmanager/xslt/datacite2insertActions.xslt
===================================================================
--- modules/dnet-openaireplus-mapping-utils/trunk/src/main/resources/eu/dnetlib/actionmanager/xslt/datacite2insertActions.xslt	(revision 48000)
+++ modules/dnet-openaireplus-mapping-utils/trunk/src/main/resources/eu/dnetlib/actionmanager/xslt/datacite2insertActions.xslt	(revision 48001)
@@ -111,14 +111,44 @@
 
 							<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdTemp))"/>
 
-							<xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/>
+							<xsl:variable name="originalPersonId">
+								<xsl:choose>
+									<xsl:when test="./*[local-name() = 'nameIdentifier']">
+										<xsl:value-of select="./*[local-name() = 'nameIdentifier'][0]"/>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:value-of select="''"/>
+									</xsl:otherwise>
+								</xsl:choose>
+							</xsl:variable>
 
+							<xsl:variable name="nameIdentifier">
+								<xsl:choose>
+									<xsl:when test="./*[local-name() = 'nameIdentifier']">
+										<xsl:value-of select="./*[local-name() = 'nameIdentifier'][0]"/>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:value-of select="''"/>
+									</xsl:otherwise>
+								</xsl:choose>
+							</xsl:variable>
+							<xsl:variable name="nameIdentifierScheme">
+								<xsl:choose>
+									<xsl:when test="./*[local-name() = 'nameIdentifier']">
+										<xsl:value-of select="./*[local-name() = 'nameIdentifier'][0]/@nameIdentifierScheme"/>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:value-of select="''"/>
+									</xsl:otherwise>
+								</xsl:choose>
+							</xsl:variable>
+
 							<xsl:if test="string-length($personId) &gt; 0">
 								<xsl:variable name="position" select="position()"/>
 								<xsl:variable name="person"
 								              select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
 			                              $originalPersonId, $dateOfCollection, $dateoftransformation, normalize-space(./*[local-name() = 'creatorName']),
-			                              ./*[local-name() = 'nameIdentifier'], ./*[local-name() = 'nameIdentifier']/@nameIdentifierScheme)"/>
+			                              $nameIdentifier, $nameIdentifierScheme)"/>
 								<xsl:variable name="personresult"
 								              select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf',
 			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
