Index: tmp/org.txm.core/src/java/org/txm/importer/scripts/xmltxm/Xml2Ana.groovy
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/scripts/xmltxm/Xml2Ana.groovy	(revision 2987)
+++ tmp/org.txm.core/src/java/org/txm/importer/scripts/xmltxm/Xml2Ana.groovy	(revision 2988)
@@ -2,19 +2,19 @@
 // Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
 // Lyon 2, University of Franche-Comté, University of Nice
 // Sophia Antipolis, University of Paris 3.
-// 
+//
 // The TXM platform is free software: you can redistribute it
 // and/or modify it under the terms of the GNU General Public
 // License as published by the Free Software Foundation,
 // either version 2 of the License, or (at your option) any
 // later version.
-// 
+//
 // The TXM platform is distributed in the hope that it will be
 // useful, but WITHOUT ANY WARRANTY; without even the implied
 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 // PURPOSE. See the GNU General Public License for more
 // details.
-// 
+//
 // You should have received a copy of the GNU General
 // Public License along with the TXM platform. If not, see
 // http://www.gnu.org/licenses.
@@ -58,34 +58,34 @@
 {
 	/** The dir. */
 	private def dir;
-
+	
 	/** The convert all attributes. */
 	private boolean convertAllAttributes = false;
-
+	
 	/** The corresp type. */
 	HashMap<String,String> correspType;
-
+	
 	/** The corresp ref. */
 	HashMap<String,String> correspRef;
-
+	
 	/** The check tags. */
 	HashMap<String,Boolean> checkTags = new HashMap<String,Boolean>();
-
+	
 	/** The resp id. */
 	def respId = [];
-
+	
 	/** The applications. */
 	HashMap<String,File> applications;
-
+	
 	/** The taxonomies. */
 	HashMap<String,String[]> taxonomies;
-
+	
 	/** The resps. */
 	HashMap<String,String[]> resps;
-
+	
 	/** The items. */
 	HashMap<String,HashMap<String,String>> items;
-
+	
 	/** The XML headeradded. */
 	boolean XMLHeaderadded = false;
 	String textname;
@@ -93,7 +93,7 @@
 	
 	public static final String TEXT = "text"
 	public static final String ID = "id"
-
+	
 	/**
 	 * Instantiates a new xml2 ana.
 	 *
@@ -107,15 +107,15 @@
 		int idx = textname.lastIndexOf(".");
 		if (idx > 0)
 			textname = textname.substring(0, idx)
-
 		
+		
 		checkTags.put("respStmt",false);
 		checkTags.put("titleStmt",false);
 		checkTags.put("appInfo",false);
-
+		
 		hasText = new HasElement(file, TEXT).process();
 	}
-
+	
 	/**
 	 * Sets the convert all atrtibutes.
 	 *
@@ -135,7 +135,7 @@
 	public setWordTag(String wtag) {
 		this.wtag = wtag
 	}
-
+	
 	int idcount = 0;
 	boolean flagWord = false;
 	int firstElement = 0;
@@ -146,8 +146,8 @@
 	def anabalises = [];
 	protected void processStartElement()
 	{
-//		println "checkTags=$checkTags";
-//		println "parser=$parser";
+		//		println "checkTags=$checkTags";
+		//		println "parser=$parser";
 		firstElement++;
 		
 		if (this.checkTags.containsKey(parser.getLocalName())) {
@@ -164,28 +164,32 @@
 				}
 				idcount++; // increment word counter
 				anabalises.clear();
-
+			
 				writer.writeStartElement(parser.getLocalName()); // write w
-
+			
 				for (int i = 0 ; i < parser.getNamespaceCount() ; i++) // write namespaces
 					writer.writeNamespace(parser.getNamespacePrefix(i), parser.getNamespaceURI(i));
-
+			
 				for (int i= 0 ; i < parser.getAttributeCount() ;i++ ) { // transform attributes
 					String type = parser.getAttributeLocalName(i);
 					String value = parser.getAttributeValue(i);
 					if (correspType.containsKey(type)) { // check if txm:ana
 						String corresptype = correspType.get(type);
 						String ref = correspRef.get(type);
-						anabalises.add(["#"+ref, "#"+corresptype, value]);
-					} else if (type == ID) { // keep id attribute 
+						anabalises.add([
+							"#"+ref,
+							"#"+corresptype,
+							value
+						]);
+					} else if (type == ID) { // keep id attribute
 						String wordid = value
 						if (wordid.startsWith("w")) {
 							if (!wordid.startsWith("w_"))
 								wordid = "w_"+wordid.substring(1)
-						} 
-//						else {
-//							wordid = "w_"+textname+"_"+wordid;
-//						}
+						}
+						//						else {
+						//							wordid = "w_"+textname+"_"+wordid;
+						//						}
 						
 						wordid = AsciiUtils.buildWordId(wordid); // remove characters not compatible with the id attribute value
 						
@@ -193,16 +197,16 @@
 						
 					} else { // add attributes that was in the original <w>
 						if (convertAllAttributes)
-							anabalises.add(["none","#"+type, value])
+							anabalises.add(["#src", "#"+type, value])
 						else
 							writer.writeAttribute(type, value);
 					}
 				}
-
+			
 				flagWord = true; // start to capture the form
 				writer.writeStartElement(TXMNS, "form");
 				break;
-
+			
 			case "TEI":
 				super.processStartElement();
 				boolean hasTeiNS = false;
@@ -219,13 +223,13 @@
 				if (!hasTXMNs)
 					writer.writeNamespace(TXM, TXMNS);
 				break;
-
+			
 			default:
-
+			
 				if (TEXT.equals(localname)) {
 					hasText = true;
 				}
-
+			
 				if (firstElement == 1) { // test if first element is TEI
 					//println "first tag: "+parser.getLocalName()
 					if (localname != "TEI") { // "TEI" is missing
@@ -251,7 +255,7 @@
 					textElementAdded = true;
 					hasText = true;
 				}
-
+			
 				super.processStartElement();
 				if (TEXT.equals(localname)) {
 					if (!parser.getAttributeValue(null, ID)) {
@@ -260,7 +264,7 @@
 				}
 		}
 	}
-
+	
 	protected void after()
 	{
 		if (textElementAdded) {
@@ -271,7 +275,7 @@
 		}
 		super.after(); // close writer, parser, etc
 	}
-
+	
 	protected void addTEIElement()
 	{
 		writer.writeStartElement("TEI");
@@ -280,7 +284,7 @@
 		writer.writeNamespace(TEI, TEINS);
 		writeTeiHeader();
 	}
-
+	
 	protected void processCharacters()
 	{
 		if (flagWord) {
@@ -311,15 +315,15 @@
 					writer.writeCharacters(values[2]);
 					writer.writeEndElement(); // txm:ana
 				}
-
+			
 				flagWord = false;
 				break;
-
+			
 			case "fileDesc":
 				hasFileDesc = true;
 				this.writeTXMResps();
 				break;
-
+			
 			case "classDecl":
 				hasClassDecl=true;
 				this.writeTXMTaxonomies();
@@ -328,7 +332,7 @@
 				hasEncodingDesc = true;
 				writeContentOfEncodingDesc();
 				break;
-
+			
 			case "teiHeader":
 				hasTeiHeader = true
 				if (!hasEncodingDesc) {
@@ -336,7 +340,7 @@
 					writeContentOfEncodingDesc();
 					writer.writeEndElement();
 				}
-
+			
 				break;
 			case "TEI":
 				hasTEI = true;
@@ -345,10 +349,10 @@
 				}
 				break;
 		}
-
+		
 		super.processEndElement();
 	}
-
+	
 	protected void writeTeiHeader()
 	{
 		writer.writeStartElement("teiHeader");
@@ -368,7 +372,7 @@
 		writer.writeEndElement(); // encodingDesc
 		writer.writeEndElement(); // teiHeader
 	}
-
+	
 	protected void writeContentOfEncodingDesc()
 	{
 		writer.writeStartElement("appInfo")
@@ -380,7 +384,7 @@
 			writer.writeEndElement(); // classDecl
 		}
 	}
-
+	
 	/**
 	 * Check resp.
 	 *
@@ -393,7 +397,7 @@
 			rez += "\t"+key+"\n";
 		return rez;
 	}
-
+	
 	/**
 	 * Sets the correspondances.
 	 *
@@ -405,7 +409,7 @@
 		this.correspRef = correspRef;
 		this.correspType = correspType;
 	}
-
+	
 	/**
 	 * Sets the header infos.
 	 *
@@ -423,7 +427,7 @@
 		this.taxonomies = taxonomies;
 		this.items = items;
 	}
-
+	
 	/**
 	 * Write txm resps.
 	 */
@@ -447,7 +451,7 @@
 			writer.writeEndElement(); //respStmt
 		}
 	}
