Index: TXM/trunk/org.txm.utils/src/org/txm/utils/FileUtils.java
===================================================================
--- TXM/trunk/org.txm.utils/src/org/txm/utils/FileUtils.java	(revision 3518)
+++ TXM/trunk/org.txm.utils/src/org/txm/utils/FileUtils.java	(revision 3519)
@@ -44,6 +44,10 @@
 		return FilenameUtils.getBaseName(f.getName());
 	}
 	
+	public static String stripExtension(String filename) {
+		return FilenameUtils.getBaseName(filename);
+	}
+	
 	/**
 	 * select file and directories
 	 * ignore hidden files
Index: TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImport.groovy
===================================================================
--- TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImport.groovy	(revision 3518)
+++ TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImport.groovy	(revision 3519)
@@ -10,7 +10,6 @@
 import org.txm.importer.ApplyXsl2;
 import org.txm.importer.xtz.*
 import org.txm.objects.Project
-import org.txm.utils.BundleUtils;
 import org.txm.utils.io.FileCopy;
 import org.txm.utils.io.IOUtils
 import org.apache.log4j.BasicConfigurator;
@@ -50,31 +49,59 @@
 		CallUD2TigerPerlScript cutps = new CallUD2TigerPerlScript();
 		
 		if (cutps.canBuildTSFiles()) {
-			cutps.convertCoNLLUFiles(this.sourceDirectory.getAbsolutePath(), this.binaryDirectory.getAbsolutePath())
 			
+			println "Converting CoNLL-U files to TIGER-XML files..."
+			
+			cutps.convertCoNLLUFiles(this.sourceDirectory.listFiles(), this.binaryDirectory.getAbsolutePath())
+			
 			File tigerXMLDirectory = new File(this.binaryDirectory, "tiger-xml")
 			String driverFilename = TigerSearchPreferences.getInstance().getString(TigerSearchPreferences.DRIVER_FILENAME);
 			File xslfile1 = BundleUtils.getFile("org.txm.conllu.core", "groovy", "/org/txm/scripts/importer/conllu/", "tigerXml-commentOutLongSentences.xsl")
-			File xslfile2 = BundleUtils.getFile("org.txm.conllu.core", "groovy", "/org/txm/scripts/importer/conllu/", "tigerXml-sortBfmByDate.xsl")
+			//File xslfile2 = BundleUtils.getFile("org.txm.conllu.core", "groovy", "/org/txm/scripts/importer/conllu/", "tigerXml-sortBfmByDate.xsl")
 			
 			println "Post-processing TIGER-XML files..."
 			ApplyXsl2 a1 = new ApplyXsl2(xslfile1);
-			ApplyXsl2 a2 = new ApplyXsl2(xslfile2);
+			//ApplyXsl2 a2 = new ApplyXsl2(xslfile2);
 			for (File xmlFile : tigerXMLDirectory.listFiles()) {
 				
 				if (!xmlFile.getName().endsWith(".xml")) continue;
-				if (xmlFile.getName().equals(driverFilename)) continue;
+				if (xmlFile.getName().equals(driverFilename)) continue; // don't process the driver
 				
 				File xmlFileTmp = new File(xmlFile.getAbsolutePath()+".tmp")
 				if (!(a1.process(xmlFile, xmlFileTmp) && xmlFile.delete() && xmlFileTmp.renameTo(xmlFile))) {
 					println "Error while applying $xslfile1 to $xmlFile"
 				}
 				
-				if (!(a2.process(xmlFile, xmlFileTmp) && xmlFile.delete() && xmlFileTmp.renameTo(xmlFile))) {
-					println "Error while applying $xslfile2 to $xmlFile"
+//				if (!(a2.process(xmlFile, xmlFileTmp) && xmlFile.delete() && xmlFileTmp.renameTo(xmlFile))) {
+//					println "Error while applying $xslfile2 to $xmlFile"
+//				}
+			}
+			
+			println "Patching TIGER-XML driver file..."
+			def tigerxmlFiles = []
+			def xmltxmFilesNames = this.getTXMFilesOrder();
+			println "xml-txm files: "+xmltxmFilesNames
+			for (String name : xmltxmFilesNames) {
+				name = FileUtils.stripExtension(name);
+				
+				File connluFile = new File(this.binaryDirectory, "tiger-xml/"+name+".xml")
+				println " test "+connluFile
+				if (connluFile.exists()) {
+					tigerxmlFiles << connluFile
 				}
 			}
 			
+			// patch the subcorpus tags in the driver XML file with the right corpus order
+			File driver = new File(this.binaryDirectory, "tiger-xml/"+driverFilename)
+			String content = IOUtils.getText(driver, "UTF-8");
+			content = content.replaceAll("<subcorpus .+\n", "");
+			String subcorpusList = "";
+			for (String name : xmltxmFilesNames) {
+				name = FileUtils.stripExtension(name);
+				subcorpusList += "<subcorpus name=\"$name\" external=\"file:${name}.xml\"/>\n"
+			}
+			content = content.replaceAll("<body>", "<body>\n"+subcorpusList+"\n"); // get the last main.xml content and patch it with the subcorpus tags
+			IOUtils.setText(driver, content, "UTF-8");
 			// build TIGER indexes
 			if (isSuccessful) {
 				// read from the 'tiger-xml' and write to the 'tiger' directory
Index: TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy
===================================================================
--- TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy	(revision 3518)
+++ TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/CoNLLUImporter.groovy	(revision 3519)
@@ -62,7 +62,7 @@
 		
 		boolean keepContractions =  UDPreferences.getInstance().getString(UDPreferences.KEEP_CONTRACTIONS)
 		
-		boolean usenewdocid =  UDPreferences.getInstance().getString(UDPreferences.IMPORT_USE_NEW_DOC_ID)
+		boolean usenewdocid =  false; // THE conllu -> Tiger XSL MUST HAVE THE SAME BEHAVIOR BEFORE // UDPreferences.getInstance().getString(UDPreferences.IMPORT_USE_NEW_DOC_ID)
 		
 		def headPropertiesToProject = UDPreferences.getInstance().getString(UDPreferences.IMPORT_HEAD_TO_PROJECT).split(",") as Set
 		
Index: TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/conll2tiger-ud.pl
===================================================================
--- TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/conll2tiger-ud.pl	(revision 3518)
+++ TXM/trunk/org.txm.connlu.core/groovy/org/txm/scripts/importer/conllu/conll2tiger-ud.pl	(revision 3519)
@@ -172,13 +172,14 @@
 if ( $infile eq '' ) {
 	$infile = 'subcorpus';
 }
-my $counter = 1;
-$suffix = sprintf( "%05d", $counter );
+#MD disable the counter and suffix variables and file renaming "$infilename-$suffix" -> "$infilename"
+#my $counter = 1;
+#$suffix = sprintf( "%05d", $counter );
 $infilename = basename($infile);
 
 mkdir("$outdir");
-open( XML, ">$outdir/$infilename-$suffix.xml" )
-  or die "\nopen file error of $outdir/$infilename-$suffix.xml\n";
+open( XML, ">$outdir/$infilename.xml" )
+  or die "\nopen file error of $outdir/$infilename.xml\n";
 open( LOG, ">$outdir/conversion.log" )
   or die "\nopen file error of conversion.log\n";
 open( MASTER, ">$outdir/main.xml" ) or die "\nopen file error of main.xml\n";
@@ -194,18 +195,18 @@
 $commandline = $0 . " " . ( join " ", @ARGV );
 print LOG "$commandline\n\n";
 
-print MASTER "<subcorpus name='$infilename-$suffix' external='file:$infilename-$suffix.xml'/>\n";
+print MASTER "<subcorpus name='$infilename' external='file:$infilename.xml'/>\n";
 
 $/ = "";    # treat empty line as RS
 while (<>) {
 	if ( $. % $split == 0 ) {
 		print XML "</subcorpus>\n";
 		close(XML);
-		$suffix = sprintf( "%05d", ++$counter );
-		open( XML, ">$outdir/$infilename-$suffix.xml" )
+		#$suffix = sprintf( "%05d", ++$counter );
+		open( XML, ">$outdir/$infilename.xml" )
 		  or die "\nopen file error\n";
 		write_xml_header();
-		print MASTER "<subcorpus name='$infilename-$suffix' external='file:$infilename-$suffix.xml'/>\n";
+		print MASTER "<subcorpus name='$infilename' external='file:$infilename.xml'/>\n";
 	}
 
 	# ----------------------------------------
@@ -551,7 +552,7 @@
 
 sub write_xml_header {
 	print XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-  <subcorpus name=\"$infilename-$suffix\">
+  <subcorpus name=\"$infilename\">
 ";
 }
 
Index: TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/CallUD2TigerPerlScript.java
===================================================================
--- TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/CallUD2TigerPerlScript.java	(revision 3518)
+++ TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/CallUD2TigerPerlScript.java	(revision 3519)
@@ -4,6 +4,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
 
 import org.eclipse.core.runtime.IStatus;
 import org.txm.core.engines.ScriptEngine;
@@ -28,15 +29,10 @@
 		return true;
 	}
 	
-	public boolean convertCoNLLUFiles(String input_directory_path, String output_directory) throws IOException {
+	public boolean convertCoNLLUFiles(File[] connluFiles, String output_directory) throws IOException {
 		
-		File input_directory = new File(input_directory_path);
+		if (connluFiles.length == 0) return false;
 		
-		if (input_directory_path.length() == 0 && input_directory.canRead()) {
-			System.out.println("** impossible to access directory "+input_directory+". Aborting.");
-			return false;
-		}
-		
 		File tigerXMLDirectory = new File(output_directory, "tiger-xml");
 		File conversionFile = new File(tigerXMLDirectory, "conversion.log");
 		
@@ -53,7 +49,8 @@
 		//println "Converting..."
 		
 		String subcorpusList = "";
-		for (File f : input_directory.listFiles()) {
+
+		for (File f : connluFiles) {
 			
 			if (!f.getName().endsWith(".conllu")) {
 				continue;
