Index: tmp/org.txm.core/src/java/org/txm/scripts/importer/StaxStackWriter.groovy
===================================================================
--- tmp/org.txm.core/src/java/org/txm/scripts/importer/StaxStackWriter.groovy	(revision 3146)
+++ tmp/org.txm.core/src/java/org/txm/scripts/importer/StaxStackWriter.groovy	(revision 3147)
@@ -42,12 +42,23 @@
 		for (int i = 0 ; i < size ; i++) {
 			writeEndElement();
 		}
-		events = [];
+		events.clear();
 	}
 	
+	/**
+	 * tagsToWrite: List<String> or List<[String, [String, String]]>
+	 */
 	public void writeStartElements(def tagsToWrite) {
-		for (String tag : tagsToWrite)
-			writeStartElement(tag);
+		for (def tag : tagsToWrite) {
+			if (tag instanceof String) {
+				writeStartElement(tag);
+			} else {
+				writeStartElement(tag[0]);
+				for (def att : tag[1]) {
+					writeAttribute(att[0], att[1])
+				}
+			}
+		}
 	}
 	
 	public def getTagStack() {
@@ -98,17 +109,23 @@
 	
 	@Override
 	public void writeAttribute (String localName, String value) throws XMLStreamException {
+		if (value == null) return;
 		writer.writeAttribute(localName, value);
+		if (events.size() > 0) events[events.size()-1][1] << [localName, value]
 	}
 	
 	@Override
 	public void writeAttribute (String namespaceURI, String localName, String value) throws XMLStreamException {
+		if (value == null) return;
 		writer.writeAttribute(namespaceURI, localName, value);
+		if (events.size() > 0) events[events.size()-1][1] << [localName, value]
 	}
 	
 	@Override
 	public void writeAttribute (String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
+		if (value == null) return;
 		writer.writeAttribute(prefix, namespaceURI, localName, value);
+		if (events.size() > 0) events[events.size()-1][1] << [localName, value]
 	}
 	
 	@Override
@@ -245,14 +262,16 @@
 	@Override
 	public void writeStartElement (String localName) throws XMLStreamException {
 		writer.writeStartElement(localName);
-		events << localName
+		events << [localName, []]
 		if (debug) println "START $localName $events"
 	}
 	
 	public void writeStartElement (String localName, def map) throws XMLStreamException {
 		writeStartElement(localName);
+		
 		for (def key : map.keySet()) {
 			writeAttribute(key.toString(), map[key].toString());
+			events[events.size()-1][1] << [key.toString(), map[key].toString()]
 		}
 	}
 	
@@ -260,7 +279,7 @@
 	public void writeStartElement(String namespaceURI, String localName)
 	throws XMLStreamException {
 		writer.writeStartElement(namespaceURI, localName);
-		events << localName
+		events << [localName, []]
 		if (debug) println "START $localName $events"
 	}
 	
@@ -268,7 +287,7 @@
 	public void writeStartElement(String prefix, String localName,
 			String namespaceURI) throws XMLStreamException {
 		writer.writeStartElement(prefix, localName, namespaceURI);
-		events << localName
+		events << [localName, []]
 		if (debug) println "START $localName $prefix $events"
 	}
 }
