Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy	(revision 1062)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy	(revision 1063)
@@ -43,12 +43,12 @@
 
 	public void process(ArrayList<File> files) {
 		super.process(files);
-		
+
 		if (files == null) {
 			files = inputDirectory.listFiles();
 			if (files != null) Collections.sort(files);
 		}
-		
+
 		if (!doDefaultEditionStep()) return;
 		if (!doFacsEditionStep()) return;
 		if (!doPostEditionXSLStep()) return;
@@ -58,12 +58,12 @@
 	}
 
 	public boolean doDefaultEditionStep() {
-		
+
 		boolean build_edition = module.getParameters().getDoEdition("default")
 		if (!build_edition) {
 			return true;
 		}
-		
+
 		def second = 0
 
 		println "-- Building 'default' edition of  ${files.size()} texts..."
@@ -79,47 +79,56 @@
 						css << "css/"+cssFile.getName();
 				}
 		}
+
 		ConsoleProgressBar cpb = new ConsoleProgressBar(files.size())
 		for (File txmFile : files) {
-			cpb.tick()
-			String textname = txmFile.getName();
-			int i = textname.lastIndexOf(".");
-			if (i > 0) textname = textname.substring(0, i);
+			try {
+				cpb.tick()
+				String textname = txmFile.getName();
+				int i = textname.lastIndexOf(".");
+				if (i > 0) textname = textname.substring(0, i);
 
-			File firstHTMLPageFile = new File(outputDirectory, textname+"_1.html");
-			if (firstHTMLPageFile.exists() && firstHTMLPageFile.lastModified() >= txmFile.lastModified()) continue;
+				File firstHTMLPageFile = new File(outputDirectory, textname+"_1.html");
+				if (firstHTMLPageFile.exists() && firstHTMLPageFile.lastModified() >= txmFile.lastModified()) continue;
 
-			List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
-			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
+				List<String> NoSpaceBefore = LangFormater.getNoSpaceBefore(lang);
+				List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
 
-			Element texts = params.getTextsElement(corpusElem);
-			Element text = params.getTextElement(texts, textname);
-			if (text == null) { // just in case
-				text = params.addText(corpusElem, textname, txmFile)
-			}
-			def ed = new XTZDefaultPagerStep(this, txmFile, textname, NoSpaceBefore, NoSpaceAfter, css);
-			Element edition = params.getEditionElement(text, "default");
-			if (edition == null) {
-				edition = params.addEdition(text, "default", outputDirectory.getAbsolutePath(), "html");
-			} else { // remove existing pages if any
-				def children = edition.getChildNodes();
-				while (children.getLength() > 0 ) {
-					edition.removeChild(children.item(0))
+				Element texts = params.getTextsElement(corpusElem);
+				Element text = params.getTextElement(texts, textname);
+				if (text == null) { // just in case
+					text = params.addText(corpusElem, textname, txmFile)
 				}
-			}
+				def ed = new XTZDefaultPagerStep(this, txmFile, textname, NoSpaceBefore, NoSpaceAfter, css);
+				if (!ed.process()) {
+					println "Fail to build 'default' edition for text: $txmFile"
+					continue;
+				}
+				Element edition = params.getEditionElement(text, "default");
+				if (edition == null) {
+					edition = params.addEdition(text, "default", outputDirectory.getAbsolutePath(), "html");
+				} else { // remove existing pages if any
+					def children = edition.getChildNodes();
+					while (children.getLength() > 0 ) {
+						edition.removeChild(children.item(0))
+					}
+				}
 
-			for (i = 0 ; i < ed.getPageFiles().size();) {
-				File f = ed.getPageFiles().get(i);
-				String wordid = ed.getIdx().get(i);
-				params.addPage(edition, ""+(++i), wordid);
+				for (i = 0 ; i < ed.getPageFiles().size();) {
+					File f = ed.getPageFiles().get(i);
+					String wordid = ed.getIdx().get(i);
+					params.addPage(edition, ""+(++i), wordid);
+				}
+			} catch(Exception e) {
+				println "Error: could not create $txmFile 'default' edition: "+e
 			}
 		}
-		
+
 		// copy default TXM css file in the "facs" edition directory
 		File csshtmlDirectory = new File(outputDirectory, "css")
 		csshtmlDirectory.mkdirs()
 		BundleUtils.copyFiles("org.txm.core", "res", "org/txm/css", "txm.css", csshtmlDirectory);
-		
+
 		// copy CSS files in the "default" edition directory
 		if (cssDirectory.exists()) {
 			FileCopy.copyFiles(cssDirectory, csshtmlDirectory)
@@ -142,7 +151,7 @@
 
 		boolean mustBuildFacsEdition = module.getParameters().getDoFacsEdition();
 		if (!mustBuildFacsEdition) return true;
-		
+
 		String imageDirectoryPath = module.getParameters().getFacsEditionImageDirectory().trim();
 		File imageDirectory = new File(imageDirectoryPath);
 		if (!imageDirectoryPath.startsWith("http") && imageDirectoryPath.length()== 0 && !imageDirectory.exists() && !imageDirectory.isDirectory()) {
@@ -193,17 +202,17 @@
 			try {
 				def ed = new XTZFacsPagerStep(txmFile, newEditionDirectory, imageDirectory, txtname, corpusname, "pb", "facs", wordTag, debug);
 				if (!ed.process()) {
-					println "Fail to build edition for text: $txmFile"
+					println "Fail to build 'facs' edition for text: $txmFile"
 					continue;
 				}
 
-				
+
 				def pages = ed.getPageFiles()
 				for (i = 0 ; i < pages.size();) {
 					File f = pages[i][0];
 					String wordid = pages[i][1]
 					//TODO replace '""+(++i)' with something that fetch/findout the page 'name'
-					// TODO or move the Edition and Page corpus declaration in the XTZDefaultPagerStep 
+					// TODO or move the Edition and Page corpus declaration in the XTZDefaultPagerStep
 					params.addPage(edition, ""+(++i), wordid);
 					//println "add facs page: $f $wordid"
 				}
@@ -219,18 +228,18 @@
 			editionImagesDirectory.mkdirs();
 			FileCopy.copyFiles(imageDirectory, editionImagesDirectory);
 		}
-		
+
 		// copy SimpleViewer files in the "facs" edition directory
 		File jshtmlDirectory = new File(newEditionDirectory, "js")
 		jshtmlDirectory.mkdirs()
 		BundleUtils.copyFiles("org.txm.core", "res", "org/txm/js", "viewer", jshtmlDirectory);
 		BundleUtils.copyFiles("org.txm.core", "res", "org/txm/", "images", newEditionDirectory);
-		
+
 		// copy default TXM css file in the "facs" edition directory
 		File csshtmlDirectory = new File(newEditionDirectory, "css")
 		csshtmlDirectory.mkdirs()
 		BundleUtils.copyFiles("org.txm.core", "res", "org/txm/css", "txm.css", csshtmlDirectory);
-		
+
 		// copy CSS/JS/Images sources files in the "facs" edition directory
 		if (cssDirectory.exists()) {
 			FileCopy.copyFiles(cssDirectory, csshtmlDirectory)
@@ -242,7 +251,7 @@
 			File imageshtmlDirectory = new File(newEditionDirectory, "images")
 			FileCopy.copyFiles(imagesDirectory, imageshtmlDirectory)
 		}
-		
+
 		Element editionsElement = params.getEditionsElement(corpusElem);
 		editionsElement.setAttribute("default","default,facs");
 
@@ -264,8 +273,8 @@
 			String s = module.getParameters().getWordsPerPage("default");
 			if (s != null && s.length() > 0)
 
-			// shared XSL parameters
-			xslParams["number-words-per-page"] = Integer.parseInt(s);
+				// shared XSL parameters
+				xslParams["number-words-per-page"] = Integer.parseInt(s);
 			xslParams["pagination-element"] = module.getParameters().getPageElement("default")
 			xslParams["import-xml-path"] = module.getParameters().paramFile.toURI().toString()
 			//println "XSL PARAMS: "+xslParams
@@ -276,7 +285,7 @@
 			for (File xslFile : xslFiles) {
 				if (xslFile.isDirectory() || xslFile.isHidden() || !xslFile.getName().endsWith(".xsl")) continue;
 				if (!xslFile.getName().matches("[1-9]-.+")) continue;
-				
+
 				String xslName = xslFile.getName().substring(2); // remove the "1-", "2-", etc.
 				int idx2 = xslName.indexOf(".")
 				if (idx2 > 0) xslName = xslName.substring(0, idx2)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 1062)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 1063)
@@ -129,7 +129,7 @@
 		String elems = pager.getImportModule().getParameters().getOutSideTextTagsAndKeepContentElement().getTextContent()
 		if (elems != null) for (def s : elems.split(",")) outOfTextElements << s;
 		
-		process();
+		//process();
 	}
 	
 	public String getAttributeValue(def parser, String ns, String name) {
@@ -396,12 +396,12 @@
 
 							break;
 						case "p":
-						case "lg":
+						//case "lg":
 							pagedWriter.write("\n");
 							pagedWriter.writeStartElement("p", ["class":rend])
 							break;
 						case "lb":
-						case "l":
+						//case "l":
 							pagedWriter.writeEmptyElement("br", ["class":rend])
 							break;
 						case wordTag:
@@ -432,6 +432,9 @@
 								flagNote = true;
 								noteContent = ""
 							}
+//							 else {
+//								pagedWriter.writeStartElement("span", ["class":localname])
+//							}
 							break;
 					}
 					break;
@@ -442,7 +445,7 @@
 					
 					switch (localname) {
 						case "p":
-						case "lg":
+						//case "lg":
 							pagedWriter.writeEndElement() // </p>
 							pagedWriter.write("\n");
 							break;
@@ -517,7 +520,10 @@
 									pagedWriter.writeEndElement() // </sub>
 									pagedWriter.writeEndElement() // </span>
 								}
-							}
+							} 
+//							else {
+//								pagedWriter.writeEndElement() // the element
+//							}
 							break;
 					}
 					break;