-
+	
 	/**
 	 * Write txm apps.
 	 */
@@ -458,12 +462,12 @@
 			String ident = list.get(0);
 			String version = list.get(1);
 			File report = list.get(2);
-
+			
 			writer.writeStartElement(TXMNS, "application");
 			writer.writeAttribute("ident", ident);
 			writer.writeAttribute("version", version);
 			writer.writeAttribute(RESP, ref);
-
+			
 			//get txm:commandLine from GeneratedReport
 			if (report != null) {
 				writer.writeCharacters("");writer.flush();
@@ -476,7 +480,7 @@
 				}
 				reader.close();
 			}
-
+			
 			writer.writeStartElement("ab");
 			writer.writeAttribute(TYPE, "annotation");
 			for (String item : taxonomies.get(ref)) {
@@ -490,7 +494,7 @@
 			writer.writeEndElement(); // txm:application
 		}
 	}
-
+	
 	/**
 	 * Write txm taxonomies.
 	 */
@@ -499,13 +503,13 @@
 		for (String tax : items.keySet()) {
 			writer.writeStartElement("taxonomy");
 			writer.writeAttribute(ID, tax);
-
+			
 			writer.writeStartElement("bibl");
 			writer.writeAttribute(TYPE, "tagset");
 			writer.writeStartElement("title");
 			writer.writeCharacters(tax);
 			writer.writeEndElement(); // title
-
+			
 			for (String type : items.get(tax).keySet()) {
 				writer.writeEmptyElement("ref");
 				writer.writeAttribute(TYPE, type);
@@ -515,64 +519,69 @@
 			writer.writeEndElement(); // taxonomy
 		}
 	}