Index: tmp/org.txm.core/src/java/org/txm/objects/EditionDefinition.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/EditionDefinition.java	(revision 3146)
+++ tmp/org.txm.core/src/java/org/txm/objects/EditionDefinition.java	(revision 3147)
@@ -35,7 +35,7 @@
 	}
 	
 	public int getWordsPerPage() {
-		return node.getInt(TBXPreferences.EDITION_DEFINITION_WORDS_PER_PAGE, 500);
+		return node.getInt(TBXPreferences.EDITION_DEFINITION_WORDS_PER_PAGE, 1000);
 	}
 	
 	public boolean getEnableCollapsibleMetadata() {
Index: tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java	(revision 3146)
+++ tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java	(revision 3147)
@@ -552,7 +552,7 @@
 		this.getProject().setEncoding(root.getAttribute("encoding"));
 		this.getProject().setLang(root.getAttribute(LANG));
 		String str = root.getAttribute(WORDSPERPAGE);
-		if (str == null || str.length() == 0) str = "500";
+		if (str == null || str.length() == 0) str = "1000";
 		this.pageSize = Integer.parseInt(str);
 		str = root.getAttribute(DOEDITIONSTEP);
 		if (str == null || str.length() == 0) str = "true";
@@ -762,7 +762,7 @@
 				if (built == null || built.length() == 0) built = "true";
 				
 				String pbElement = edition.getAttribute("page_break_tag");
-				int wpp = 500;
+				int wpp = 1000;
 				try {
 					wpp = Integer.parseInt(edition.getAttribute("words_per_page"));
 				}
Index: tmp/org.txm.core/src/java/org/txm/objects/BaseOldParameters.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/BaseOldParameters.java	(revision 3146)
+++ tmp/org.txm.core/src/java/org/txm/objects/BaseOldParameters.java	(revision 3147)
@@ -147,7 +147,7 @@
 	
 	String DEFAULT_PAGEELEMENT = "pb"; //$NON-NLS-1$
 	
-	int DEFAULT_WORDSPERPAGE = 500;
+	int DEFAULT_WORDSPERPAGE = 1000;
 	
 	public String description;
 	
Index: tmp/org.txm.core/src/java/org/txm/utils/ConsoleProgressBar.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/utils/ConsoleProgressBar.java	(revision 3146)
+++ tmp/org.txm.core/src/java/org/txm/utils/ConsoleProgressBar.java	(revision 3147)
@@ -9,7 +9,7 @@
 	double progress_per_tick = 1.0d;
 	int point_progress = 0;
 	boolean done = false;
-	String mode = "%%% ";
+	String mode = "  % ";
 	int percent = 1;
 	
 	public ConsoleProgressBar(long amount) {
@@ -24,7 +24,12 @@
 		progress_per_tick = 100f / amount;
 		
 		if (amount <= 100L) {
-			mode = String.format("%03d ", amount);
+			mode = String.format("%d ", amount);
+			if (mode.length() == 2) {
+				mode = "  "+mode;
+			} else if (mode.length() == 3) {
+				mode = " "+mode;
+			}
 			progress_per_tick = 1;
 		}
 	}
Index: tmp/org.txm.core/src/java/org/txm/importer/StaxIdentityParser.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/StaxIdentityParser.java	(revision 3146)
+++ tmp/org.txm.core/src/java/org/txm/importer/StaxIdentityParser.java	(revision 3147)
@@ -282,6 +282,7 @@
 			System.out.println("Unexpected error while parsing file " + inputurl + " : " + e);
 			System.out.println("Location line: " + parser.getLocation().getLineNumber() + " character: " + parser.getLocation().getColumnNumber());
 			org.txm.utils.logger.Log.printStackTrace(e);
+			
 			// e.printStackTrace();
 			if (writer != null) writer.close();
 			if (output != null) output.close();
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/lasla/laslaLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/lasla/laslaLoader.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/lasla/laslaLoader.groovy	(revision 3147)
@@ -142,7 +142,7 @@
 		print(srcfile.getName());
 		second++
 	
-	def ed = new pager_old(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500,basename, "br");
+	def ed = new pager_old(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,1000,basename, "br");
 	
 	Edition editionweb = text.addEdition("default","html",resultfile);
 //	println("pages "+ed.getPageFiles())
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxmpara/xmltxmparaLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxmpara/xmltxmparaLoader.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxmpara/xmltxmparaLoader.groovy	(revision 3147)
@@ -225,7 +225,7 @@
 	print(srcfile.getName());
 	second++
 	
-	def ed = new pager_old(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter, 500, basename, "pb");
+	def ed = new pager_old(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter, 1000, basename, "pb");
 	
 	Edition editionweb = text.addEdition("default", "html", resultfile);
 	for(int i = 0 ; i < ed.getPageFiles().size();i++)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/fleurs/fleursLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/fleurs/fleursLoader.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/fleurs/fleursLoader.groovy	(revision 3147)
@@ -126,7 +126,7 @@
 		print(srcfile.getName());
 		second++
 	
-	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500,basename);
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter, p.getEditionDefinition("default").wordsPerPage,basename);
 	
 	Edition editionweb = text.addEdition("default","html",resultfile);
 	for(int i = 0 ; i < ed.getPageFiles().size();i++)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivamailLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivamailLoader.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivamailLoader.groovy	(revision 3147)