@@ -538,4 +544,5 @@
 		}
 		closeMultiWriter();
 	}
+
 }
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 1062)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteGroovyScript.java	(revision 1063)
@@ -213,7 +213,7 @@
 		String dir = currentRootDir.getAbsolutePath();
 		String path = scriptfile.getAbsolutePath();
 		if (!path.startsWith(dir)) {
-			System.out.println(TXMUIMessages.bind(TXMUIMessages.ExecuteGroovyScriptFromFile_2, dir));
+			System.out.println(TXMUIMessages.bind(TXMUIMessages.ExecuteGroovyScriptFromFile_2, dir, path));
 			return;
 		}
 		final String relativepath = path.substring(dir.length()+1);
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 1062)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties	(revision 1063)
@@ -293,7 +293,7 @@
 
 Error_creating_partition = Error while creating a partition: {0}
 
-ExecuteGroovyScriptFromFile_2 = The groovy script must be in the folder: {0}
+ExecuteGroovyScriptFromFile_2 = The {1} Groovy script must be in the {0} folder. 
 
 ExecuteGroovyScript_0         = \ ms
 ExecuteGroovyScript_1         = Error during parameters initialisation
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_ru.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_ru.properties	(revision 1062)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_ru.properties	(revision 1063)
@@ -226,7 +226,7 @@
 
 Error_creating_partition = ** Ошибка во время создания распределения: {0}
 