-
+	
 	/**
 	 * The main method.
 	 *
 	 * @param args the arguments
 	 */
 	public static void main(String[] args) {
-
+		
 		String rootDir = "~/xml/rgaqcj/";
 		new File(rootDir+"anainline/").mkdir();
-
+		
 		ArrayList<String> milestones = new ArrayList<String>();
-
+		
 		String file = "roland-p5.xml";
 		String anafile = "roland-p5.xml";
-
+		
 		def correspType = new HashMap<String,String>()
 		// correspType(attribut word wlx, attribut type de la propriété ana du w txm)
 		correspType.put("p2","CATTEX2009");
-
+		
 		def correspRef = new HashMap<String,String>()
 		// correspRef (attribut word wlx, attribut ref de la propriété ana du w txm. ref pointe vers l'identifiant du respStmt du TEIheader)
 		correspRef.put("p2","ctx1");
-
+		
 		//il faut lister les id de tous les respStmt
 		def respId = ["ctx1"];//,"TT1", "TnT1"];
-
+		
 		//fait la correspondance entre le respId et le rapport d'execution de l'outil
 		def applications = new HashMap<String,HashMap<String,String>>();
 		applications.put("ctx1",new ArrayList<String>());
 		applications.get("ctx1").add("Oxygen");//app ident
 		applications.get("ctx1").add("9.3");//app version
 		applications.get("ctx1").add(null);//app report file path
-
+		
 		//fait la correspondance entre le respId et les attributs type de la propriété ana du w txm
 		//pour construire les ref vers les taxonomies
 		def taxonomiesUtilisees = new HashMap<String,String[]>();
 		taxonomiesUtilisees.put("ctx1",["CATTEX2009"]);//,"lemma","lasla","grace"]);
-
+		
 		//associe un id d'item avec sa description et son URI
 		def itemsURI = new HashMap<String,HashMap<String,String>>();
 		itemsURI.put("CATTEX2009",new HashMap<String,String>());
 		itemsURI.get("CATTEX2009").put("tagset","http://bfm.ens-lsh.fr/IMG/xml/cattex2009.xml");
 		itemsURI.get("CATTEX2009").put("website","http://bfm.ens-lsh.fr/article.php3?id_article=176");
-
+		
 		//informations de respStmt
 		//resps (respId <voir ci-dessus>, [description, person, date])
 		def resps = new HashMap<String,String[]>();
-		resps.put("ctx1", ["initial tagging","alavrentiev","2010-03-02","Tue Mar  2 21:02:55 Paris, Madrid 2010"])
-
+		resps.put("ctx1", [
+			"initial tagging",
+			"alavrentiev",
+			"2010-03-02",
+			"Tue Mar  2 21:02:55 Paris, Madrid 2010"
+		])
+		
 		//lance le traitement
 		def builder = new Xml2Ana(new File(rootDir+"/src/",file));
 		builder.setCorrespondances(correspRef, correspType);
 		builder.setHeaderInfos(respId,resps, applications, taxonomiesUtilisees, itemsURI)
 		//dossier de sortie + nom fichier sortie
 		builder.process(anafile);
-
+		
 		return
 	}