@@ -147,7 +147,7 @@
 		t.setName(txtname);
 		t.setSourceFile(txmFile)
 		t.setTXMFile(txmFile)	
-	def ed = new pager_old(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, 500, basename, "pb");
+	def ed = new pager_old(srcfile, outdir, txtname, NoSpaceBefore, NoSpaceAfter, 1000, basename, "pb");
 	Edition edition = new Edition(t);
 		edition.setName("default");
 		edition.setIndex(outdir.getAbsolutePath());
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3147)
@@ -312,7 +312,7 @@
 		for (File f : files) {
 			cpb.tick()
 			
-			if (!ValidateXml.teiTest(f)) {
+			if (!ValidateXml.test(f)) {
 				println "Won't process XML file: "+f
 				continue;
 			} else {
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 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 3147)
@@ -143,12 +143,13 @@
 				return parser.getAttributeValue(i).toString()
 			}
 		}
-		return "";
+		return null;
 	}
 	
 	private def closeMultiWriter() {
 		if (pagedWriter != null) {
-			def tags = pagedWriter.getTagStack().clone();
+			def tags = pagedWriter.getTagStack()
+			
 			//			println "STACK="+pagedWriter.getTagStack()
 			//			def stack = Thread.currentThread().getStackTrace();
 			//			int m = Math.min(15, stack.size()-1)
@@ -158,7 +159,6 @@
 				pagedWriter.writeCharacters("");
 				this.idxstart.add("${wordTag}_0")
 				pagedWriter.write("<span id=\"${wordTag}_0\"/>");
-				//				}
 			}
 			pagedWriter.writeEndElements();
 			// write notes
@@ -184,16 +184,17 @@
 			pagedWriter.close();
 			
 			//			println "STACK TO REWRITE: $tags"
+			int removedDiv = 0;
 			for (int i = 0 ; i < tags.size() ; i++) {
-				String tag = tags.remove(0)
+				def tag = tags.remove(0)
 				i--
-				//				println "	tag=$tag"
-				if (tag == "div") {
-					break; // remove elements until first "div" tag
+
+				if (tag[0] == "div" ) {
+					removedDiv++
+					if (removedDiv == 2) break; // remove elements until first "div" tag
 				}
 			}
 			//			println "STACK TO REWRITE2: $tags"
-			
 			return tags;
 		} else {
 			return [];
@@ -236,7 +237,7 @@
 			pagedWriter.writeStartElement("body") //<body>
 			pagedWriter.writeStartElement("div", ["class": pager.getImportModule().getProject().getName()]) //<div> of the corpus
 			pagedWriter.writeStartElement("div", ["class": "txmeditionpage"]) //<div>
-			//			println "OPENING: $tags"
+			
 			pagedWriter.writeStartElements(tags)
 			return true;
 		} catch (Exception e) {
@@ -342,7 +343,7 @@
 						}
 					
 						rend = getAttributeValue(parser, null, "rend")
-						if (rend == null) rend = "none";
+						//if (rend == null) rend = localname;
 					
 						switch (localname) {
 							case "text":
@@ -365,9 +366,9 @@
 									
 									pagedWriter.writeStartElement("div", ["class":"collapsiblecontent"])
 								}
-								
+							
 								pagedWriter.writeStartElement("table", ["class":"metadata"]);
-								
+							
 								for (String k : attributes.keySet()) {
 									if (k == "id") continue;
 									if (k == "rend") continue;
@@ -385,12 +386,46 @@
 								pagedWriter.writeEndElement() // p
 								pagedWriter.writeCharacters("\n")
 								break;
-							case "ref":
-								pagedWriter.writeStartElement("a")
-								pagedWriter.writeAttribute("href", getAttributeValue(parser, null, "target"))
-								pagedWriter.writeAttribute("target", "_blank")
-								pagedWriter.writeAttribute("class", rend)
+							case "u":
+								pagedWriter.writeStartElement("span")
+								pagedWriter.writeAttribute("class", "sync")
+								if (parser.getAttributeValue(null,"time") != null) {
+									pagedWriter.writeCharacters(parser.getAttributeValue(null,"time"))
+								}
 								break;
+							case "p":
+							//case "lg":
+								pagedWriter.write("\n")
+								pagedWriter.writeStartElement("p", ["class":rend])
+								break;
+							case "sp":
+								pagedWriter.writeStartElement("p", ["class":"turn"])
+							
+								if (parser.getAttributeValue(null,"speaker") != null) {
+									pagedWriter.writeStartElement("span")
+									pagedWriter.writeAttribute("class", "spk")
+									pagedWriter.writeCharacters(parser.getAttributeValue(null,"speaker")+": ")
+									pagedWriter.writeEndElement() // span@class=spk
+								}
+							
+								break;
+							case "cb":
+								pagedWriter.write("\n")
+								pagedWriter.writeElement("span", ["class":"txmeditioncb", "align":"center"], getAttributeValue(parser, null,"n")) // element ignored in the END_ELEMENT event
+								break;
+							case "lb":
+							//case "l":
+								pagedWriter.writeEmptyElement("br", ["class":rend])
+								break;
+							case "div":
+							case "div1":
+							case "div2":
+							case "div3":
+							case "div4":
+							case "div5":
+								pagedWriter.writeStartElement("div", ["class":rend, "type":localname])
+								pagedWriter.write("\n");
+								break;
 							case "head":
 								pagedWriter.write("\n")
 								pagedWriter.writeStartElement("h2", ["class":rend])
@@ -405,16 +440,6 @@
 									pagedWriter.writeEndElement() // center
 								}
 								break;
-							case "table":
-								pagedWriter.writeStartElement("table", ["class":rend])
-								pagedWriter.write("\n");
-								break;
-							case "row":
-								pagedWriter.writeStartElement("tr", ["class":rend])
-								break;
-							case "cell":
-								pagedWriter.writeStartElement("td", ["class":rend])
-								break;
 							case "list":
 								String type = getAttributeValue(parser, null,"type")
 								if ("unordered" == type) {
@@ -440,47 +465,31 @@
 									}
 								}
 								break;