-ExecuteGroovyScriptFromFile_2 = Скрипт Groovy должен находиться в папке 
+ExecuteGroovyScriptFromFile_2 = Скрипт Groovy должен находиться в папке {0} {1}
 
 ExecuteGroovyScript_0         = \ мс
 ExecuteGroovyScript_1         = N/A_Error during parameters initialisation
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 1062)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties	(revision 1063)
@@ -262,7 +262,7 @@
 
 Error_creating_partition = ** Erreur lors de la création de la partition : {0}
 
-ExecuteGroovyScriptFromFile_2 = Le script Groovy doit être dans le dossier {0}
+ExecuteGroovyScriptFromFile_2 = Le script Groovy {1} doit être dans le dossier {0}
 
 ExecuteGroovyScript_0         = \ ms
 ExecuteGroovyScript_1         = Erreur lors de l'initialisation des paramètres
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java	(revision 1062)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroExplorer.java	(revision 1063)
@@ -80,11 +80,11 @@
 
 	/** The home. */
 	protected static String home = Toolbox.getTxmHomePath();
-	protected static String homeUser = Toolbox.getTxmHomePath();
+	//protected static String homeUser = Toolbox.getTxmHomePath();
 
 	protected static File currentRootDir;
 
-	protected static File currentUserRootDir; 
+	//protected static File currentUserRootDir; 
 	
 	protected static boolean showAll = false;
 	