-
+	
 }
Index: tmp/org.txm.core/src/java/org/txm/importer/scripts/xmltxm/AnnotationInjection.groovy
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/scripts/xmltxm/AnnotationInjection.groovy	(revision 2987)
+++ tmp/org.txm.core/src/java/org/txm/importer/scripts/xmltxm/AnnotationInjection.groovy	(revision 2988)
@@ -1,5 +1,3 @@
-
-
 // Copyright © 2010-2013 ENS de Lyon.
 // Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
 // Lyon 2, University of Franche-Comté, University of Nice
@@ -49,41 +47,42 @@
  */
 
 public class AnnotationInjection extends StaxIdentityParser {
-
+	
 	public static String TXMNS = "http://textometrie.org/1.0"
-
+	
 	/** The xml reader factory. */
 	private def factory;
-
+	
 	/** The links. */
 	private LinkedHashSet<String> links;
+	
 	/**
 	 * if set, existing values are replaced
 	 */
 	boolean fixExistingValues
-
+	
 	/** The linkparsers. key=type*/
 	private LinkedHashMap<String, XMLStreamReader> linkparsers;
-
+	
 	/** The anaurl. */
 	private def anaurl;
-
+	
 	/** The anainput data. */
 	private def anainputData;
-
+	
 	/** The anafactory. */
 	private XMLInputFactory anafactory = XMLInputFactory.newInstance();
-
+	
 	/** The anaparser. */
 	private XMLStreamReader anaparser;
 	private XMLStreamReader headerparser;
-
+	
 	/** The resp stmt id. */
 	String respStmtID = "";
-
+	
 	/** The present taxonomies. */
 	ArrayList<String> presentTaxonomies = new ArrayList();
-
+	
 	/**
 	 * Instantiates a new annotation injection.
 	 *
@@ -93,7 +92,7 @@
 	public AnnotationInjection(URL url, URL anaurl) {
 		this(url, anaurl, false)
 	}
-
+	
 	/**
 	 * Instantiates a new annotation injection.
 	 *
@@ -113,7 +112,7 @@
 			System.out.println("IOException while parsing ");
 		}
 	}
-
+	
 	private void getHeaderInfos(String containertag, boolean captureTheTag)
 	{
 		anainputData = new BufferedInputStream(anaurl.openStream());
@@ -144,10 +143,10 @@
 				localname = headerparser.getLocalName();
 				if (!captureTheTag && localname == containertag)
 					break;// stop looping
-
+				
 				if (start)
 					writer.writeEndElement();
-
+				
 				if (captureTheTag && localname == containertag)
 					break;// stop looping
 			} else if (event == XMLStreamConstants.CHARACTERS) {
@@ -161,7 +160,7 @@
 		headerparser.close();
 		anainputData.close();
 	}
-
+	
 	/**
 	 * find all refs.
 	 *
@@ -172,12 +171,12 @@
 		LinkedHashSet<String> links = new LinkedHashSet<String>();
 		anainputData = anaurl.openStream();
 		anaparser = anafactory.createXMLStreamReader(anainputData);
-
+		
 		for (int event = anaparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = anaparser.next()) {
 			if (event == XMLStreamConstants.START_ELEMENT) {
 				if (anaparser.getLocalName().equals("linkGrp")) {
-					String targetsvalue = anaparser.getAttributeValue(0)
-
+					String targetsvalue = "txm:"+anaparser.getAttributeValue(0)
+					
 					if (links.contains(targetsvalue)) {
 						System.err.println("Warning: Multiple group declaration : "+targetsvalue+" has already been added, the first one will be used")
 					} else {
@@ -188,11 +187,12 @@
 				}
 			}
 		}
+		println links
 		anaparser.close();
 		anainputData.close();
 		return links;
 	}
-
+	
 	/**
 	 * Builds the link parsers.
 	 * I need to know what groups exists to build a parser per taxonomy and go to the first link element
@@ -202,20 +202,21 @@
 		// link group of the standoff file
 		links = findGrpLink();
 		linkparsers = new LinkedHashMap<String, XMLStreamReader>();
-
+		
 		// build one parser per link group
 		for (String link : links) { // build a parser per group
 			anainputData = new BufferedInputStream(anaurl.openStream());
 			linkparsers.put(link, anafactory.createXMLStreamReader(anainputData));
 		}
-
+		
 		//for each parser
 		for (String link : links) {
 			anaparser = linkparsers.get(link);
 			for (int event = anaparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = anaparser.next()) {
 				if (event == XMLStreamConstants.START_ELEMENT) {
 					if (anaparser.getLocalName().equals("linkGrp")) { // position the parser to the right group
-						String targetsvalue = anaparser.getAttributeValue(0)
+						String targetsvalue = "txm:"+anaparser.getAttributeValue(0)
+						//println "target: "+targetsvalue+" link="+link
 						if (targetsvalue.equals(link)) {
 							break; // next element is a link start tag
 						}
@@ -248,7 +249,7 @@
 			}
 		}
 	}
-
+	
 	/**
 	 * get the next tei:link value of a tei:LinkGrp.
 	 *
@@ -256,7 +257,9 @@
 	 * @return the next ana
 	 */
 	private String getNextAnaValue(String link, String wordId) {
+		//println "GET ANAPARSER of link=$link linkparsers="+linkparsers.keySet()
 		anaparser = linkparsers.get(link);
+		if (anaparser == null) return null;
 		def m;
 		for (int event = anaparser.next(); event != XMLStreamConstants.END_DOCUMENT; event = anaparser.next()) {
 			if (event == XMLStreamConstants.START_ELEMENT) {
@@ -265,7 +268,7 @@
 					if ((m = targetsvalue =~ /#(.*) #(.*)/)) { // balise externe
 						def g1 = m[0][1];
 						def g2 = m[0][2];
-
+						
 						String anavalue = g2;
 						anavalue = anavalue.replace("&lt;", "<")
 						return anavalue;
@@ -277,34 +280,43 @@
 		}
 		return "";
 	}
-
+	
 	/**
 	 * build the ana tags of a word.
 	 *
 	 * @param wordId the word id
 	 * @return the ana tag
 	 */
-	private void writeAnaTags(String wordId)
-	{
+	private void writeAnaTags(String wordId) {
+		
 		String anabalises ="\n";
 		for (String link : links) {
-			writer.writeStartElement(TXMNS, "ana");
-			writer.writeAttribute("resp", "#"+respStmtID);
-			writer.writeAttribute("type", "#"+link);
 			
+			int idx = link.indexOf(":")
+			
+			String resp = link.substring(0, idx)
+			String type = link.substring(idx+1)
+			
+			
 			String newValue = getNextAnaValue(link, wordId)
-			if (fixExistingValues || anaValues.containsKey(link) == null) {
-				anaValues.put(link, newValue)
-			} else {
-				anaValues.put(link, "")
+			//println "ANA="+anaValues.get(link)+" new=$newValue"
+			if (newValue!= null) {
+				if (anaValues.get(link) == null || fixExistingValues) {
+					anaValues.put(link, newValue)
+				}
 			}
 			
-			writer.writeCharacters(anaValues.get(link));
-			
-			writer.writeEndElement(); // txm:ana
+			if (anaValues.get(link) != null) { // there was no value in SRC XML and in injected values
+				writer.writeStartElement(TXMNS, "ana");
+				writer.writeAttribute("resp", "#"+resp);
+				writer.writeAttribute("type", "#"+type);
+				writer.writeCharacters(anaValues.get(link));
+				writer.writeEndElement(); // txm:ana
+			}
 		}
+		anaValues.clear()
 	}
-
+	
 	String wordId;
 	HashMap<String, String> anaValues = new HashMap<String, String>();
 	boolean flagSourceDesc = false, flagW = false, flagAna = false;
@@ -339,15 +351,15 @@
 			flagW = true
 			anaValues.clear()
 		}
-
+		
 		super.processStartElement();
 	}
-
+	
 	protected void processCharacters() {
 		if (flagAna) anaValue += parser.getText();
 		else super.processCharacters(); // FORM CONTENT LOST !!!!!!!!!!!!!
 	}
-
+	
 	boolean applicationWritten = false;
 	boolean taxonomiesWritten = false;
 	protected void processEndElement() {
@@ -357,25 +369,25 @@
 				flagW = false
 				break;
 			case "ana":
-				if (flagAna && replace && type != null && resp != null && anaValue != null) {
-					anaValues.put(type, anaValue)
-					links.add(type)
+				if (flagAna && type != null && resp != null && anaValue != null) {
+					anaValues.put(resp+":"+type, anaValue)
+					links.add(resp+":"+type)
 					flagAna = false
 					return; // don't write the "ana" end element
 				}
 				flagAna = false
 				break;
-
+			
 			case "appInfo":
 				applicationWritten = true;
 				getHeaderInfos("appInfo", false);
 				break;
-
+			
 			case "classDecl":
 				taxonomiesWritten = true;
 				getHeaderInfos("classDecl", false);
 				break;
-
+			
 			case "encodingDesc":
 				if (!applicationWritten) {
 					writer.writeStartElement("appInfo");
@@ -388,7 +400,7 @@
 					writer.writeEndElement(); // classDecl
 				}
 				break;
-
+			
 			case "titleStmt":
 				if (flagSourceDesc) {
 					//output.write(this.respStmt+"\n")
@@ -400,10 +412,10 @@
 		}
 		super.processEndElement();
 	}
-
+	
 	/** The declarenamespace. */
 	boolean declarenamespace = false;
-
+	
 	/**
 	 * Declare namespace.
 	 *
@@ -416,35 +428,38 @@
 			declarenamespace = true;
 		}
 	}
-
+	
 	/**
 	 * The main method.
 	 *
 	 * @param args the arguments
 	 */
 	public static void main(String[] args) {
-
+		
 		String rootDir = "~/xml/rgaqcj/";
 		new File(rootDir + "/injection/").mkdir();
-
-		def milestones = ["tagUsage", "pb", "lb","catRef"]// the tags who
-
+		
+		def milestones = [
+			"tagUsage",
+			"pb",
+			"lb",
+			"catRef"]// the tags who
 		File srcfile = new File(rootDir, "/anainline/", "roland.xml");
 		File pos1file = new File(rootDir, "/pos/", "rolandTT1-w-ana.xml");
-
+		
 		File src2file = new File(rootDir, "/injection/", "roland.xml");
 		File pos2file = new File(rootDir, "/pos/", "rolandTT2-w-ana.xml");
-
+		
 		println("process file : " + srcfile + " with : " + pos1file);
 		def builder = new AnnotationInjection(srcfile.toURI().toURL(),
 				pos1file.toURI().toURL(), milestones);
 		builder.transfomFile(new File(rootDir + "/injection/", "roland.xml"));
-
+		
 		println("process file : " + src2file + " with : " + pos1file);
 		builder = new AnnotationInjection(src2file.toURI().toURL(), pos2file.toURI().toURL(),
 				milestones);
 		builder.transfomFile(rootDir + "/injection/", "roland-FINAL.xml");
-
+		
 		return;
 	}
 }
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/compiler.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/compiler.groovy	(revision 2987)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/compiler.groovy	(revision 2988)
@@ -220,7 +220,7 @@
 
 		String[] pAttributes = pargs
 
-		String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, "sp:0+n+speaker+end+start+overlap+time"];
+		String[] sAttributes = ["txmcorpus:0+lang", uAttr , textAttr, "event:0+id+desc+type+extent", sectionAttr, "sp:0+n+who+end+start+overlap+time"];
 
 		println "pAttributes: $pAttributes"
 		println "sAttributes: $sAttributes"
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy	(revision 2987)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/TRSToTEI.groovy	(revision 2988)
@@ -204,7 +204,15 @@
 				
 				writer.writeAttribute("start", time)
 				writer.writeAttribute("end", parser.getAttributeValue(null, "endTime"))
-				writeAttributes();
+				
+				writer.writeAttribute("who", parser.getAttributeValue(null, "speaker"))
+				
+				for (int i = 0; i < parser.getAttributeCount(); i++) { // write other attributes if any
+					String v = parser.getAttributeLocalName(i);
+					if (!("who".equals(v)) && !("overlap".equals(v)) && !("time".equals(v)) && !("speaker".equals(v)) && !("endTime".equals(v)) && !("startTime".equals(v))) {
+						writeAttribute(parser.getAttributePrefix(i), parser.getAttributeLocalName(i), parser.getAttributeValue(i));
+					}
+				}
 				break;
 			case "Sync": // >> u
 				lastTime = parser.getAttributeValue(null, "time")
Index: tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/SendEditionTo.java
===================================================================
--- tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/SendEditionTo.java	(revision 2987)
+++ tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/SendEditionTo.java	(revision 2988)
@@ -66,20 +66,28 @@
 		IEditionEditor editor = (IEditionEditor) SWTEditorsUtils.getActiveEditor(event);
 		String query = null;
 		if (editor instanceof SynopticEditionEditor) {
-			SynopticEditionEditor seditor = (SynopticEditionEditor)editor;
+			SynopticEditionEditor seditor = (SynopticEditionEditor) editor;
 			String[] wordids = seditor.getWordSelection();
 			if (wordids == null) { // last resort
-				query = ((IEditionEditor)editor).getTextSelection();
-			} else {
+				query = editor.getTextSelection();
+			}
+			else {
 				
 				try {
 					Edition edition = seditor.getEditionPanel(0).getEdition();
 					Text text = edition.getText();
 					Project project = text.getParent();
 					String textid = edition.getText().getName();
-					
-					CQPCorpus corpus = (CQPCorpus) project.getCorpusBuild(null, MainCorpus.class);
-					
+					CQPCorpus corpus = seditor.getCorpus();// (CQPCorpus) project.getCorpusBuild(null, MainCorpus.class);
+					if (corpus == null) {
+						String ncorpus = edition.getStringParameterValue("corpus");
+						if (ncorpus != null && ncorpus.length() > 0) {
+							corpus = (CQPCorpus) project.getCorpusBuild(ncorpus);
+						}
+						else { // last resort
+							corpus = (CQPCorpus) project.getCorpusBuild(null, MainCorpus.class);
+						}
+					}
 					Match m = null;
 					Match n = null;
 					
@@ -95,12 +103,13 @@
 						
 						m = rez.getMatch(0);
 						n = rez.getMatch(0);
-					} else if (wordids[0] != null && wordids[1] != null) {
-						CQLQuery cqlQuery = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", wordids[0]+"|"+wordids[1], textid));
+					}
+					else if (wordids[0] != null && wordids[1] != null) {
+						CQLQuery cqlQuery = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", wordids[0] + "|" + wordids[1], textid));
 						QueryResult rez = corpus.query(cqlQuery, "TMP", false);
 						
 						if (rez.getNMatch() != 2) {
-							Log.warning(NLS.bind("Warning: found more than or no word for id={0} in {1}", wordids[0]+", "+wordids[1], textid));
+							Log.warning(NLS.bind("Warning: found more than or no word for id={0} in {1}", wordids[0] + ", " + wordids[1], textid));
 							return null;
 						}
 						
@@ -115,19 +124,21 @@
 						if (words != null && words.length > 0) {
 							query = "";
 							for (String w : words) {
-								query += " \""+CQLQuery.addBackSlash(w)+"\"";
+								query += " \"" + CQLQuery.addBackSlash(w) + "\"";
 							}
 							query = query.substring(1);
 						}
 					}
-				} catch (Exception e) {
-					Log.warning("Error: "+e);
+				}
+				catch (Exception e) {
+					Log.warning("Error: " + e);
 					Log.printStackTrace(e);
 				}
 			}
 			return query;
-		} else { // try using text selection of the current editor
-			query = ((IEditionEditor)editor).getTextSelection();
+		}
+		else { // try using text selection of the current editor
+			query = editor.getTextSelection();
 			query = query.replaceAll("\n", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
 			query = "\"" + CQLQuery.addBackSlash(query) + "\""; //$NON-NLS-1$ //$NON-NLS-2$
 			return query;
Index: tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java
===================================================================
--- tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java	(revision 2987)
+++ tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java	(revision 2988)
@@ -75,7 +75,7 @@
 			String query = this.createQuery(event, selection);
 			String queries = this.createQueries(event, selection);
 			
-			if (query.isEmpty() && queries.isEmpty()) {
+			if ((query == null || query.isEmpty()) && (queries == null || queries.isEmpty())) {
 				Log.warning(Messages.noQueryWasSetCommandCanceled);
 				return null;
 			}