-							case "p":
-							//case "lg":
-								pagedWriter.write("\n")
-								pagedWriter.writeStartElement("p", ["class":rend])
+							case "table":
+								pagedWriter.writeStartElement("table", ["class":rend])
+								pagedWriter.write("\n");
 								break;
-							case "cb":
-								pagedWriter.write("\n")
-								pagedWriter.writeElement("span", ["class":"txmeditioncb", "align":"center"], getAttributeValue(parser, null,"n")) // element ignored in the END_ELEMENT event
+							case "row":
+								pagedWriter.writeStartElement("tr", ["class":rend])
 								break;
-							case "sp":
-								pagedWriter.writeStartElement("p", ["class":"turn"])
-							
-								if (parser.getAttributeValue(null,"speaker") != null) {
-									pagedWriter.writeStartElement("span")
-									pagedWriter.writeAttribute("class", "spk")
-									pagedWriter.writeCharacters(parser.getAttributeValue(null,"speaker")+": ")
-									pagedWriter.writeEndElement() // span@class=spk
-								}
-							
+							case "cell":
+								pagedWriter.writeStartElement("td", ["class":rend])
 								break;
-							case "u":
-							//pagedWriter.writeStartElement("p", ["class":"u"])
-								if (parser.getAttributeValue(null,"time") != null) {
-									pagedWriter.writeStartElement("span")
-									pagedWriter.writeAttribute("class", "sync")
-									pagedWriter.writeCharacters(parser.getAttributeValue(null,"time"))
-								}
-							//pagedWriter.writeEndElement(); // span@class=spk
+							case "ref":
+								pagedWriter.writeStartElement("a")
+								pagedWriter.writeAttribute("href", getAttributeValue(parser, null, "target"))
+								pagedWriter.writeAttribute("target", "_blank")
+								pagedWriter.writeAttribute("class", rend)
 								break;