@@ -105,16 +105,16 @@
 		home = Toolbox.getTxmHomePath(); 
 		if (home == null) home = System.getProperty("user.home"); //$NON-NLS-1$
 		
-		File scriptsUserDir = new File(home, "scripts/groovy/user/"); //$NON-NLS-1$
-		File scriptsDir = new File(home, "scripts/groovy/system/"); //$NON-NLS-1$
+		//File scriptsUserDir = new File(home, "scripts/groovy/user/"); //$NON-NLS-1$
+		File scriptsDir = new File(home, "scripts/groovy/user/"); //$NON-NLS-1$
 		currentRootDir = new File(scriptsDir, "org/txm/macro"); //$NON-NLS-1$
-		currentUserRootDir = new File(scriptsUserDir, "org/txm/macro"); //$NON-NLS-1$
+		//currentUserRootDir = new File(scriptsUserDir, "org/txm/macro"); //$NON-NLS-1$
 		home = currentRootDir.getAbsolutePath();
-		homeUser = currentUserRootDir.getAbsolutePath();
+		//homeUser = currentUserRootDir.getAbsolutePath();
 	}
 
 	public String getHome() { return home;}
-	public String getUserHome() { return homeUser;}
+	//public String getUserHome() { return homeUser;}
 	
 	/**
 	 * Refresh.
Index: tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java
===================================================================
--- tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 1062)
+++ tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java	(revision 1063)
@@ -54,9 +54,8 @@
 			public int compare(IConfigurationElement o1, IConfigurationElement o2) {
 				return o1.getAttribute("position").compareTo(o2.getAttribute("position"));
 			}
-
 		});
-		Log.warning("Installing ConcordanceEditorExtension...");
+		Log.warning("Installing AnnotationExtension...");
 		Log.warning(Arrays.toString(config));
 
 		System.out.println("Installing annotation modes... ");
Index: tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy
===================================================================
--- tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy	(revision 1062)
+++ tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy	(revision 1063)
@@ -6,6 +6,8 @@
 import org.txm.utils.io.FileCopy
 import org.txm.importer.xtz.*
 import org.txm.scripts.importer.xtz.*
+import org.txm.importer.ApplyXsl2;
+
 /**
  * Only build the Metadatas object since all XML-TXM files already exists.
  * Metadatas is used to build text order.
@@ -19,25 +21,105 @@
 	public TSImporter(ImportModule module) {
 		super(module);
 	}
-	
+
 	@Override
 	public void process() {
-		File binDir = module.getBinaryDirectory();
 		
 		//prepare metadata if any
 		File allMetadataFile = Metadatas.findMetadataFile(inputDirectory);
-		println allMetadataFile
 		if (allMetadataFile.exists()) {
-			File copy = new File(binDir, allMetadataFile.getName())
+			File copy = new File(module.getBinaryDirectory(), allMetadataFile.getName())
 			if (!FileCopy.copy(allMetadataFile, copy)) {
 				println "Error: could not create a copy of the metadata file "+allMetadataFile.getAbsoluteFile();
 				return;
 			}
-			this.metadata = new Metadatas(copy,
-					Toolbox.getPreference(Toolbox.METADATA_ENCODING),
-					Toolbox.getPreference(Toolbox.METADATA_COLSEPARATOR),
-					Toolbox.getPreference(Toolbox.METADATA_TXTSEPARATOR), 1)
+			metadata = new Metadatas(copy,
+			Toolbox.getPreference(TBXPreferences.METADATA_ENCODING),
+			Toolbox.getPreference(TBXPreferences.METADATA_COLSEPARATOR),
+			Toolbox.getPreference(TBXPreferences.METADATA_TXTSEPARATOR), 1)
 		}
-		isSuccessFul = true;
+
+
+		File sourceDirectory = inputDirectory
+		File binaryDirectory = module.getBinaryDirectory()
+
+		File master = new File(sourceDirectory, "main.xml")
+		
+		def xmlFiles = [] // the TIGER XML files
+		
+		if (!master.exists() ) {
+//			master = new File(sourceDirectory, "main.xml")
+//			String subcorpora = "";
+			xmlFiles = sourceDirectory.listFiles(new FileFilter() {
+						boolean accept(File file) {
+							if (file.isDirectory()) return false;
+							if (file.isHidden()) return false;
+							String filename = file.getName()
+							if (filename.equals("import.xml")) return false;
+							if (!filename.endsWith(".xml")) return false;
+							
+							return true;
+						}
+					});
+			
+			if (xmlFiles.size() > 1) {
+				println "Error, the source directory contains more than one TIGER XML file ?"
+				isSuccessful = false;
+				return;
+			}
+			if (xmlFiles.size() == 0) {
+				println "Error no XML file found in $sourceDirectory directory"
+				isSuccessful = false;
+				return;
+			}
+			println "No TIGER XML 'main.xml' file found. Using $xmlFiles as TIGER XML source file "
+			
+		} else { // parse the master file
+			for (def s : new XmlSlurper().parse(master).body.subcorpus) {
+				String name = ""+s.@external
+				if (name.startsWith("file:")) {
+					xmlFiles << new File(sourceDirectory, name.substring(5))
+				}
+			}
+			
+			if (xmlFiles.size() == 0) {
+				println "Error no XML file found in $master file"
+				isSuccessful = false;
+				return;
+			}
+		}
+
+		// get the last version of the TIGER XML -> XML-TXM XSL
+		File tsXSLFile = new File(Toolbox.getTxmHomePath(), "xsl/ts.xsl");
+		BundleUtils.copyFiles("org.txm.tigersearch.rcp", "groovy", "org/txm/scripts/importer/tigersearch", "ts.xsl", tsXSLFile.getParentFile());
+
+		File xmltxmSrcDir = new File(binaryDirectory, "src"); // output directory of the TS XSL transformation
+		xmltxmSrcDir.mkdirs();
+		println "Main.xml files: "+xmlFiles
+		println "N="+xmlFiles.size()
+		for (File xmlTigerFile : xmlFiles) {
+			FileCopy.copy(xmlTigerFile, new File(xmltxmSrcDir, xmlTigerFile.getName()));
+		}
+
+		File tokenizedDir = new File(module.getBinaryDirectory(),"tokenized");
+		
+		if (!ApplyXsl2.processImportSources(tsXSLFile, xmltxmSrcDir, tokenizedDir)) {
+			println "Error while applying TS XSL file to $xmltxmSrcDir"
+			isSuccessful = false;
+			return;
+		}
+
+		File[] files = tokenizedDir.listFiles();
+		if (files == null || files.length == 0) {
+			println "Error while applying TS XSL file to $xmltxmSrcDir is empty"
+			isSuccessful = false;
+			return;
+		}
+
+		if (!doToXMLTXMStep()) return;
+		if (!doInjectMetadataStep()) return;
+
+		File txmdDir = new File(module.getBinaryDirectory(),"txm");
+		isSuccessFul = txmdDir.listFiles().size() > 0
 	}
 }
Index: tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImport.groovy
===================================================================
--- tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImport.groovy	(revision 1062)
+++ tmp/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImport.groovy	(revision 1063)
@@ -26,7 +26,7 @@
 	public void init(BaseParameters p) {
 		super.init(p);
 
-		importer = new TSImporter(this); // only to build metadata
+		importer = new TSImporter(this); // select TIGER XML files then do XTZImporter step
 		compiler = new XTZCompiler(this)
 		annotater = null; // no annotater step to do
 		pager = new XTZPager(this)
@@ -37,61 +37,12 @@
 	 */
 	@Override
 	public void start() throws InterruptedException {
-		File tigerSrcDir = sourceDirectory
-
-		def xmlFiles = []
-		sourceDirectory.listFiles(new FileFilter() {
-					boolean accept(File file) {
-						if (file.isDirectory()) return false;
-						if (file.isHidden()) return false;
-						if (file.getName().equals("import.xml")) return false;
-						if (!file.getName().endsWith(".xml")) return false;
-
-						xmlFiles << file
-					}
-				});
-
-		xmlFiles.remove(new File(sourceDirectory, "import.xml"))
-
-		if (xmlFiles.size() == 0) {
-			println "Error no XML file found in $sourceDirectory"
-			isSuccessful = false;
-			return;
-		}
-
-		File master = xmlFiles[0];
-		println "Main TIGER XML file found: $master"
-
-		File tsXSLFile = new File(Toolbox.getTxmHomePath(), "xsl/ts.xsl");
-		BundleUtils.copyFiles("org.txm.tigersearch.rcp", "groovy", "org/txm/scripts/importer/tigersearch", "ts.xsl", tsXSLFile.getParentFile());
-
-		File xmltxmSrcDir = new File(binaryDirectory, "src"); // output directory of the TS XSL transformation
-		xmltxmSrcDir.mkdirs();
-		FileCopy.copy(master, new File(xmltxmSrcDir, master.getName()));
-
-		if (!ApplyXsl2.processImportSources(tsXSLFile, xmltxmSrcDir, xmltxmSrcDir)) {
-			println "Error while applying TS XSL file to $tigerSrcDir"
-			isSuccessful = false;
-			return;
-		}
-
-		File[] files = xmltxmSrcDir.listFiles();
-		if (files == null || files.length == 0) {
-			println "Error while applying TS XSL file to $xmltxmSrcDir is empty"
-			isSuccessful = false;
-			return;
-		}
-
-		sourceDirectory = xmltxmSrcDir; // hop
-		File txmDir = new File(binaryDirectory, "txm/"+corpusName);
-		txmDir.mkdirs();
-		FileCopy.copyFiles(sourceDirectory, txmDir) // the compiler step will use these files
-
+		
 		super.start(); // call the usual XTZ import
-
+		
 		if (isSuccessful) {
 
-			File tigerDir = new File(binaryDirectory, "tiger");
+			File tigerDir = new File(this.binaryDirectory, "tiger");
 			tigerDir.mkdir();
 
 			File logprop = new File(tigerDir, "tigersearch.logprop");
@@ -107,9 +58,25 @@
 log4j.appender.Logfile.layout=org.apache.log4j.PatternLayout
 log4j.appender.Logfile.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n""")
 			}
-			
+
 			BasicConfigurator.configure();
-			String uri = master.getAbsolutePath();
+			File master = new File(this.sourceDirectory, "main.xml");
+			if (!master.exists()) {
+				def xmlFiles = sourceDirectory.listFiles(new FileFilter() {
+					boolean accept(File file) {
+						if (file.isDirectory()) return false;
+						if (file.isHidden()) return false;
+						String filename = file.getName()
+						if (filename.equals("import.xml")) return false;
+						if (!filename.endsWith(".xml")) return false;
+						
+						return true;
+					}
+				});
+			
+				master = xmlFiles[0]
+			}
+			String uri = master.getAbsolutePath(); // TIGER corpus source root file
 			File tigerBinDir = new File(tigerDir, corpusName)
 			tigerBinDir.mkdir()
 			try {