-							case "div":
-							case "div1":
-							case "div2":
-							case "div3":
-							case "div4":
-							case "div5":
-								pagedWriter.writeStartElement("div", ["class":rend, "type":localname])
-								pagedWriter.write("\n");
+							case "form":
+								wordvalue=""
+								flagform=true
 								break;
-							case "lb":
-							//case "l":
-								pagedWriter.writeEmptyElement("br", ["class":rend]) 
+							case "ana":
+								flaginterp=true;
+								anaType = getAttributeValue(parser, null, "type").substring(1)
+								anaResp = getAttributeValue(parser, null, "resp").substring(1)
+								anaValue.setLength(0)
 								break;
 							case wordTag:
 								wordid = getAttributeValue(parser, null,"id");
@@ -496,22 +505,12 @@
 								}
 								flagW = true
 								break;
-							case "ana":
-								flaginterp=true;
-								anaType = getAttributeValue(parser, null, "type").substring(1)
-								anaResp = getAttributeValue(parser, null, "resp").substring(1)
-								anaValue.setLength(0)
-								break;
-							case "form":
-								wordvalue=""
-								flagform=true
-								break;
 							default:
 								if (noteElements.contains(localname)) {
 									flagNote = true;
 									noteContent = ""
 									noteType = getAttributeValue(parser, null, "type")
-								} else if (allTags && !flagW) {
+								} else if (allTags && !flagW && localname != paginationElement) {
 									pagedWriter.writeStartElement("span", ["class":localname])
 								}
 								break;
@@ -521,7 +520,7 @@
 						localname = parser.getLocalName();
 						if (currentOutOfTextElements.size() > 0) currentOutOfTextElements.pop()
 						writeOutOfTextToEditText = currentOutOfTextElements.size() > 0
-						
+					
 						if (localname == paginationElement) {
 							break; // element already processed in the START_ELEMENT event
 						}
@@ -601,11 +600,11 @@
 								}
 							
 								String interpvalue = anaValues.entrySet().join(", ")
-								
+							
 								if (NoSpaceBefore.contains(wordvalue) ||
-								NoSpaceAfter.contains(lastword) ||
-								wordvalue.startsWith("-") ||
-								NoSpaceAfter.contains(endOfLastWord)) {
+										NoSpaceAfter.contains(lastword) ||
+										wordvalue.startsWith("-") ||
+										NoSpaceAfter.contains(endOfLastWord)) {
 									pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid])
 								} else {
 									pagedWriter.writeCharacters("\n")
@@ -629,7 +628,7 @@
 										pagedWriter.writeEndElement() // </sub>
 										pagedWriter.writeEndElement() // </a>
 									}
-								} else if (allTags && !flagW) {
+								} else if (allTags && !flagW && localname != paginationElement) {
 									pagedWriter.writeEndElement() // </span@class=localname>
 								}
 							//							else {
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/pager.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/pager.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/pager.groovy	(revision 3147)
@@ -438,7 +438,7 @@
 			List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
 			println("build hyperprince xml-tei file : "+srcfile+" to : "+resultfile );
 			
-			def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500);
+			def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,1000);
 			
 			Edition editionweb = text.addEdition("default","html",resultfile);
 			//println("pages "+ed.getPageFiles())
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/hyperprinceLoader.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/hyperprinceLoader.groovy	(revision 3146)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/hyperprinceLoader.groovy	(revision 3147)
@@ -122,7 +122,7 @@
 	List<String> NoSpaceAfter = LangFormater.getNoSpaceAfter(lang);
 	println("build hyperprince xml-tei file : "+srcfile+" to : "+resultfile );
 	
-	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,500);
+	def ed = new pager(srcfile,resultfile, NoSpaceBefore, NoSpaceAfter,1000);
 	
 	Edition editionweb = text.addEdition("default","html",resultfile);
 	//println("pages "+ed.getPageFiles())
